public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Fangrui Song <maskray@google.com>,
	libc-alpha@sourceware.org, Alan Modra <amodra@gmail.com>,
	Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Subject: Re: [PATCH] elf: Replace PI_STATIC_AND_HIDDEN with opposite HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
Date: Mon, 25 Apr 2022 13:40:34 -0300	[thread overview]
Message-ID: <fe0bde71-c39e-3ce6-5780-ead46716a2a1@linaro.org> (raw)
In-Reply-To: <20220425075808.1864489-1-maskray@google.com>



On 25/04/2022 04:58, Fangrui Song wrote:
> PI_STATIC_AND_HIDDEN indicates whether accesses to internal linkage
> variables and hidden visibility variables in a shared object (ld.so)
> need dynamic relocations (usually R_*_RELATIVE). PI (position
> independent) in the macro name is a misnomer: a code sequence using GOT
> is typically position-independent as well, but using dynamic relocations
> does not meet the requirement.
> 
> Not defining PI_STATIC_AND_HIDDEN is legacy and we expect that all new
> ports will define PI_STATIC_AND_HIDDEN. Current ports defining
> PI_STATIC_AND_HIDDEN are more than the opposite. Change the configure
> default.
> 
> No functional change.
> 
> Note: HIDDEN_VAR_NEEDS_DYNAMIC_RELOC will be removed when Alan Modra's
> powerpc64 static-pie work
> (https://sourceware.org/pipermail/libc-alpha/2022-April/137987.html)
> lands.

I agree the macro naming is confusing and does not represent the intent
is a straigthforward manner.  Patch looks ok, but I have added some
comments below.

> ---
>  config.h.in                            |   6 +-
>  elf/rtld.c                             |   2 +-
>  sysdeps/aarch64/configure              |   5 -
>  sysdeps/aarch64/configure.ac           |   4 -
>  sysdeps/alpha/configure                |   5 -
>  sysdeps/alpha/configure.ac             |   4 -
>  sysdeps/arc/configure                  |   2 -
>  sysdeps/arc/configure.ac               |   1 -
>  sysdeps/arm/configure                  |   3 -
>  sysdeps/arm/configure.ac               |   5 -
>  sysdeps/csky/configure                 |   3 -
>  sysdeps/csky/configure.ac              |   2 -
>  sysdeps/hppa/configure                 |   3 +
>  sysdeps/hppa/configure.ac              |   2 +
>  sysdeps/ia64/configure                 |   3 -
>  sysdeps/ia64/configure.ac              |   4 -
>  sysdeps/m68k/configure                 | 165 +++++++++++++++++++++++++
>  sysdeps/m68k/configure.ac              |   6 +
>  sysdeps/microblaze/configure           |   3 +
>  sysdeps/microblaze/configure.ac        |   2 +
>  sysdeps/mips/configure                 |   2 +
>  sysdeps/mips/configure.ac              |   2 +-
>  sysdeps/nios2/configure                |   3 +
>  sysdeps/nios2/configure.ac             |   2 +
>  sysdeps/or1k/configure                 |   3 -
>  sysdeps/or1k/configure.ac              |   2 -
>  sysdeps/powerpc/powerpc32/configure    |   3 +
>  sysdeps/powerpc/powerpc32/configure.ac |   2 +
>  sysdeps/powerpc/powerpc64/configure    |   3 +
>  sysdeps/powerpc/powerpc64/configure.ac |   2 +
>  sysdeps/powerpc/tst-tlsifunc.c         |   2 +-
>  sysdeps/riscv/configure                |   3 -
>  sysdeps/riscv/configure.ac             |   2 -
>  sysdeps/s390/configure                 |   3 -
>  sysdeps/s390/configure.ac              |   4 -
>  sysdeps/sh/configure                   |   3 -
>  sysdeps/sh/configure.ac                |   4 -
>  sysdeps/sparc/configure                |   2 -
>  sysdeps/sparc/configure.ac             |   2 -
>  sysdeps/x86/configure                  |   3 -
>  sysdeps/x86/configure.ac               |   4 -
>  41 files changed, 204 insertions(+), 82 deletions(-)
>  create mode 100644 sysdeps/m68k/configure
>  create mode 100644 sysdeps/m68k/configure.ac
> 
> diff --git a/config.h.in b/config.h.in
> index a94f756859..916465fce8 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -84,9 +84,9 @@
>  /* Define if the compiler\'s exception support is based on libunwind.  */
>  #undef	HAVE_CC_WITH_LIBUNWIND
>  
> -/* Define if the access to static and hidden variables is position independent
> -   and does not need relocations.  */
> -#undef	PI_STATIC_AND_HIDDEN
> +/* Define if the accesses to static and hidden variables in a shared object
> +   need dynamic relocations.  */
> +#undef	HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
>  
>  /* Define this to disable the 'hidden_proto' et al macros in
>     include/libc-symbols.h that avoid PLT slots in PIE.  */

OK, naming make more sense now.

> diff --git a/elf/rtld.c b/elf/rtld.c
> index 19e328f89e..2174cc1da7 100644
> --- a/elf/rtld.c
> +++ b/elf/rtld.c
> @@ -424,7 +424,7 @@ DL_SYSINFO_IMPLEMENTATION
>     is fine, too.  The latter is important here.  We can avoid setting
>     up a temporary link map for ld.so if we can mark _rtld_global as
>     hidden.  */
> -#ifdef PI_STATIC_AND_HIDDEN
> +#ifndef HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
>  # define DONT_USE_BOOTSTRAP_MAP	1
>  #endif
>  

I think it would be better to now always assume the variable is defined:

  #if HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
  # define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1
  #endif

> diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
> index 4c1fac49f3..bf972122b1 100644
> --- a/sysdeps/aarch64/configure
> +++ b/sysdeps/aarch64/configure
> @@ -1,11 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/aarch64.
>  
> -# Static and hidden objects are accessed without dynamic relocations.
> -# The exception is -mcmodel=large which is unsupported with PIC/PIE.
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  # Static PIE is supported.
>  $as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
>  
> diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
> index 3347c13fa1..51253d9802 100644
> --- a/sysdeps/aarch64/configure.ac
> +++ b/sysdeps/aarch64/configure.ac
> @@ -1,10 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/aarch64.
>  
> -# Static and hidden objects are accessed without dynamic relocations.
> -# The exception is -mcmodel=large which is unsupported with PIC/PIE.
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  # Static PIE is supported.
>  AC_DEFINE(SUPPORT_STATIC_PIE)
>  

Ok.

> diff --git a/sysdeps/alpha/configure b/sysdeps/alpha/configure
> index 3d665d96f2..f67a0e20a9 100644
> --- a/sysdeps/alpha/configure
> +++ b/sysdeps/alpha/configure
> @@ -1,11 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/alpha.
>  
> -# With required gcc+binutils, we can always access static and hidden
> -# symbols in a position independent way.
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  $as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
> diff --git a/sysdeps/alpha/configure.ac b/sysdeps/alpha/configure.ac
> index 8f9a39ed2e..465665def0 100644
> --- a/sysdeps/alpha/configure.ac
> +++ b/sysdeps/alpha/configure.ac
> @@ -1,10 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/alpha.
>  
> -# With required gcc+binutils, we can always access static and hidden
> -# symbols in a position independent way.
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  AC_DEFINE(PIE_UNSUPPORTED)

Ok.

> diff --git a/sysdeps/arc/configure b/sysdeps/arc/configure
> index bce7d3c377..92050f44e3 100644
> --- a/sysdeps/arc/configure
> +++ b/sysdeps/arc/configure
> @@ -1,8 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/arc.
>  
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
>  libc_cv_have_sdata_section=no
>  
>  # For ARC, historically ; was used for comments and not newline
> diff --git a/sysdeps/arc/configure.ac b/sysdeps/arc/configure.ac
> index cb490e47b3..619da4e088 100644
> --- a/sysdeps/arc/configure.ac
> +++ b/sysdeps/arc/configure.ac
> @@ -1,7 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/arc.
>  
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
>  libc_cv_have_sdata_section=no
>  
>  # For ARC, historically ; was used for comments and not newline

Ok.

> diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
> index 431e843b2b..b40ce60461 100644
> --- a/sysdeps/arm/configure
> +++ b/sysdeps/arm/configure
> @@ -1,9 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/arm.
>  
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  # We check to see if the compiler and flags are
>  # selecting the hard-float ABI and if they are then
>  # we set libc_cv_arm_pcs_vfp to yes which causes
> diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
> index 90cdd69c75..da078ce012 100644
> --- a/sysdeps/arm/configure.ac
> +++ b/sysdeps/arm/configure.ac
> @@ -1,11 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/arm.
>  
> -dnl It is always possible to access static and hidden symbols in an
> -dnl position independent way.  This has been true since GCC 4.1,
> -dnl which is older than the minimum version required to build libc.
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  # We check to see if the compiler and flags are
>  # selecting the hard-float ABI and if they are then
>  # we set libc_cv_arm_pcs_vfp to yes which causes

Ok.

> diff --git a/sysdeps/csky/configure b/sysdeps/csky/configure
> index 27464eb707..bcbcea089a 100644
> --- a/sysdeps/csky/configure
> +++ b/sysdeps/csky/configure
> @@ -1,9 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/csky.
>  
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  $as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
> diff --git a/sysdeps/csky/configure.ac b/sysdeps/csky/configure.ac
> index 8e00824909..ffd8c1ca9c 100644
> --- a/sysdeps/csky/configure.ac
> +++ b/sysdeps/csky/configure.ac
> @@ -1,8 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/csky.
>  
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  AC_DEFINE(PIE_UNSUPPORTED)

Ok.

> diff --git a/sysdeps/hppa/configure b/sysdeps/hppa/configure
> index cf5acf966d..ebb42c592c 100644
> --- a/sysdeps/hppa/configure
> +++ b/sysdeps/hppa/configure
> @@ -32,6 +32,9 @@ cat >>confdefs.h <<_ACEOF
>  _ACEOF
>  
>  
> +$as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
> +
> +
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  $as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
> diff --git a/sysdeps/hppa/configure.ac b/sysdeps/hppa/configure.ac
> index 3e1c35bbd9..5e59a63f9a 100644
> --- a/sysdeps/hppa/configure.ac
> +++ b/sysdeps/hppa/configure.ac
> @@ -20,6 +20,8 @@ fi
>  rm -f conftest*])
>  AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
>  
> +AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)
> +
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  AC_DEFINE(PIE_UNSUPPORTED)

