about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-08-04 12:17:15 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-08-04 12:17:30 -0700
commit19f1a11e7ea2a5082bae9d9a079338c5658ba954 (patch)
tree242caa3dcb915548b8541f4552e849e06c1ffb19 /configure.ac
parent3093fd5e5d418b91411aa9b061850b8773433cf7 (diff)
downloadglibc-19f1a11e7ea2a5082bae9d9a079338c5658ba954.tar.gz
glibc-19f1a11e7ea2a5082bae9d9a079338c5658ba954.tar.xz
glibc-19f1a11e7ea2a5082bae9d9a079338c5658ba954.zip
Check linker support for INSERT in linker script
Since gold doesn't support INSERT in linker script:

https://sourceware.org/bugzilla/show_bug.cgi?id=21676

tst-split-dynreloc fails to link with gold.  Check if linker supports
INSERT in linker script before using it.

	* config.make.in (have-insert): New.
	* configure.ac (libc_cv_insert): New.  Set to yes if linker
	supports INSERT in linker script.
	(AC_SUBST(libc_cv_insert): New.
	* configure: Regenerated.
	* sysdeps/x86_64/Makefile (tests): Add tst-split-dynreloc only
	if $(have-insert) == yes.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac21
1 files changed, 21 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 77456aa8d9..2c6308883c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1298,6 +1298,27 @@ EOF
 	       ])
 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 test (void) { return bar; }
+EOF
+		cat > conftest.t <<EOF
+		SECTIONS
+		{
+		  .bar : { *(.bar) }
+		}
+		INSERT AFTER .rela.dyn;
+EOF
+		libc_cv_insert=no
+		if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
+		  libc_cv_insert=yes
+		fi
+		rm -f conftest.*
+	       ])
+AC_SUBST(libc_cv_insert)
+
 AC_CACHE_CHECK(for broken __attribute__((alias())),
 	       libc_cv_broken_alias_attribute,
 	       [cat > conftest.c <<EOF