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/testsuite/lib | |
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/testsuite/lib')
-rw-r--r-- | ld/testsuite/lib/ld-lib.exp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 29af846..62f9768 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -589,6 +589,13 @@ proc run_dump_test { name {extra_options {}} } { global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS global host_triplet runtests global env verbose + global ld_elf_shared_opt + + if { [is_elf_format] && [check_shared_lib_support] } { + set ld_extra_opt "$ld_elf_shared_opt" + } else { + set ld_extra_opt "" + } if [string match "*/*" $name] { set file $name @@ -912,7 +919,7 @@ proc run_dump_test { name {extra_options {}} } { # Add -L$srcdir/$subdir so that the linker command can use # linker scripts in the source directory. - set cmd "$LD $LDFLAGS -L$srcdir/$subdir \ + set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \ $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)" # If needed then check for, or add a -Map option. @@ -1166,6 +1173,13 @@ proc run_ld_link_tests { ldtests } { global CFLAGS global runtests global exec_output + global ld_elf_shared_opt + + if { [is_elf_format] && [check_shared_lib_support] } { + set ld_extra_opt "$ld_elf_shared_opt" + } else { + set ld_extra_opt "" + } foreach testitem $ldtests { set testname [lindex $testitem 0] @@ -1228,7 +1242,7 @@ proc run_ld_link_tests { ldtests } { if { ![ar_simple_create $ar $ld_options $binfile "$objfiles $ld_after"] } { set failed 1 } - } elseif { ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles $ld_after"] } { + } elseif { ![ld_simple_link $ld $binfile "$ld_extra_opt -L$srcdir/$subdir $ld_options $objfiles $ld_after"] } { set maybe_failed 1 set ld_output "$exec_output" } |