Ok.

> diff --git a/sysdeps/ia64/configure b/sysdeps/ia64/configure
> index 748cb52601..90be9c0266 100644
> --- a/sysdeps/ia64/configure
> +++ b/sysdeps/ia64/configure
> @@ -1,9 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/ia64.
>  
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  $as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
> diff --git a/sysdeps/ia64/configure.ac b/sysdeps/ia64/configure.ac
> index 8e5fba32c3..6958c26415 100644
> --- a/sysdeps/ia64/configure.ac
> +++ b/sysdeps/ia64/configure.ac
> @@ -1,10 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/ia64.
>  
> -dnl It is always possible to access static and hidden symbols in an
> -dnl position independent way.
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  # PIE builds fail on binutils 2.37 and earlier, see:
>  # https://sourceware.org/bugzilla/show_bug.cgi?id=28672
>  AC_DEFINE(PIE_UNSUPPORTED)

Ok.

> diff --git a/sysdeps/m68k/configure b/sysdeps/m68k/configure
> new file mode 100644
> index 0000000000..b3cd28349e
> --- /dev/null
> +++ b/sysdeps/m68k/configure
> @@ -0,0 +1,165 @@
> +# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
> + # Local configure fragment for sysdeps/nios2.

This seems wrong.

> +
> +# Nios II big endian is not yet supported.
> +
> +
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
> +$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
> +if ${ac_cv_path_GREP+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$GREP"; then
> +  ac_path_GREP_found=false
> +  # Loop through the user's path and test for each of PROGNAME-LIST
> +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
> +do
> +  IFS=$as_save_IFS
> +  test -z "$as_dir" && as_dir=.
> +    for ac_prog in grep ggrep; do
> +    for ac_exec_ext in '' $ac_executable_extensions; do
> +      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
> +      as_fn_executable_p "$ac_path_GREP" || continue
> +# Check for GNU ac_path_GREP and select it if it is found.
> +  # Check for GNU $ac_path_GREP
> +case `"$ac_path_GREP" --version 2>&1` in
> +*GNU*)
> +  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
> +*)
> +  ac_count=0
> +  $as_echo_n 0123456789 >"conftest.in"
> +  while :
> +  do
> +    cat "conftest.in" "conftest.in" >"conftest.tmp"
> +    mv "conftest.tmp" "conftest.in"
> +    cp "conftest.in" "conftest.nl"
> +    $as_echo 'GREP' >> "conftest.nl"
> +    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
> +    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
> +    as_fn_arith $ac_count + 1 && ac_count=$as_val
> +    if test $ac_count -gt ${ac_path_GREP_max-0}; then
> +      # Best one so far, save it but keep looking for a better one
> +      ac_cv_path_GREP="$ac_path_GREP"
> +      ac_path_GREP_max=$ac_count
> +    fi
> +    # 10*(2^10) chars as input seems more than enough
> +    test $ac_count -gt 10 && break
> +  done
> +  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
> +esac
> +
> +      $ac_path_GREP_found && break 3
> +    done
> +  done
> +  done
> +IFS=$as_save_IFS
> +  if test -z "$ac_cv_path_GREP"; then
> +    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
> +  fi
> +else
> +  ac_cv_path_GREP=$GREP
> +fi
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
> +$as_echo "$ac_cv_path_GREP" >&6; }
> + GREP="$ac_cv_path_GREP"
> +
> +
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
> +$as_echo_n "checking for egrep... " >&6; }
> +if ${ac_cv_path_EGREP+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
> +   then ac_cv_path_EGREP="$GREP -E"
> +   else
> +     if test -z "$EGREP"; then
> +  ac_path_EGREP_found=false
> +  # Loop through the user's path and test for each of PROGNAME-LIST
> +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
> +do
> +  IFS=$as_save_IFS
> +  test -z "$as_dir" && as_dir=.
> +    for ac_prog in egrep; do
> +    for ac_exec_ext in '' $ac_executable_extensions; do
> +      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
> +      as_fn_executable_p "$ac_path_EGREP" || continue
> +# Check for GNU ac_path_EGREP and select it if it is found.
> +  # Check for GNU $ac_path_EGREP
> +case `"$ac_path_EGREP" --version 2>&1` in
> +*GNU*)
> +  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
> +*)
> +  ac_count=0
> +  $as_echo_n 0123456789 >"conftest.in"
> +  while :
> +  do
> +    cat "conftest.in" "conftest.in" >"conftest.tmp"
> +    mv "conftest.tmp" "conftest.in"
> +    cp "conftest.in" "conftest.nl"
> +    $as_echo 'EGREP' >> "conftest.nl"
> +    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
> +    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
> +    as_fn_arith $ac_count + 1 && ac_count=$as_val
> +    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
> +      # Best one so far, save it but keep looking for a better one
> +      ac_cv_path_EGREP="$ac_path_EGREP"
> +      ac_path_EGREP_max=$ac_count
> +    fi
> +    # 10*(2^10) chars as input seems more than enough
> +    test $ac_count -gt 10 && break
> +  done
> +  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
> +esac
> +
> +      $ac_path_EGREP_found && break 3
> +    done
> +  done
> +  done
> +IFS=$as_save_IFS
> +  if test -z "$ac_cv_path_EGREP"; then
> +    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
> +  fi
> +else
> +  ac_cv_path_EGREP=$EGREP
> +fi
> +
> +   fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
> +$as_echo "$ac_cv_path_EGREP" >&6; }
> + EGREP="$ac_cv_path_EGREP"
> +
> +
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for big endian" >&5
> +$as_echo_n "checking for big endian... " >&6; }
> +if ${libc_cv_nios2_be+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#ifdef __nios2_big_endian__
> +                      yes
> +                     #endif
> +
> +_ACEOF
> +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
> +  $EGREP "yes" >/dev/null 2>&1; then :
> +  libc_cv_nios2_be=yes
> +else
> +  libc_cv_nios2_be=no
> +fi
> +rm -f conftest*
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_nios2_be" >&5
> +$as_echo "$libc_cv_nios2_be" >&6; }
> +if test $libc_cv_nios2_be = yes; then
> +  as_fn_error $? "Big endian not supported for Nios II" "$LINENO" 5
> +fi
> +
> +$as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
> +
> diff --git a/sysdeps/m68k/configure.ac b/sysdeps/m68k/configure.ac
> new file mode 100644
> index 0000000000..1c373b1ba3
> --- /dev/null
> +++ b/sysdeps/m68k/configure.ac
> @@ -0,0 +1,6 @@
> +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> +# Local configure fragment for sysdeps/m68k.
> +
> +# Accessing static and hidden variables in a shared object needs relative
> +# relocation.
> +AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)

