about summary refs log tree commit diff
path: root/csu/elf-init.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-02-18 14:42:41 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-02-18 15:12:25 +0100
commitf4349837d93b4dfe9ba09791e280ee2d6c99919f (patch)
tree2d9b57dc8a2b38bc369e0e0f89232046d8be38ca /csu/elf-init.c
parent6e05978f0c30e52420e086cc3156655471e6fb0a (diff)
downloadglibc-f4349837d93b4dfe9ba09791e280ee2d6c99919f.tar.gz
glibc-f4349837d93b4dfe9ba09791e280ee2d6c99919f.tar.xz
glibc-f4349837d93b4dfe9ba09791e280ee2d6c99919f.zip
Introduce <elf-initfini.h> and ELF_INITFINI for all architectures
This supersedes the init_array sysdeps directory.  It allows us to
check for ELF_INITFINI in both C and assembler code, and skip DT_INIT
and DT_FINI processing completely on newer architectures.

A new header file is needed because <dl-machine.h> is incompatible
with assembler code.  <sysdep.h> is compatible with assembler code,
but it cannot be included in all assembler files because on some
architectures, it redefines register names, and some assembler files
conflict with that.

<elf-initfini.h> is replicated for legacy architectures which need
DT_INIT/DT_FINI support.  New architectures follow the generic default
and disable it.
Diffstat (limited to 'csu/elf-init.c')
-rw-r--r--csu/elf-init.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/csu/elf-init.c b/csu/elf-init.c
index b713c8b0fb..98b3f11ff5 100644
--- a/csu/elf-init.c
+++ b/csu/elf-init.c
@@ -34,6 +34,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
+#include <elf-initfini.h>
 
 
 /* These magic symbols are provided by the linker.  */
@@ -49,7 +50,7 @@ extern void (*__fini_array_start []) (void) attribute_hidden;
 extern void (*__fini_array_end []) (void) attribute_hidden;
 
 
-#ifndef NO_INITFINI
+#if ELF_INITFINI
 /* These function symbols are provided for the .init/.fini section entry
    points automagically by the linker.  */
 extern void _init (void);
@@ -79,7 +80,7 @@ __libc_csu_init (int argc, char **argv, char **envp)
   }
 #endif
 
-#ifndef NO_INITFINI
+#if ELF_INITFINI
   _init ();
 #endif
 
@@ -99,7 +100,7 @@ __libc_csu_fini (void)
   while (i-- > 0)
     (*__fini_array_start [i]) ();
 
-# ifndef NO_INITFINI
+# if ELF_INITFINI
   _fini ();
 # endif
 #endif