summaryrefslogtreecommitdiff
path: root/ld/configure.ac
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-05-28 04:21:04 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-05-28 04:21:16 -0700
commitb32632c49968cd03e952f9b63b32d9e9f1ddaf53 (patch)
tree49233e497456cbd09e444e4f4aad77f009c681a7 /ld/configure.ac
parent151f5de4a6548cd83a79b4705f1e901776ddacc5 (diff)
downloadbinutils-gdb-b32632c49968cd03e952f9b63b32d9e9f1ddaf53.tar.gz
ld: Add --enable-textrel-check=[no|yes|warning|error]
Add a configure option, --enable-textrel-check=[no|yes|warning|error], to decide what ELF linker should do by default with DT_TEXTREL in an executable or shared library. PR ld/20824 * NEWS: Mention --enable-textrel-check=[no|yes|warning|error]. * configure.ac: Add --enable-textrel-check=[no|yes|warning|error]. (DEFAULT_LD_TEXTREL_CHECK): New AC_DEFINE_UNQUOTED. (DEFAULT_LD_TEXTREL_CHECK_WARNING): Likewise. * ldmain.c (main): Initialize link_info.textrel_check to DEFAULT_LD_TEXTREL_CHECK. * lexsup.c (ld_options): Check DEFAULT_LD_TEXTREL_CHECK_WARNING. * config.in: Regenerated. * configure: Likewise.
Diffstat (limited to 'ld/configure.ac')
-rw-r--r--ld/configure.ac29
1 files changed, 29 insertions, 0 deletions
diff --git a/ld/configure.ac b/ld/configure.ac
index b5e849d84ab..99957df3763 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -176,6 +176,15 @@ AC_ARG_ENABLE(relro,
no) ac_default_ld_z_relro=0 ;;
esac])dnl
+# Decide if DT_TEXTREL check should be enabled in ELF linker.
+ac_default_ld_textrel_check=unset
+AC_ARG_ENABLE([textrel-check],
+ AC_HELP_STRING([--enable-textrel-check=@<:@yes|no|warning|error@:>@],
+ [enable DT_TEXTREL check in ELF linker]),
+[case "${enableval}" in
+ yes|no|warning|error) ac_default_ld_textrel_check=${enableval} ;;
+esac])
+
# Decide if -z separate-code should be enabled in ELF linker by default.
ac_default_ld_z_separate_code=unset
AC_ARG_ENABLE(separate-code,
@@ -447,6 +456,26 @@ 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_default_ld_textrel_check_warning=0
+case "${ac_default_ld_textrel_check}" in
+ unset|no)
+ ac_default_ld_textrel_check=textrel_check_none
+ ;;
+ yes|warning)
+ ac_default_ld_textrel_check=textrel_check_warning
+ ac_default_ld_textrel_check_warning=1
+ ;;
+ error)
+ ac_default_ld_textrel_check=textrel_check_error
+ ;;
+esac
+AC_DEFINE_UNQUOTED(DEFAULT_LD_TEXTREL_CHECK,
+ $ac_default_ld_textrel_check,
+ [The default method for DT_TEXTREL check in ELF linker.])
+AC_DEFINE_UNQUOTED(DEFAULT_LD_TEXTREL_CHECK_WARNING,
+ $ac_default_ld_textrel_check_warning,
+ [Define to 1 if DT_TEXTREL check is warning in ELF linker by default.])
+
if test "${ac_default_ld_z_separate_code}" = unset; then
ac_default_ld_z_separate_code=0
fi