mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
5fd104addf
ld silently accepts -z relro and -z norelro for targets that lack the necessary GNU_RELRO support. This patch makes those targets emit a warning instead, and adds testsuite infrastructure to detect when relro is unsupported. binutils/ * testsuite/config/default.exp (ld_elf_shared_opt): Don't set. * testsuite/lib/binutils-common.exp (check_relro_support): New proc. (run_dump_test): Use check_relro_support to decide whether to pass extra ld option "-z norelro". ld/ * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Omit -z relro and -z norelro when target support for GNU_RELRO is lacking. (gld${EMULATION_NAME}_before_parse): Ignore RELRO default too. * emultempl/aarch64elf.em (gld${EMULATION_NAME}_before_parse): Ignore RELRO default when target support for GNU_RELRO is lacking. * emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/scoreelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * testsuite/config/default.exp (ld_elf_shared_opt): Don't set. * testsuite/ld-elf/pr16322.d: xfail when no relro support. * testsuite/ld-elf/pr22393-1a.d: Likewise. * testsuite/ld-elf/pr22393-1b.d: Likewise. * testsuite/ld-elf/shared.exp (pr20995-2.so, pr20995-2): Likewise. * testsuite/lib/ld-lib.exp (run_ld_link_tests): Use check_relro_support to decide whether to pass extra ld option "-z norelro".
12 lines
290 B
Makefile
12 lines
290 B
Makefile
#source: pr22393-1.s
|
|
#ld: -shared -z separate-code -z relro
|
|
#readelf: -l --wide
|
|
#target: *-*-linux-gnu *-*-gnu* *-*-nacl* arm*-*-uclinuxfdpiceabi
|
|
#xfail: ![check_shared_lib_support]
|
|
#xfail: ![check_relro_support]
|
|
|
|
#failif
|
|
#...
|
|
+[0-9]+ +.*(\.note|\.gnu|\.hash|\.dyn|\.rel).*\.text.*
|
|
#...
|