aboutsummaryrefslogtreecommitdiff
path: root/ld/configure.ac
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-06-22 05:37:24 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-06-22 05:37:38 -0700
commit647e4d46495f2bfb0950fd1066c8a660173cca40 (patch)
treeaa635b99d89cedde44d81afb3b110187bf05cb6f /ld/configure.ac
parent6edaf4d75b45ff08d7296095506904663b8f0576 (diff)
downloadgdb-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.ac')
-rw-r--r--ld/configure.ac18
1 files changed, 18 insertions, 0 deletions
diff --git a/ld/configure.ac b/ld/configure.ac
index 6542506..d17281f 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -155,6 +155,17 @@ AC_ARG_ENABLE(compressed_debug_sections,
,no, | ,none,) ac_default_compressed_debug_sections=no ;;
esac])dnl
+# 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.
+AC_ARG_ENABLE(relro,
+ AS_HELP_STRING([--enable-relro],
+ [enable -z relro in ELF linker by default]),
+[case "${enableval}" in
+ yes) ac_default_ld_z_relro=1 ;;
+ no) ac_default_ld_z_relro=0 ;;
+esac])dnl
+
AM_BINUTILS_WARNINGS
AM_LC_MESSAGES
@@ -376,6 +387,13 @@ if test x$ac_default_compressed_debug_sections = xyes ; then
AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
fi
+if test "${ac_default_ld_z_relro}" = unset; then
+ ac_default_ld_z_relro=0
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_RELRO,
+ $ac_default_ld_z_relro,
+ [Define to 1 if you want to enable -z relro in ELF linker by default.])
+
AC_SUBST(elf_list_options)
AC_SUBST(elf_shlib_list_options)
AC_SUBST(elf_plt_unwind_list_options)