aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-02-06 12:46:52 +1030
committerAlan Modra <amodra@gmail.com>2023-02-06 23:06:44 +1030
commit84789002905d6db444ee76431705c86cbcde5616 (patch)
treed5c9a4c3dcff7456e90d19643cdac3076567cdaf /bfd/elf32-ppc.c
parent9af467b82406614deb46151f838c336a7c8604db (diff)
downloadgdb-84789002905d6db444ee76431705c86cbcde5616.zip
gdb-84789002905d6db444ee76431705c86cbcde5616.tar.gz
gdb-84789002905d6db444ee76431705c86cbcde5616.tar.bz2
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.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index a8234f2..833bc74 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -4020,12 +4020,19 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
htab->plt_type = plt_type;
}
}
- if (htab->plt_type == PLT_OLD && htab->params->plt_style == PLT_NEW)
+ if (htab->plt_type == PLT_OLD)
{
- if (htab->old_bfd != NULL)
- _bfd_error_handler (_("bss-plt forced due to %pB"), htab->old_bfd);
- else
- _bfd_error_handler (_("bss-plt forced by profiling"));
+ if (!info->user_warn_rwx_segments)
+ info->no_warn_rwx_segments = 1;
+ if (htab->params->plt_style == PLT_NEW
+ || (htab->params->plt_style != PLT_OLD
+ && !info->no_warn_rwx_segments))
+ {
+ if (htab->old_bfd != NULL)
+ _bfd_error_handler (_("bss-plt forced due to %pB"), htab->old_bfd);
+ else
+ _bfd_error_handler (_("bss-plt forced by profiling"));
+ }
}
BFD_ASSERT (htab->plt_type != PLT_VXWORKS);