From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id 8EA973858D35; Thu, 20 Jan 2022 01:01:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8EA973858D35 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] newlib: internalize HAVE_INITFINI_ARRAY X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: 6783cceb0acdf163f8f8843f63c17e08c07b88e9 X-Git-Newrev: 437c5c5085ff30b4a4960b2b53d06728c788361d Message-Id: <20220120010133.8EA973858D35@sourceware.org> Date: Thu, 20 Jan 2022 01:01:33 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2022 01:01:33 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D437c5c5085f= f30b4a4960b2b53d06728c788361d commit 437c5c5085ff30b4a4960b2b53d06728c788361d Author: Mike Frysinger Date: Mon Jan 17 22:20:20 2022 -0500 newlib: internalize HAVE_INITFINI_ARRAY =20 This define is only used by newlib internally, so stop exporting it as HAVE_INITFINI_ARRAY since this can conflict with defines packages use themselves. =20 We don't really need to add _ to HAVE_INIT_FINI too since it isn't exported in newlib.h, but might as well be consistent here. =20 We can't (easily) add this to newlib_cflags like HAVE_INIT_FINI is because this is based on a compile-time test in the top configure, not on plain shell code in configure.host. We'd have to replicate the test in every subdir in order to have it passed down. Diff: --- newlib/configure | 2 +- newlib/configure.ac | 2 +- newlib/configure.host | 2 +- newlib/libc/misc/fini.c | 6 +++--- newlib/libc/misc/init.c | 6 +++--- newlib/libc/stdlib/__call_atexit.c | 2 +- newlib/libc/sys/arm/crt0.S | 2 +- newlib/newlib.hin | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/newlib/configure b/newlib/configure index e303a2729..8190f9f2e 100755 --- a/newlib/configure +++ b/newlib/configure @@ -12817,7 +12817,7 @@ $as_echo "$libc_cv_initfinit_array" >&6; } =20 if test $libc_cv_initfinit_array =3D yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_INITFINI_ARRAY 1 +#define _HAVE_INITFINI_ARRAY 1 _ACEOF =20 fi diff --git a/newlib/configure.ac b/newlib/configure.ac index 361bbfbac..8dca042aa 100644 --- a/newlib/configure.ac +++ b/newlib/configure.ac @@ -648,7 +648,7 @@ fi rm -f conftest*]) AC_SUBST(libc_cv_initfinit_array) if test $libc_cv_initfinit_array =3D yes; then - AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY) + AC_DEFINE_UNQUOTED(_HAVE_INITFINI_ARRAY) fi =20 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \ diff --git a/newlib/configure.host b/newlib/configure.host index c429dde1c..ca6b46f03 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -992,7 +992,7 @@ fi =20 # Have init/finit if not explicitly specified otherwise if [ "x${have_init_fini}" !=3D "xno" ]; then - newlib_cflags=3D"${newlib_cflags} -DHAVE_INIT_FINI" + newlib_cflags=3D"${newlib_cflags} -D_HAVE_INIT_FINI" fi =20 if test -z "${have_crt0}" && test -n "${sys_dir}"; then diff --git a/newlib/libc/misc/fini.c b/newlib/libc/misc/fini.c index 56eed6cb3..5f2016070 100644 --- a/newlib/libc/misc/fini.c +++ b/newlib/libc/misc/fini.c @@ -13,11 +13,11 @@ /* Handle ELF .{pre_init,init,fini}_array sections. */ #include =20 -#ifdef HAVE_INITFINI_ARRAY +#ifdef _HAVE_INITFINI_ARRAY extern void (*__fini_array_start []) (void) __attribute__((weak)); extern void (*__fini_array_end []) (void) __attribute__((weak)); =20 -#ifdef HAVE_INIT_FINI +#ifdef _HAVE_INIT_FINI extern void _fini (void); #endif =20 @@ -32,7 +32,7 @@ __libc_fini_array (void) for (i =3D count; i > 0; i--) __fini_array_start[i-1] (); =20 -#ifdef HAVE_INIT_FINI +#ifdef _HAVE_INIT_FINI _fini (); #endif } diff --git a/newlib/libc/misc/init.c b/newlib/libc/misc/init.c index 95f1a7422..3aef7ad06 100644 --- a/newlib/libc/misc/init.c +++ b/newlib/libc/misc/init.c @@ -13,7 +13,7 @@ /* Handle ELF .{pre_init,init,fini}_array sections. */ #include =20 -#ifdef HAVE_INITFINI_ARRAY +#ifdef _HAVE_INITFINI_ARRAY =20 /* These magic symbols are provided by the linker. */ extern void (*__preinit_array_start []) (void) __attribute__((weak)); @@ -21,7 +21,7 @@ extern void (*__preinit_array_end []) (void) __attribute_= _((weak)); extern void (*__init_array_start []) (void) __attribute__((weak)); extern void (*__init_array_end []) (void) __attribute__((weak)); =20 -#ifdef HAVE_INIT_FINI +#ifdef _HAVE_INIT_FINI extern void _init (void); #endif =20 @@ -36,7 +36,7 @@ __libc_init_array (void) for (i =3D 0; i < count; i++) __preinit_array_start[i] (); =20 -#ifdef HAVE_INIT_FINI +#ifdef _HAVE_INIT_FINI _init (); #endif =20 diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call= _atexit.c index 3eec11214..c29a03c8e 100644 --- a/newlib/libc/stdlib/__call_atexit.c +++ b/newlib/libc/stdlib/__call_atexit.c @@ -49,7 +49,7 @@ static void register_fini(void) { if (&__libc_fini) { -#ifdef HAVE_INITFINI_ARRAY +#ifdef _HAVE_INITFINI_ARRAY extern void __libc_fini_array (void); atexit (__libc_fini_array); #else diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S index 5e677a23c..6b01d8a88 100644 --- a/newlib/libc/sys/arm/crt0.S +++ b/newlib/libc/sys/arm/crt0.S @@ -12,7 +12,7 @@ #error __USER_LABEL_PREFIX is not defined #endif =20 -#ifdef HAVE_INITFINI_ARRAY +#ifdef _HAVE_INITFINI_ARRAY #define _init __libc_init_array #define _fini __libc_fini_array #endif diff --git a/newlib/newlib.hin b/newlib/newlib.hin index a0999512c..37ed88e97 100644 --- a/newlib/newlib.hin +++ b/newlib/newlib.hin @@ -49,7 +49,7 @@ =20 /* Define if the linker supports .preinit_array/.init_array/.fini_array * sections. */ -#undef HAVE_INITFINI_ARRAY +#undef _HAVE_INITFINI_ARRAY =20 /* True if atexit() may dynamically allocate space for cleanup functions. */