diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-06-22 05:37:24 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-06-22 05:37:38 -0700 |
commit | 647e4d46495f2bfb0950fd1066c8a660173cca40 (patch) | |
tree | aa635b99d89cedde44d81afb3b110187bf05cb6f /ld/configure | |
parent | 6edaf4d75b45ff08d7296095506904663b8f0576 (diff) | |
download | gdb-647e4d46495f2bfb0950fd1066c8a660173cca40.zip gdb-647e4d46495f2bfb0950fd1066c8a660173cca40.tar.gz gdb-647e4d46495f2bfb0950fd1066c8a660173cca40.tar.bz2 |
ld: Add a linker configure option --enable-relro
Add a configure option --enable-relro to decide whether -z relro should
be enabled in ELF linker by default. Default to yes for all Linux
targets, except FRV, HPPA, IA64 and MIPS, since many relro tests fail
on these targets.
PR ld/20283
* NEWS: Mention --enable-relro.
* configure.ac: Add --enable-relro.
(DEFAULT_LD_Z_RELRO): New. Set by --enable-relro.
* configure.tgt (ac_default_ld_z_relro): Default it to 1 for
some Linux targets.
* config.in: Regenerated.
* configure: Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
link_info.relro to DEFAULT_LD_Z_RELRO.
* testsuite/config/default.exp (ld_elf_shared_opt): New.
* testsuite/lib/ld-lib.exp (run_dump_test): Pass
$ld_elf_shared_opt to ld for ELF targets with shared object
support.
(run_ld_link_tests): Likewise.
Diffstat (limited to 'ld/configure')
-rwxr-xr-x | ld/configure | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/ld/configure b/ld/configure index da93e07..a469ad4 100755 --- a/ld/configure +++ b/ld/configure @@ -791,6 +791,7 @@ with_sysroot enable_gold enable_got enable_compressed_debug_sections +enable_relro enable_werror enable_build_warnings enable_nls @@ -1449,6 +1450,7 @@ Optional Features: multigot) --enable-compressed-debug-sections={all,ld,none} compress debug sections by default] + --enable-relro enable -z relro in ELF linker by default --enable-werror treat compile warnings as errors --enable-build-warnings enable build-time compiler warnings --disable-nls do not use Native Language Support @@ -11721,7 +11723,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11724 "configure" +#line 11726 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11827,7 +11829,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11830 "configure" +#line 11832 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15541,6 +15543,17 @@ if test "${enable_compressed_debug_sections+set}" = set; then : esac fi +# Decide if -z relro should be enabled in ELF linker by default. +ac_default_ld_z_relro=unset +# Provide a configure time option to override our default. +# Check whether --enable-relro was given. +if test "${enable_relro+set}" = set; then : + enableval=$enable_relro; case "${enableval}" in + yes) ac_default_ld_z_relro=1 ;; + no) ac_default_ld_z_relro=0 ;; +esac +fi + # Set the 'development' global. . $srcdir/../bfd/development.sh @@ -17147,6 +17160,15 @@ $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h fi +if test "${ac_default_ld_z_relro}" = unset; then + ac_default_ld_z_relro=0 +fi + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_LD_Z_RELRO $ac_default_ld_z_relro +_ACEOF + + |