mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
ppc32 and "LOAD segment with RWX permissions"
When using a bss-plt we'll always trigger the RWX warning, which disturbs gcc test results. On the other hand, there may be reason to want the warning when gcc is configured with --enable-secureplt. So turning off the warning entirely for powerpc might not be the best solution. Instead, we'll turn off the warning whenever a bss-plt is generated, unless the user explicitly asked for the warning. bfd/ * elf32-ppc.c (ppc_elf_select_plt_layout): Set no_warn_rwx_segments on generating a bss plt, unless explicity enabled by the user. Also show the bss-plt warning when --warn-rwx-segments is given without --bss-plt. include/ * bfdlink.h (struct bfd_link_info): Add user_warn_rwx_segments. ld/ * lexsup.c (parse_args): Set user_warn_rwx_segments. * testsuite/ld-elf/elf.exp: Pass --secure-plt for powerpc to the rwx tests.
This commit is contained in:
@ -936,9 +936,11 @@ parse_args (unsigned argc, char **argv)
|
||||
break;
|
||||
case OPTION_WARN_RWX_SEGMENTS:
|
||||
link_info.no_warn_rwx_segments = 0;
|
||||
link_info.user_warn_rwx_segments = 1;
|
||||
break;
|
||||
case OPTION_NO_WARN_RWX_SEGMENTS:
|
||||
link_info.no_warn_rwx_segments = 1;
|
||||
link_info.user_warn_rwx_segments = 1;
|
||||
break;
|
||||
case 'e':
|
||||
lang_add_entry (optarg, true);
|
||||
|
@ -238,6 +238,12 @@ if { [istarget *-*-*linux*]
|
||||
return $text
|
||||
}
|
||||
|
||||
set curr_ldflags $LDFLAGS
|
||||
if { [istarget powerpc*-*-*] && ![istarget powerpc64*-*-*] } {
|
||||
# Don't generate an executable .plt section
|
||||
set LDFLAGS "$LDFLAGS --secure-plt"
|
||||
}
|
||||
|
||||
# Since the warnings can be disabled by configure, ensure consistency
|
||||
# of the first test by forcing the flags.
|
||||
run_ld_link_tests [list \
|
||||
@ -285,6 +291,8 @@ if { [istarget *-*-*linux*]
|
||||
"rwx-segments-3.exe"] \
|
||||
]
|
||||
|
||||
set LDFLAGS $curr_ldflags
|
||||
|
||||
if { [target_defaults_to_execstack] } {
|
||||
run_ld_link_tests [list \
|
||||
[list "PR ld/29072 (warn about absent .note.GNU-stack)" \
|
||||
|
Reference in New Issue
Block a user