Ok.

> diff --git a/sysdeps/microblaze/configure b/sysdeps/microblaze/configure
> index e6652562d2..b5306339df 100755
> --- a/sysdeps/microblaze/configure
> +++ b/sysdeps/microblaze/configure
> @@ -1,6 +1,9 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/microblaze.
>  
> +$as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
> +
> +
>  # gcc 11.2.1 and earlier crash with an internal compiler error, see:
>  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103613
>  $as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
> diff --git a/sysdeps/microblaze/configure.ac b/sysdeps/microblaze/configure.ac
> index 1c58f70a7b..0b451df111 100644
> --- a/sysdeps/microblaze/configure.ac
> +++ b/sysdeps/microblaze/configure.ac
> @@ -1,6 +1,8 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/microblaze.
>  
> +AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)
> +
>  # gcc 11.2.1 and earlier crash with an internal compiler error, see:
>  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103613
>  AC_DEFINE(PIE_UNSUPPORTED)

Ok.

> diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure
> index 4e13248c03..3f4d9e9759 100644
> --- a/sysdeps/mips/configure
> +++ b/sysdeps/mips/configure
> @@ -1,6 +1,8 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/mips.
>  
> +$as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
> +
>  
>  
>  
> diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac
> index bcbdaffd9f..d3cd780d78 100644
> --- a/sysdeps/mips/configure.ac
> +++ b/sysdeps/mips/configure.ac
> @@ -3,7 +3,7 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  
>  dnl No MIPS GCC supports accessing static and hidden symbols in an
>  dnl position independent way.
> -dnl AC_DEFINE(PI_STATIC_AND_HIDDEN)
> +AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)
>  
>  AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
>    libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl

