diff mbox series

Always enable DT_INIT_ARRAY/DT_FINI_ARRAY on Linux

Message ID 20210608231217.3845032-1-hjl.tools@gmail.com
State New
Headers show
Series Always enable DT_INIT_ARRAY/DT_FINI_ARRAY on Linux | expand

Commit Message

H.J. Lu June 8, 2021, 11:12 p.m. UTC
DT_INIT_ARRAY/DT_FINI_ARRAY support was added to glibc 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.
...

	PR target/100896
	* config.gcc (gcc_cv_initfini_array): Set to yes for Linux and
	GNU targets.
---
 gcc/config.gcc | 2 ++
 1 file changed, 2 insertions(+)

Comments

Richard Biener June 9, 2021, 11 a.m. UTC | #1
On Wed, Jun 9, 2021 at 1:13 AM H.J. Lu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> DT_INIT_ARRAY/DT_FINI_ARRAY support was added to glibc 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.
> ...
>
>         PR target/100896
>         * config.gcc (gcc_cv_initfini_array): Set to yes for Linux and
>         GNU targets.
> ---
>  gcc/config.gcc | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 6833a6c13d9..4dc4fe0b65c 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -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.

Other *linux targets specifically mention

        # Force .init_array support.  The configure script cannot always
        # automatically detect that GAS supports it, yet we require it.
        gcc_cv_initfini_array=yes

and thus involve binutils.  Can you please change the comment
to mention the glibc and binutils versions required?  It might
be good to mention those in install.texi as minimal versions given
they are not trumped by already stricter requirements.

Otherwise I think this is OK.

> +  gcc_cv_initfini_array=yes
>    ;;
>  *-*-netbsd*)
>    tm_p_file="${tm_p_file} netbsd-protos.h"
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6833a6c13d9..4dc4fe0b65c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -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"