Message ID | 20250131210423.967769-1-ykolerov@synopsys.com |
---|---|
State | New |
Headers |
Return-Path: <newlib-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AE273858CDB for <patchwork@sourceware.org>; Fri, 31 Jan 2025 21:05:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AE273858CDB Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=pfptdkimsnps header.b=HBOaHjBs; dkim=pass (2048-bit key, unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=mail header.b=AcOLDE23 X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) by sourceware.org (Postfix) with ESMTPS id 8EBAF3858D39 for <newlib@sourceware.org>; Fri, 31 Jan 2025 21:04:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8EBAF3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=synopsys.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8EBAF3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.9 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738357479; cv=none; b=tjwu51DxJ5UI57qKFZSGCfK7OBzBEaD1wlrNt8S0LKYnRoXu43SO88vpzS3jqgClkSTcsrTJIHNQOTTinyQB3Pjzrce38Mmt3l4oTZwcoGMKkcb/njf3rHADTzJ4hb2vidssRBlirat9mEF5IwR4IjJ7KzTdlNlJEqVM9dXGnO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738357479; c=relaxed/simple; bh=GIdqYvq0NG6zfmN6M5YOgpyDpDsolWD20RH0yRNB37w=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=eFztq4JNXRMVerHtpFTenH9mZ4iv7gd+mlqmlK+zKSzWsTvIgQ4SY99BTW7WWMCBL9ULCRKkjV3Eh8olpznmfMi+a9WUwuOovmiPeWjdrXgruCJY9B8OFnMLu1n8ZLW5QuFoJkLYwFNAR6yttpamDBSP7dpPBK7dGPF4w25to+A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8EBAF3858D39 Received: from pps.filterd (m0098572.ppops.net [127.0.0.1]) by mx0b-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50VJjYsN027469 for <newlib@sourceware.org>; Fri, 31 Jan 2025 13:04:34 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pfptdkimsnps; bh=/TRliEoX8euuBO4TcPkvc5L394jczlDw OvzBMsaBzJM=; b=HBOaHjBsn6G1jHEMY03PlVUVB++nzLra9TUiPBgnlUdOXYC0 ak5iOhkQOOCVi1DpFro6+XXfbifaM4DnfRilpfwU+oZxliMOfiWdLjVhH1GiXetB En+lJJhkzWguj3DFobjePx3ILX7Wa6bwJS1iIgPfXk5W8K7dCzmLYgRCPzaxPjkI HTh+BqSBA4QiX6/dKDxhSQrpEEDivaeIJtpNmfKxbrReOuA9TmuQCDEULnDMo0E5 LhbOcHb9OKnC7NQ2lyJ/DrLLgc8i1rDqjXXc78Y05lDhP5/zcljoL5geHBBHLTBK wyMfKSuAhpVjoCSmKml4SCv/iu2iryEG2LjaTg== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0b-00230701.pphosted.com (PPS) with ESMTPS id 44h4xv0a29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <newlib@sourceware.org>; Fri, 31 Jan 2025 13:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1738357473; bh=GIdqYvq0NG6zfmN6M5YOgpyDpDsolWD20RH0yRNB37w=; h=From:To:Cc:Subject:Date:From; b=AcOLDE23m8CanNXw+xprdna+Tk5ozeA64HdRWsWviiaW0UpooNIJ6x/O8a6dYmW3M HzcHkEM+aWXCzt78HQrVEHcBgkKnMhiVMcLRNfckfNDMogKm7ingEvxTRTcolOOo0i vAPPZClg+sXQSOdL1He2/bXvGNwVjE16zeRwcX4ZCaESPZ9/5Yqbe5JxpZ/wyXDciZ +GHyw1trKBFDdtsjLqGxgYZYV1buad9UqJDtmYZk+OU6mO6CCfr7PgSpNvrdUcc5j9 2VaybreWD4oV8JdQZt3bDpa11KF0ikoOAhyjMshvLiELZhu6mD18TIO+C7L0QH5pku rJvnR4mYyqo0w== Received: from mailhost.synopsys.com (eudc-mailhost2.synopsys.com [10.213.161.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id E107140519 for <newlib@sourceware.org>; Fri, 31 Jan 2025 21:04:32 +0000 (UTC) Received: from SNPS-pZ8jIRJUHe.internal.synopsys.com (snps-pz8jirjuhe.internal.synopsys.com [10.213.60.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mailhost.synopsys.com (Postfix) with ESMTPSA id B8066C087F; Fri, 31 Jan 2025 21:04:30 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Yuriy Kolerov <Yuriy.Kolerov@synopsys.com> To: newlib@sourceware.org Cc: Yuriy Kolerov <Yuriy.Kolerov@synopsys.com> Subject: [PATCH 1/2] libgloss: arc: Add _getentropy stub Date: Fri, 31 Jan 2025 23:04:22 +0200 Message-Id: <20250131210423.967769-1-ykolerov@synopsys.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: ErruJidELRIjdyDbb6fDd-RLLHAO7lS7 X-Proofpoint-ORIG-GUID: ErruJidELRIjdyDbb6fDd-RLLHAO7lS7 X-Authority-Analysis: v=2.4 cv=EdIyQOmC c=1 sm=1 tr=0 ts=679d3ae2 cx=c_pps a=8EbXvwLXkpGsT4ql/pYRAw==:117 a=8EbXvwLXkpGsT4ql/pYRAw==:17 a=VdSt8ZQiCzkA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=BV6zN_1N_aVTpCZWr74A:9 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-31_08,2025-01-31_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 priorityscore=1501 bulkscore=0 mlxlogscore=918 clxscore=1011 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2501310160 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list <newlib.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/newlib>, <mailto:newlib-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/newlib/> List-Post: <mailto:newlib@sourceware.org> List-Help: <mailto:newlib-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/newlib>, <mailto:newlib-request@sourceware.org?subject=subscribe> Errors-To: newlib-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[1/2] libgloss: arc: Add _getentropy stub
|
|
Commit Message
Yuriy Kolerov
Jan. 31, 2025, 9:04 p.m. UTC
Stub function for _getentropy is presented in libnosys and it is
not presented in libgloss libraries for ARC. When libstdc++ is
built it detects that _getentropy is presented in the default
libgloss library (libnosys). However, then GCC fails to link
applications with another libgloss libraries like nSIM, HostLink,
boards, etc. because of missing _getentropy stub in corresponding
libraries.
Here is an example:
$ cat getentropy.cpp
#include <unistd.h>
int main () {
unsigned i;
::getentropy(&i, sizeof(i));
return 0;
}
$ arc64-elf-g++ -mcpu=hs6x -specs=nsim.specs getentropy.cpp
...
... undefined reference to `_getentropy'
collect2: error: ld returned 1 exit status
Thus, it is necessary to add _getentropy stub to all ARC
libgloss libraries to prevent errors while building even
simple C++ programs.
Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
---
libgloss/arc/hl-stub.c | 7 +++++++
libgloss/arc/nsim-syscalls.c | 7 +++++++
libgloss/arc/uart-8250-stub.c | 7 +++++++
3 files changed, 21 insertions(+)
Comments
Hi Yuriy, Patchset pushed. Thanks, Corinna On Jan 31 23:04, Yuriy Kolerov wrote: > Stub function for _getentropy is presented in libnosys and it is > not presented in libgloss libraries for ARC. When libstdc++ is > built it detects that _getentropy is presented in the default > libgloss library (libnosys). However, then GCC fails to link > applications with another libgloss libraries like nSIM, HostLink, > boards, etc. because of missing _getentropy stub in corresponding > libraries. > > Here is an example: > > $ cat getentropy.cpp > #include <unistd.h> > > int main () { > unsigned i; > ::getentropy(&i, sizeof(i)); > return 0; > } > > $ arc64-elf-g++ -mcpu=hs6x -specs=nsim.specs getentropy.cpp > ... > ... undefined reference to `_getentropy' > collect2: error: ld returned 1 exit status > > Thus, it is necessary to add _getentropy stub to all ARC > libgloss libraries to prevent errors while building even > simple C++ programs. > > Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com> > --- > libgloss/arc/hl-stub.c | 7 +++++++ > libgloss/arc/nsim-syscalls.c | 7 +++++++ > libgloss/arc/uart-8250-stub.c | 7 +++++++ > 3 files changed, 21 insertions(+) > > diff --git a/libgloss/arc/hl-stub.c b/libgloss/arc/hl-stub.c > index c4d6ee67b..a554d06b3 100644 > --- a/libgloss/arc/hl-stub.c > +++ b/libgloss/arc/hl-stub.c > @@ -93,3 +93,10 @@ _link (const char *oldpath __attribute__ ((unused)), > errno = ENOSYS; > return -1; > } > + > +int > +_getentropy (void *buf, size_t buflen) > +{ > + errno = ENOSYS; > + return -1; > +} > diff --git a/libgloss/arc/nsim-syscalls.c b/libgloss/arc/nsim-syscalls.c > index 0a99ad59c..ca260a579 100644 > --- a/libgloss/arc/nsim-syscalls.c > +++ b/libgloss/arc/nsim-syscalls.c > @@ -216,6 +216,13 @@ _fstat (int fd, struct stat *buf) > return __res; > } > > +int > +_getentropy (void *buf, size_t buflen) > +{ > + errno = ENOSYS; > + return -1; > +} > + > /* Some system calls are implemented in nSIM hostlink, but are available only > on Linux hosts. To minimize potential compatibility issues they are by > default disabled in libgloss build. */ > diff --git a/libgloss/arc/uart-8250-stub.c b/libgloss/arc/uart-8250-stub.c > index ab69d6354..1b07151fc 100644 > --- a/libgloss/arc/uart-8250-stub.c > +++ b/libgloss/arc/uart-8250-stub.c > @@ -114,3 +114,10 @@ _argv (int a __attribute__ ((unused)), char *arg __attribute__ ((unused))) > { > return -1; > } > + > +int > +_getentropy (void *buf, size_t buflen) > +{ > + errno = ENOSYS; > + return -1; > +} > -- > 2.34.1
diff --git a/libgloss/arc/hl-stub.c b/libgloss/arc/hl-stub.c index c4d6ee67b..a554d06b3 100644 --- a/libgloss/arc/hl-stub.c +++ b/libgloss/arc/hl-stub.c @@ -93,3 +93,10 @@ _link (const char *oldpath __attribute__ ((unused)), errno = ENOSYS; return -1; } + +int +_getentropy (void *buf, size_t buflen) +{ + errno = ENOSYS; + return -1; +} diff --git a/libgloss/arc/nsim-syscalls.c b/libgloss/arc/nsim-syscalls.c index 0a99ad59c..ca260a579 100644 --- a/libgloss/arc/nsim-syscalls.c +++ b/libgloss/arc/nsim-syscalls.c @@ -216,6 +216,13 @@ _fstat (int fd, struct stat *buf) return __res; } +int +_getentropy (void *buf, size_t buflen) +{ + errno = ENOSYS; + return -1; +} + /* Some system calls are implemented in nSIM hostlink, but are available only on Linux hosts. To minimize potential compatibility issues they are by default disabled in libgloss build. */ diff --git a/libgloss/arc/uart-8250-stub.c b/libgloss/arc/uart-8250-stub.c index ab69d6354..1b07151fc 100644 --- a/libgloss/arc/uart-8250-stub.c +++ b/libgloss/arc/uart-8250-stub.c @@ -114,3 +114,10 @@ _argv (int a __attribute__ ((unused)), char *arg __attribute__ ((unused))) { return -1; } + +int +_getentropy (void *buf, size_t buflen) +{ + errno = ENOSYS; + return -1; +}