diff options
author | Alan Modra <amodra@gmail.com> | 2017-10-18 00:33:05 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-10-18 08:48:17 +1030 |
commit | 412294daf8786fd9060059b8be7fc59a35e13922 (patch) | |
tree | b0ef87097949a968802b21138b941cec294db288 /gold | |
parent | b27de576d41eed16936cf639857df4e1e27a8e9e (diff) | |
download | gdb-412294daf8786fd9060059b8be7fc59a35e13922.zip gdb-412294daf8786fd9060059b8be7fc59a35e13922.tar.gz gdb-412294daf8786fd9060059b8be7fc59a35e13922.tar.bz2 |
[GOLD] Fix powerpc64 optimization of TOC accesses
Fixes a thinko. Given code that puts variables into the TOC (a bad
idea, but some see the TOC as a small data section) this bug could
result in an attempt to optimize a sequence that should not be
optimized.
* powerpc.cc (Target_powerpc::Scan::local): Correct dst_off
calculation for TOC16 relocs.
(Target_powerpc::Scan::global): Likewise.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 7 | ||||
-rw-r--r-- | gold/powerpc.cc | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 697a40a..a47ae96 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2017-10-18 Kyle Butt <iteratee@google.com> + Alan Modra <amodra@gmail.com> + + * powerpc.cc (Target_powerpc::Scan::local): Correct dst_off + calculation for TOC16 relocs. + (Target_powerpc::Scan::global): Likewise. + 2017-09-26 Cary Coutant <ccoutant@gmail.com> PR gold/22213 diff --git a/gold/powerpc.cc b/gold/powerpc.cc index c529dbf..244c221 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -6917,7 +6917,7 @@ Target_powerpc<size, big_endian>::Scan::local( shndx = ppc_object->adjust_sym_shndx(r_sym, shndx, &is_ordinary); if (is_ordinary && shndx == ppc_object->toc_shndx()) { - Address dst_off = lsym.get_st_value() + reloc.get_r_offset(); + Address dst_off = lsym.get_st_value() + reloc.get_r_addend(); if (dst_off < ppc_object->section_size(shndx)) { bool ok = false; @@ -7591,7 +7591,7 @@ Target_powerpc<size, big_endian>::Scan::global( if (shndx == sym_object->toc_shndx()) { Sized_symbol<size>* sym = symtab->get_sized_symbol<size>(gsym); - Address dst_off = sym->value() + reloc.get_r_offset(); + Address dst_off = sym->value() + reloc.get_r_addend(); if (dst_off < sym_object->section_size(shndx)) { bool ok = false; |