aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-06-23 08:48:38 +0930
committerAndreas K. Hüttel <dilfridge@gentoo.org>2023-07-29 22:56:52 +0200
commitfb921b2e7dc26dc9ab117c28d95352ad9cb75202 (patch)
tree1555413c0a5d714a7cf08eae3b3176be4fbff6f7
parentPR30536, ppc64el gold linker produces unusable clang-16 binary (diff)
downloadbinutils-gdb-fb921b2e7dc26dc9ab117c28d95352ad9cb75202.tar.gz
binutils-gdb-fb921b2e7dc26dc9ab117c28d95352ad9cb75202.tar.bz2
binutils-gdb-fb921b2e7dc26dc9ab117c28d95352ad9cb75202.zip
[GOLD] powerpc DT_RELACOUNTgentoo/binutils-2.40-6
DT_RELACOUNT was calculated incorrectly, and relative relocs not sorted as they should be to the start of .rela.dyn, due to adding one particular class of dynamic reloc using the wrong "add" method. * powerpc.cc (Target_powerpc::Scan::global): Add relative dyn relocs for ADDR64 and similar using add_global_relative. (cherry picked from commit 027614abf11de9e79a335df4e1f9a788b7ab0063) (cherry picked from commit 7ad52a2357f1d6eb886f548bdb4dae7e15d5f827)
-rw-r--r--gold/powerpc.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index aa2d9a18787..0c15e1b3721 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -9005,9 +9005,14 @@ Target_powerpc<size, big_endian>::Scan::global(
= target->rela_dyn_section(symtab, layout, is_ifunc);
unsigned int dynrel = (is_ifunc ? elfcpp::R_POWERPC_IRELATIVE
: elfcpp::R_POWERPC_RELATIVE);
- rela_dyn->add_symbolless_global_addend(
+ // Use the "add" method that marks the reloc as being
+ // relative. This is proper here and in other places
+ // that add IRELATIVE relocs because those relocs go
+ // into a separate section that isn't sorted, so it
+ // doesn't matter that they are marked is_relative.
+ rela_dyn->add_global_relative(
gsym, dynrel, output_section, object, data_shndx,
- reloc.get_r_offset(), reloc.get_r_addend());
+ reloc.get_r_offset(), reloc.get_r_addend(), false);
}
else
{