]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
configure: Fix check for INSERT in linker script
authorFangrui Song <maskray@google.com>
Mon, 13 Sep 2021 19:39:20 +0000 (12:39 -0700)
committerFangrui Song <maskray@google.com>
Mon, 13 Sep 2021 19:39:20 +0000 (12:39 -0700)
GCC/Clang use local access when referencing a const variable,
so the conftest.so may have no dynamic relocation.
LLD reports `error: unable to insert .foo after .rela.dyn` when the
destination section does not exist.

Use a non-const int to ensure that .rela.dyn exists.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
configure
configure.ac

index 542802ad356757bd0c2e7948179adbdedc382073..39d75eb4edca61bc6573d1db0e244348aa2fa301 100755 (executable)
--- a/configure
+++ b/configure
@@ -5793,7 +5793,7 @@ if ${libc_cv_insert+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat > conftest.c <<EOF
-               const int __attribute__ ((section(".bar"))) bar = 0x12345678;
+               int __attribute__ ((section(".bar"))) bar = 0x12345678;
                int test (void) { return bar; }
 EOF
                cat > conftest.t <<EOF
index d9232418de58d6b1907f5417b5cedc30101a6f30..00f49f09f70c2343c664c2bbf9f7a0d5f99f0565 100644 (file)
@@ -1217,7 +1217,7 @@ AC_SUBST(libc_cv_protected_data)
 AC_CACHE_CHECK(linker support for INSERT in linker script,
               libc_cv_insert,
               [cat > conftest.c <<EOF
-               const int __attribute__ ((section(".bar"))) bar = 0x12345678;
+               int __attribute__ ((section(".bar"))) bar = 0x12345678;
                int test (void) { return bar; }
 EOF
                cat > conftest.t <<EOF