Ok.

> diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure
> index 14c8a3a014..b3cd28349e 100644
> --- a/sysdeps/nios2/configure
> +++ b/sysdeps/nios2/configure
> @@ -160,3 +160,6 @@ $as_echo "$libc_cv_nios2_be" >&6; }
>  if test $libc_cv_nios2_be = yes; then
>    as_fn_error $? "Big endian not supported for Nios II" "$LINENO" 5
>  fi
> +
> +$as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
> +
> diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac
> index f05f43802b..f738e9a7ed 100644
> --- a/sysdeps/nios2/configure.ac
> +++ b/sysdeps/nios2/configure.ac
> @@ -11,3 +11,5 @@ AC_CACHE_CHECK([for big endian],
>  if test $libc_cv_nios2_be = yes; then
>    AC_MSG_ERROR([Big endian not supported for Nios II])
>  fi
> +
> +AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)

Ok.

> diff --git a/sysdeps/or1k/configure b/sysdeps/or1k/configure
> index 1fe508c447..16146a8403 100644
> --- a/sysdeps/or1k/configure
> +++ b/sysdeps/or1k/configure
> @@ -1,5 +1,2 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/or1k.
> -
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> diff --git a/sysdeps/or1k/configure.ac b/sysdeps/or1k/configure.ac
> index 76ff97dc9a..b0214c6d84 100644
> --- a/sysdeps/or1k/configure.ac
> +++ b/sysdeps/or1k/configure.ac
> @@ -1,4 +1,2 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/or1k.
> -
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)

