]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Always enable DT_INIT_ARRAY/DT_FINI_ARRAY on Linux
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 8 Jun 2021 23:09:24 +0000 (16:09 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 9 Jun 2021 12:14:24 +0000 (05:14 -0700)
DT_INIT_ARRAY/DT_FINI_ARRAY support was added to glibc 2.1 by

commit fcf70d4114db9ff7923f5dfeb3fea6e2d623e5c2
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Sat Jul 24 19:45:13 1999 +0000

    Update.

    1999-07-24  Ulrich Drepper  <drepper@cygnus.com>

            * elf/dl-fini.c: Handle DT_FINI_ARRAY.
            * elf/link.h (struct link_map): Remove l_init_running.  Add l_runcount
            and l_initcount.
            * elf/dl-init.c: Handle DT_INIT_ARRAY.
...

and added to binutils 2.12 by

commit e9682144c14fc809af72bd6c0b8c69731d38679c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 4 20:40:48 2002 +0000

    2002-03-04  H.J. Lu <hjl@gnu.org>

            * config/obj-elf.c (special_section): Add .init_array,
            .fini_array and .preinit_array.

            * config/tc-ia64.h (ELF_TC_SPECIAL_SECTIONS): Remove
            .init_array and .fini_array.

gcc/

PR target/100896
* config.gcc (gcc_cv_initfini_array): Set to yes for Linux and
GNU targets.
* doc/install.texi: Require glibc 2.1 and binutils 2.12 for
Linux and GNU targets.

gcc/config.gcc
gcc/doc/install.texi

index 6833a6c13d945cd39532e48676482054d0b2fa56..4dc4fe0b65c07a900f59dfa80fa889528fd837c7 100644 (file)
@@ -848,6 +848,8 @@ case ${target} in
   tmake_file="${tmake_file} t-glibc"
   target_has_targetcm=yes
   target_has_targetdm=yes
+  # Linux targets always support .init_array.
+  gcc_cv_initfini_array=yes
   ;;
 *-*-netbsd*)
   tm_p_file="${tm_p_file} netbsd-protos.h"
index 591ccaacbc1c339059b2495f49764196458f108f..94b167a3ed3d3e8b50dc86b751c9abcb52c94cb9 100644 (file)
@@ -4126,6 +4126,9 @@ supported, so @option{--enable-threads=dce} does not work.
 @end html
 @anchor{x-x-linux-gnu}
 @heading *-*-linux-gnu
+The @code{.init_array} and @code{.fini_array} sections are enabled
+unconditionally which requires at least glibc 2.1 and binutils 2.12.
+
 Versions of libstdc++-v3 starting with 3.2.1 require bug fixes present
 in glibc 2.2.5 and later.  More information is available in the
 libstdc++-v3 documentation.