From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 923CF3858401 for ; Sun, 7 Nov 2021 00:21:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 923CF3858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 007A734313E; Sun, 7 Nov 2021 00:21:02 +0000 (UTC) Date: Sat, 6 Nov 2021 20:21:03 -0400 From: Mike Frysinger To: newlib@sourceware.org Subject: what's up with _COMPILING_NEWLIB Message-ID: Mail-Followup-To: newlib@sourceware.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WqhAMUEMjx7aoN4v" Content-Disposition: inline X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2021 00:21:05 -0000 --WqhAMUEMjx7aoN4v Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable i stumbled across _COMPILING_NEWLIB and it seems to be what i want: a symbol that indicates the code currently being compiled is newlib itself so that t= he header can change behavior for that environment specifically. is that what it's meant for ? if so, why does it seem to be inconsistently defined ? newlib/configure.ho= st will add it for a few random targets, as does the mips-specific newlib/libc/machine/mips/Makefile.am, as do a few specific winsup/cygwin/ files. it feels like the patch below is what we should have. if that's not what this is for, is there a define that has this meaning ? in the glibc & gnulib world, the plain _LIBC define indicates this. -mike --- a/newlib/configure.host +++ b/newlib/configure.host @@ -54,7 +54,7 @@ # have_init_fini have init/fini ("yes" or "no", set to "yes" by default) # noinclude list of include files to not install =20 -newlib_cflags=3D +newlib_cflags=3D"-D_COMPILING_NEWLIB" libm_machine_dir=3D machine_dir=3D shared_machine_dir=3D @@ -467,15 +467,11 @@ case "${host}" in sys_dir=3Da29khif signal_dir=3D ;; - aarch64*-*-*) - newlib_cflags=3D"${newlib_cflags} -D_COMPILING_NEWLIB" - ;; amdgcn*) sys_dir=3Damdgcn have_crt0=3D"no" ;; arm*-*-*) - newlib_cflags=3D"${newlib_cflags} -D_COMPILING_NEWLIB" sys_dir=3Darm if [ "x${newlib_may_supply_syscalls}" =3D "xno" ] ; then have_crt0=3D"no" @@ -652,11 +648,11 @@ case "${host}" in default_newlib_io_long_double=3D"yes" default_newlib_io_pos_args=3D"yes" CC=3D"${CC} -I${cygwin_srcdir}/include" - newlib_cflags=3D"${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DGETREENT= _PROVIDED -DSIGNAL_PROVIDED -D_COMPILING_NEWLIB -DHAVE_BLKSIZE -DHAVE_FCNTL= -DMALLOC_PROVIDED" + newlib_cflags=3D"${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DGETREENT= _PROVIDED -DSIGNAL_PROVIDED -DHAVE_BLKSIZE -DHAVE_FCNTL -DMALLOC_PROVIDED" syscall_dir=3Dsyscalls ;; *-*-phoenix*) - newlib_cflags=3D"${newlib_cflags} -DMISSING_SYSCALL_NAMES -D_COMPILING_NE= WLIB -DHAVE_BLKSIZE -DHAVE_NANOSLEEP" + newlib_cflags=3D"${newlib_cflags} -DMISSING_SYSCALL_NAMES -DHAVE_BLKSIZE = -DHAVE_NANOSLEEP" default_newlib_io_long_long=3D"yes" syscall_dir=3D ;; @@ -671,7 +667,6 @@ case "${host}" in default_newlib_io_long_long=3D"yes" default_newlib_io_c99_formats=3D"yes" newlib_cflags=3D"${newlib_cflags} -ffunction-sections -fdata-sections " - newlib_cflags=3D"${newlib_cflags} -D_COMPILING_NEWLIB" newlib_cflags=3D"${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXI= T_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVI= DED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC" # turn off unsupported items in posix directory=20 newlib_cflags=3D"${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GET= UT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN" --- a/newlib/libc/machine/mips/Makefile.am +++ b/newlib/libc/machine/mips/Makefile.am @@ -9,8 +9,6 @@ AM_CCASFLAGS =3D $(INCLUDES) noinst_LIBRARIES =3D lib.a =20 lib_a_SOURCES =3D setjmp.S strlen.c strcmp.S strncpy.c memset.S memcpy.S -lib_a_CCASFLAGS=3D$(AM_CCASFLAGS) -D_COMPILING_NEWLIB -lib_a_CFLAGS=3D$(AM_CFLAGS) -D_COMPILING_NEWLIB =20 ACLOCAL_AMFLAGS =3D -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES =3D $(newlib_basedir)/configure.host --- a/newlib/libc/machine/mips/Makefile.in +++ b/newlib/libc/machine/mips/Makefile.in @@ -198,8 +198,6 @@ INCLUDES =3D $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_= CFLAGS) AM_CCASFLAGS =3D $(INCLUDES) noinst_LIBRARIES =3D lib.a lib_a_SOURCES =3D setjmp.S strlen.c strcmp.S strncpy.c memset.S memcpy.S -lib_a_CCASFLAGS =3D $(AM_CCASFLAGS) -D_COMPILING_NEWLIB -lib_a_CFLAGS =3D $(AM_CFLAGS) -D_COMPILING_NEWLIB ACLOCAL_AMFLAGS =3D -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES =3D $(newlib_basedir)/configure.host all: all-am --WqhAMUEMjx7aoN4v Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmGHG+8ACgkQQWM7n+g3 9YGZ6w//ZEz+5vwSCnD7TAxiX9eQjHflXcNq0KvZwP+V2zWHwj12lURPzcCuLBKH LN8qKOI/0r5nRhuXJHkefTiuFkbVud+jjkaZJIQ0SDQRmE90AZBGj4L2Vs8Gl1Sr lNfqU0+pKbf5Q+efEljPkIuYm7JkJTQ+rtd4amHtun+x6ksL9Y8oGnHNCbwymaSj ItJjaXEjQK/3bziboIkDzyD9iWxDrLUdMCEjENz0WQYqpo03eqJu0Rmh6wQ19hJu wNFD7szmV4unjkteRhnmITr02/O0BUNCzlMnG68GqMI0PDYaEYPhVSNqAm5j81rd u2E4EMggn714zwt7hREfDf/1zlCPowRQdDp7Abkz9253O+iSuks7PBB7IW49Q731 U6XgpBx7Lgl7SDvhDpNJv62Pt7eZbPxl/48/9No9tL9E+K4uWL84TgE9nLSz73ki XDq/8r0dlx91lL3ilryh5H7WQPy5WMqbw2qEsFDHZ8Jm+YvJjZWuqqpSWaSNdp/M K4GtqoLGW+cyIz92iayIEqWtCpN/oS5JXrrX6XNFkuydAik+a69W/+VPjDrGt9lH mzsY3elQfAfrxyE4AzMOyiovHw3YBNjse65UAhCL34DG5CEf/owDf4bUgtWzoO9y H69jvDnK1SXT3i6DUaJpjYPNumlEKlBSwhGLCQ0FTJnJ9Mja/Y0= =/IiB -----END PGP SIGNATURE----- --WqhAMUEMjx7aoN4v--