Ok.

> diff --git a/sysdeps/powerpc/powerpc32/configure b/sysdeps/powerpc/powerpc32/configure
> index 29cfd53e8b..551505327a 100644
> --- a/sysdeps/powerpc/powerpc32/configure
> +++ b/sysdeps/powerpc/powerpc32/configure
> @@ -1,6 +1,9 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/powerpc/powerpc32.
>  
> +$as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
> +
> +
>  # See whether GCC uses -msecure-plt.
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -msecure-plt by default" >&5
>  $as_echo_n "checking for -msecure-plt by default... " >&6; }
> diff --git a/sysdeps/powerpc/powerpc32/configure.ac b/sysdeps/powerpc/powerpc32/configure.ac
> index 5d3a9b509d..2f0ea63e0d 100644
> --- a/sysdeps/powerpc/powerpc32/configure.ac
> +++ b/sysdeps/powerpc/powerpc32/configure.ac
> @@ -1,6 +1,8 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/powerpc/powerpc32.
>  
> +AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)
> +
>  # See whether GCC uses -msecure-plt.
>  AC_CACHE_CHECK(for -msecure-plt by default, libc_cv_ppc_secure_plt, [dnl
>  echo 'int foo (void) { extern int bar; return bar; }' > conftest.c

Ok.

> diff --git a/sysdeps/powerpc/powerpc64/configure b/sysdeps/powerpc/powerpc64/configure
> index fddea0355a..f57c58ac11 100644
> --- a/sysdeps/powerpc/powerpc64/configure
> +++ b/sysdeps/powerpc/powerpc64/configure
> @@ -1,6 +1,9 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/powerpc/powerpc64.
>  
> +$as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
> +
> +
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for support for overlapping .opd entries" >&5
>  $as_echo_n "checking for support for overlapping .opd entries... " >&6; }
>  if ${libc_cv_overlapping_opd+:} false; then :
> diff --git a/sysdeps/powerpc/powerpc64/configure.ac b/sysdeps/powerpc/powerpc64/configure.ac
> index 1f3d54414c..111a0ae4b3 100644
> --- a/sysdeps/powerpc/powerpc64/configure.ac
> +++ b/sysdeps/powerpc/powerpc64/configure.ac
> @@ -1,6 +1,8 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/powerpc/powerpc64.
>  
> +AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)
> +
>  AC_CACHE_CHECK(for support for overlapping .opd entries,
>  libc_cv_overlapping_opd, [dnl
>  libc_cv_overlapping_opd=no

Ok.

> diff --git a/sysdeps/powerpc/tst-tlsifunc.c b/sysdeps/powerpc/tst-tlsifunc.c
> index 6b256c6229..8e559b575d 100644
> --- a/sysdeps/powerpc/tst-tlsifunc.c
> +++ b/sysdeps/powerpc/tst-tlsifunc.c
> @@ -102,7 +102,7 @@ do_test (void)
>    if (&bar == bar_ptr)
>      printf ("PASS: bar address read from IFUNC resolver is correct.\n");
>  #if !defined TST_TLSIFUNC_STATIC || !defined PIC \
> -    || !defined PI_STATIC_AND_HIDDEN
> +    || defined HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
>    else
>      {
>        printf ("FAIL: bar address read from IFUNC resolver is incorrect.\n");

As before, it would be better to assume define avaliability.

> diff --git a/sysdeps/riscv/configure b/sysdeps/riscv/configure
> index 4a56fca94b..2372225a26 100644
> --- a/sysdeps/riscv/configure
> +++ b/sysdeps/riscv/configure
> @@ -1,9 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/riscv/elf.
>  
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  # Check if static linker supports R_RISCV_ALIGN
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for R_RISCV_ALIGN linker relaxation support" >&5
>  $as_echo_n "checking for R_RISCV_ALIGN linker relaxation support... " >&6; }
> diff --git a/sysdeps/riscv/configure.ac b/sysdeps/riscv/configure.ac
> index 44a5279903..dbcc216689 100644
> --- a/sysdeps/riscv/configure.ac
> +++ b/sysdeps/riscv/configure.ac
> @@ -1,8 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/riscv/elf.
>  
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  # Check if static linker supports R_RISCV_ALIGN
>  AC_CACHE_CHECK([for R_RISCV_ALIGN linker relaxation support], [libc_cv_riscv_r_align],[dnl
>    cat > conftest.S <<EOF

Ok.

> diff --git a/sysdeps/s390/configure b/sysdeps/s390/configure
> index 431088acad..cc68cbbb03 100644
> --- a/sysdeps/s390/configure
> +++ b/sysdeps/s390/configure
> @@ -1,9 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/s390.
>  
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_tbegin" >&5
>  $as_echo_n "checking for __builtin_tbegin... " >&6; }
>  if ${libc_cv_gcc_builtin_tbegin+:} false; then :
> diff --git a/sysdeps/s390/configure.ac b/sysdeps/s390/configure.ac
> index 14948c81ed..daf1bc6823 100644
> --- a/sysdeps/s390/configure.ac
> +++ b/sysdeps/s390/configure.ac
> @@ -1,10 +1,6 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/s390.
>  
> -dnl It is always possible to access static and hidden symbols in an
> -dnl position independent way.
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  AC_CACHE_CHECK(for __builtin_tbegin, libc_cv_gcc_builtin_tbegin, [dnl
>  cat > conftest.c <<\EOF
>  #include <htmintrin.h>

Ok.

> diff --git a/sysdeps/sh/configure b/sysdeps/sh/configure
> index 110eb65b06..3c05bb6b5e 100644
> --- a/sysdeps/sh/configure
> +++ b/sysdeps/sh/configure
> @@ -1,5 +1,2 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/sh.
> -
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> diff --git a/sysdeps/sh/configure.ac b/sysdeps/sh/configure.ac
> index 21400c447d..28d9e9a438 100644
> --- a/sysdeps/sh/configure.ac
> +++ b/sysdeps/sh/configure.ac
> @@ -1,6 +1,2 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/sh.
> -
> -dnl It is always possible to access static and hidden symbols in an
> -dnl position independent way.
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)

Ok.

> diff --git a/sysdeps/sparc/configure b/sysdeps/sparc/configure
> index 491b00f0dc..70c084db5c 100644
> --- a/sysdeps/sparc/configure
> +++ b/sysdeps/sparc/configure
> @@ -1,4 +1,2 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/sparc.
> -
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> diff --git a/sysdeps/sparc/configure.ac b/sysdeps/sparc/configure.ac
> index 5cdc0a984c..4fc6d6d7d1 100644
> --- a/sysdeps/sparc/configure.ac
> +++ b/sysdeps/sparc/configure.ac
> @@ -1,4 +1,2 @@
>  GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/sparc.
> -
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)

Ok.

> diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
> index 46d436fddf..a9c8c2ef67 100644
> --- a/sysdeps/x86/configure
> +++ b/sysdeps/x86/configure
> @@ -190,8 +190,5 @@ fi
>  config_vars="$config_vars
>  enable-x86-isa-level = $libc_cv_include_x86_isa_level"
>  
> -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
> -
> -
>  $as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
>  
> diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
> index 918b636891..edd43a2551 100644
> --- a/sysdeps/x86/configure.ac
> +++ b/sysdeps/x86/configure.ac
> @@ -128,9 +128,5 @@ if test $libc_cv_include_x86_isa_level = yes; then
>  fi
>  LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level])
>  
> -dnl It is always possible to access static and hidden symbols in an
> -dnl position independent way.
> -AC_DEFINE(PI_STATIC_AND_HIDDEN)
> -
>  dnl Static PIE is supported.
>  AC_DEFINE(SUPPORT_STATIC_PIE)

Ok.

  reply	other threads:[~2022-04-25 16:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25  7:58 Fangrui Song
2022-04-25 16:40 ` Adhemerval Zanella [this message]
2022-04-25 17:53   ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe0bde71-c39e-3ce6-5780-ead46716a2a1@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=amodra@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    --cc=tuliom@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).