aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-01-10 10:24:09 +1030
committerAlan Modra <amodra@gmail.com>2017-01-10 11:50:07 +1030
commitf159cdb61155d699f5aff2a9fbad8b787a7fe10c (patch)
treef86a44b39d08ad07be0349eaf3cb8b1f11588833 /gold/powerpc.cc
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-f159cdb61155d699f5aff2a9fbad8b787a7fe10c.tar.gz
binutils-gdb-f159cdb61155d699f5aff2a9fbad8b787a7fe10c.tar.bz2
binutils-gdb-f159cdb61155d699f5aff2a9fbad8b787a7fe10c.zip
[GOLD] Add --secure-plt option for ppc32
Added just to accept, and ignore. gcc since 2015-10-21, when configured with --enable-secureplt passes this option to the linker. As powerpc gold cannot link --bss-plt code successfully, gold needs to accept the option or the gcc specs file needs to be changed. The patch also make gold detect --bss-plt code and error out rather than producing a binary that crashes. * options.h: Add --secure-plt option. * powerpc.cc (Target_powerpc::Scan::local): Detect and error on -fPIC -mbss-plt code. (Target_powerpc::Scan::global): Likewise.
Diffstat (limited to 'gold/powerpc.cc')
-rw-r--r--gold/powerpc.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 6d6d0ddee00..b91fb4b5851 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -5972,6 +5972,30 @@ Target_powerpc<size, big_endian>::Scan::local(
break;
}
+ if (size == 32)
+ {
+ switch (r_type)
+ {
+ case elfcpp::R_POWERPC_REL32:
+ if (ppc_object->got2_shndx() != 0
+ && parameters->options().output_is_position_independent())
+ {
+ unsigned int shndx = lsym.get_st_shndx();
+ unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
+ bool is_ordinary;
+ shndx = ppc_object->adjust_sym_shndx(r_sym, shndx, &is_ordinary);
+ if (is_ordinary && shndx == ppc_object->got2_shndx()
+ && (ppc_object->section_flags(data_shndx)
+ & elfcpp::SHF_EXECINSTR) != 0)
+ gold_error(_("%s: unsupported -mbss-plt code"),
+ ppc_object->name().c_str());
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
switch (r_type)
{
case elfcpp::R_POWERPC_GOT_TLSLD16:
@@ -6473,6 +6497,20 @@ Target_powerpc<size, big_endian>::Scan::global(
break;
}
+ if (size == 32)
+ {
+ switch (r_type)
+ {
+ case elfcpp::R_PPC_LOCAL24PC:
+ if (strcmp(gsym->name(), "_GLOBAL_OFFSET_TABLE_") == 0)
+ gold_error(_("%s: unsupported -mbss-plt code"),
+ ppc_object->name().c_str());
+ break;
+ default:
+ break;
+ }
+ }
+
switch (r_type)
{
case elfcpp::R_POWERPC_GOT_TLSLD16: