From 333d0055f6f162c334c36f1946b6fcdb5c92b681 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Wed, 8 Nov 2017 15:13:53 -0800 Subject: Fix problems with -r. The fix committed for PR gold/19291 ended up breaking other cases. The commit added adjustment code to write_local_symbols, but in many cases compute_final_local_value_internal had already subtracted the output section's address. To fix this, all other adjustments are now removed, so only the one in write_local_symbols is left. gold/ PR gold/22266 * object.cc (Sized_relobj_file::compute_final_local_value_internal): Drop relocatable parameter and stop adjusting output value based on it. (Sized_relobj_file::compute_final_local_value): Stop passing relocatable to compute_final_local_value_internal. (Sized_relobj_file::do_finalize_local_symbols): Ditto. * object.h (Sized_relobj_file::compute_final_local_value_internal): Drop relocatable parameter. --- gold/testsuite/pr22266_script.t | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gold/testsuite/pr22266_script.t (limited to 'gold/testsuite/pr22266_script.t') diff --git a/gold/testsuite/pr22266_script.t b/gold/testsuite/pr22266_script.t new file mode 100644 index 0000000..a9bc364 --- /dev/null +++ b/gold/testsuite/pr22266_script.t @@ -0,0 +1,23 @@ +/* Linker script to undo -split-sections and merge all sections together when + * linking relocatable object files for GHCi. + * ld -r normally retains the individual sections, which is what you would want + * if the intention is to eventually link into a binary with --gc-sections, but + * it doesn't have a flag for directly doing what we want. */ +SECTIONS +{ + .text : { + *(.text*) + } + .rodata.cst16 : { + *(.rodata.cst16*) + } + .data.rel.ro : { + *(.data.rel.ro*) + } + .data : { + *(.data*) + } + .bss : { + *(.bss*) + } +} -- cgit v1.1