aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorJames Clarke <jrtc27@jrtc27.com>2017-11-08 15:13:53 -0800
committerCary Coutant <ccoutant@gmail.com>2017-11-08 15:13:53 -0800
commit333d0055f6f162c334c36f1946b6fcdb5c92b681 (patch)
treee2f634ea32928beaa5801afc966ea07f5e5520cc /gold
parent08228b11557016f6f12d537ebff5f169fdf9bc6c (diff)
downloadfsf-binutils-gdb-333d0055f6f162c334c36f1946b6fcdb5c92b681.zip
fsf-binutils-gdb-333d0055f6f162c334c36f1946b6fcdb5c92b681.tar.gz
fsf-binutils-gdb-333d0055f6f162c334c36f1946b6fcdb5c92b681.tar.bz2
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.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog12
-rw-r--r--gold/object.cc27
-rw-r--r--gold/object.h4
-rw-r--r--gold/testsuite/Makefile.am6
-rw-r--r--gold/testsuite/Makefile.in106
-rw-r--r--gold/testsuite/pr22266_a.c5
-rw-r--r--gold/testsuite/pr22266_main.c9
-rw-r--r--gold/testsuite/pr22266_script.t23
8 files changed, 128 insertions, 64 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 737e3af..c4c171d 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,15 @@
+2017-11-08 James Clarke <jrtc27@jrtc27.com>
+
+ 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.
+
2017-11-08 Kyle Butt <iteratee@google.com>
* object.cc (do_find_special_sections): Fix a thinko with memmem return
diff --git a/gold/object.cc b/gold/object.cc
index 0135651..2e975bb 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -2318,7 +2318,6 @@ Sized_relobj_file<size, big_endian>::compute_final_local_value_internal(
unsigned int r_sym,
const Symbol_value<size>* lv_in,
Symbol_value<size>* lv_out,
- bool relocatable,
const Output_sections& out_sections,
const std::vector<Address>& out_offsets,
const Symbol_table* symtab)
@@ -2420,10 +2419,7 @@ Sized_relobj_file<size, big_endian>::compute_final_local_value_internal(
os->find_relaxed_input_section(this, shndx);
if (posd != NULL)
{
- Address relocatable_link_adjustment =
- relocatable ? os->address() : 0;
- lv_out->set_output_value(posd->address()
- - relocatable_link_adjustment);
+ lv_out->set_output_value(posd->address());
}
else
lv_out->set_output_value(os->address());
@@ -2432,14 +2428,10 @@ Sized_relobj_file<size, big_endian>::compute_final_local_value_internal(
{
// We have to consider the addend to determine the
// value to use in a relocation. START is the start
- // of this input section. If we are doing a relocatable
- // link, use offset from start output section instead of
- // address.
- Address adjusted_start =
- relocatable ? start - os->address() : start;
+ // of this input section.
Merged_symbol_value<size>* msv =
new Merged_symbol_value<size>(lv_in->input_value(),
- adjusted_start);
+ start);
lv_out->set_merged_symbol_value(msv);
}
}
@@ -2450,7 +2442,7 @@ Sized_relobj_file<size, big_endian>::compute_final_local_value_internal(
+ secoffset
+ lv_in->input_value());
else
- lv_out->set_output_value((relocatable ? 0 : os->address())
+ lv_out->set_output_value(os->address()
+ secoffset
+ lv_in->input_value());
}
@@ -2476,12 +2468,11 @@ Sized_relobj_file<size, big_endian>::compute_final_local_value(
const Symbol_table* symtab)
{
// This is just a wrapper of compute_final_local_value_internal.
- const bool relocatable = parameters->options().relocatable();
const Output_sections& out_sections(this->output_sections());
const std::vector<Address>& out_offsets(this->section_offsets());
return this->compute_final_local_value_internal(r_sym, lv_in, lv_out,
- relocatable, out_sections,
- out_offsets, symtab);
+ out_sections, out_offsets,
+ symtab);
}
// Finalize the local symbols. Here we set the final value in
@@ -2501,7 +2492,6 @@ Sized_relobj_file<size, big_endian>::do_finalize_local_symbols(
const unsigned int loccount = this->local_symbol_count_;
this->local_symbol_offset_ = off;
- const bool relocatable = parameters->options().relocatable();
const Output_sections& out_sections(this->output_sections());
const std::vector<Address>& out_offsets(this->section_offsets());
@@ -2510,9 +2500,8 @@ Sized_relobj_file<size, big_endian>::do_finalize_local_symbols(
Symbol_value<size>* lv = &this->local_values_[i];
Compute_final_local_value_status cflv_status =
- this->compute_final_local_value_internal(i, lv, lv, relocatable,
- out_sections, out_offsets,
- symtab);
+ this->compute_final_local_value_internal(i, lv, lv, out_sections,
+ out_offsets, symtab);
switch (cflv_status)
{
case CFLV_OK:
diff --git a/gold/object.h b/gold/object.h
index 508e79c..c6c4927 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -2772,8 +2772,7 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
// LV_IN points to a local symbol value containing the input value.
// LV_OUT points to a local symbol value storing the final output value,
// which must not be a merged symbol value since before calling this
- // method to avoid memory leak. RELOCATABLE indicates whether we are
- // linking a relocatable output. OUT_SECTIONS is an array of output
+ // method to avoid memory leak. OUT_SECTIONS is an array of output
// sections. OUT_OFFSETS is an array of offsets of the sections. SYMTAB
// points to a symbol table.
//
@@ -2785,7 +2784,6 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
compute_final_local_value_internal(unsigned int r_sym,
const Symbol_value<size>* lv_in,
Symbol_value<size>* lv_out,
- bool relocatable,
const Output_sections& out_sections,
const std::vector<Address>& out_offsets,
const Symbol_table* symtab);
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index d9a0669..d8426db 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -3100,6 +3100,12 @@ exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
$(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
endif DEFAULT_TARGET_X86_64
+check_PROGRAMS += pr22266
+pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld
+ $(LINK) -Bgcctestdir/ pr22266_main.o pr22266_ar.o
+pr22266_ar.o: pr22266_a.o gcctestdir/ld
+ gcctestdir/ld -r -T $(srcdir)/pr22266_script.t -o $@ pr22266_a.o
+
endif GCC
endif NATIVE_LINKER
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index b8db70d..c42c472 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -70,7 +70,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
$(am__EXEEXT_31) $(am__EXEEXT_32) $(am__EXEEXT_33) \
$(am__EXEEXT_34) $(am__EXEEXT_35) $(am__EXEEXT_36) \
$(am__EXEEXT_37) $(am__EXEEXT_38) $(am__EXEEXT_39) \
- $(am__EXEEXT_40)
+ $(am__EXEEXT_40) $(am__EXEEXT_41)
@NATIVE_OR_CROSS_LINKER_TRUE@am__append_1 = object_unittest \
@NATIVE_OR_CROSS_LINKER_TRUE@ binary_unittest leb128_unittest \
@NATIVE_OR_CROSS_LINKER_TRUE@ overflow_unittest
@@ -810,27 +810,28 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_tmp_4.o \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_5.a \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_6.a
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_84 = pr22266
# These tests work with native and cross linkers.
# Test script section order.
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_84 = script_test_10.sh
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_85 = script_test_10.stdout
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_86 = script_test_10
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_85 = script_test_10.sh
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_86 = script_test_10.stdout
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = script_test_10
# These tests work with cross linkers only.
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = split_i386.sh
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = split_i386_1.stdout split_i386_2.stdout \
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = split_i386.sh
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = split_i386_1.stdout split_i386_2.stdout \
@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = split_i386_1 split_i386_2 split_i386_3 \
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_i386_1 split_i386_2 split_i386_3 \
@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_i386_4 split_i386_r
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_x86_64.sh \
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_x86_64.sh \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_plt_1.sh \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_1.sh \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_2.sh
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_x86_64_1.stdout \
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_x86_64_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_2.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_3.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4.stdout \
@@ -838,14 +839,14 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_plt_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ bnd_ifunc_2.stdout
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \
@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4 split_x86_64_r
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_x32.sh
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x32_1.stdout split_x32_2.stdout \
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x32.sh
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x32_1.stdout split_x32_2.stdout \
@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x32_1 split_x32_2 split_x32_3 \
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = split_x32_1 split_x32_2 split_x32_3 \
@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x32_4 split_x32_r
@@ -866,7 +867,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
# Check Thumb to ARM farcall veneers
# Check handling of --target1-abs, --target1-rel and --target2 options
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = arm_abs_global.sh \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = arm_abs_global.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_in_range.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_out_of_range.sh \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_v4bx.sh \
@@ -889,7 +890,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.sh
# The test demonstrates why the constructor of a target object should not access options.
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = arm_abs_global.stdout \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = arm_abs_global.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range.stdout \
@@ -942,7 +943,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.stdout \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target_lazy_init
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = arm_abs_global \
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = arm_abs_global \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ thumb_bl_in_range \
@@ -993,20 +994,20 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target_lazy_init
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = aarch64_reloc_none.sh \
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = aarch64_reloc_none.sh \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs.sh \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430.sh \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc.sh
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = aarch64_reloc_none.stdout \
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = aarch64_reloc_none.stdout \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs.stdout \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430.stdout \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc.stdout
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = aarch64_reloc_none \
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = aarch64_reloc_none \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr21430 \
@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_tlsdesc
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = split_s390.sh
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = split_s390.sh
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
@@ -1018,7 +1019,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_n2_ns.stdout split_s390x_r.stdout
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = split_s390_z1 split_s390_z2 split_s390_z3 \
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_105 = split_s390_z1 split_s390_z2 split_s390_z3 \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
@@ -1027,10 +1028,10 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
-@DEFAULT_TARGET_X86_64_TRUE@am__append_105 = *.dwo *.dwp
-@DEFAULT_TARGET_X86_64_TRUE@am__append_106 = dwp_test_1.sh \
+@DEFAULT_TARGET_X86_64_TRUE@am__append_106 = *.dwo *.dwp
+@DEFAULT_TARGET_X86_64_TRUE@am__append_107 = dwp_test_1.sh \
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.sh
-@DEFAULT_TARGET_X86_64_TRUE@am__append_107 = dwp_test_1.stdout \
+@DEFAULT_TARGET_X86_64_TRUE@am__append_108 = dwp_test_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.stdout
subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
@@ -1253,6 +1254,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1$(EXEEXT) \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_comdat_test_1$(EXEEXT) \
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_x86_64_bnd_test$(EXEEXT)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_41 = pr22266$(EXEEXT)
basic_pic_test_SOURCES = basic_pic_test.c
basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT)
basic_pic_test_LDADD = $(LDADD)
@@ -1988,6 +1990,13 @@ pr20976_DEPENDENCIES = libgoldtest.a ../libgold.a \
../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
+pr22266_SOURCES = pr22266.c
+pr22266_OBJECTS = pr22266.$(OBJEXT)
+pr22266_LDADD = $(LDADD)
+pr22266_DEPENDENCIES = libgoldtest.a ../libgold.a \
+ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_protected_1_OBJECTS = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_1.$(OBJEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_2.$(OBJEXT) \
@@ -2454,12 +2463,12 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
$(pr20216d_test_SOURCES) $(pr20216e_test_SOURCES) \
$(pr20308a_test_SOURCES) $(pr20308b_test_SOURCES) \
$(pr20308c_test_SOURCES) $(pr20308d_test_SOURCES) \
- $(pr20308e_test_SOURCES) pr20976.c $(protected_1_SOURCES) \
- $(protected_2_SOURCES) $(relro_now_test_SOURCES) \
- $(relro_script_test_SOURCES) $(relro_strip_test_SOURCES) \
- $(relro_test_SOURCES) $(script_test_1_SOURCES) \
- script_test_11.c script_test_12.c script_test_12i.c \
- $(script_test_2_SOURCES) script_test_3.c \
+ $(pr20308e_test_SOURCES) pr20976.c pr22266.c \
+ $(protected_1_SOURCES) $(protected_2_SOURCES) \
+ $(relro_now_test_SOURCES) $(relro_script_test_SOURCES) \
+ $(relro_strip_test_SOURCES) $(relro_test_SOURCES) \
+ $(script_test_1_SOURCES) script_test_11.c script_test_12.c \
+ script_test_12i.c $(script_test_2_SOURCES) script_test_3.c \
$(searched_file_test_SOURCES) start_lib_test.c \
$(thin_archive_test_1_SOURCES) $(thin_archive_test_2_SOURCES) \
$(tls_phdrs_script_test_SOURCES) $(tls_pic_test_SOURCES) \
@@ -2833,9 +2842,9 @@ MOSTLYCLEANFILES = *.so *.syms *.stdout $(am__append_4) \
$(am__append_34) $(am__append_37) $(am__append_41) \
$(am__append_47) $(am__append_51) $(am__append_52) \
$(am__append_58) $(am__append_78) $(am__append_81) \
- $(am__append_83) $(am__append_86) $(am__append_89) \
- $(am__append_92) $(am__append_95) $(am__append_98) \
- $(am__append_101) $(am__append_104) $(am__append_105)
+ $(am__append_83) $(am__append_87) $(am__append_90) \
+ $(am__append_93) $(am__append_96) $(am__append_99) \
+ $(am__append_102) $(am__append_105) $(am__append_106)
# We will add to these later, for each individual test. Note
# that we add each test under check_SCRIPTS or check_PROGRAMS;
@@ -2844,18 +2853,18 @@ check_SCRIPTS = $(am__append_2) $(am__append_19) $(am__append_23) \
$(am__append_29) $(am__append_35) $(am__append_42) \
$(am__append_45) $(am__append_49) $(am__append_53) \
$(am__append_56) $(am__append_62) $(am__append_73) \
- $(am__append_76) $(am__append_79) $(am__append_84) \
- $(am__append_87) $(am__append_90) $(am__append_93) \
- $(am__append_96) $(am__append_99) $(am__append_102) \
- $(am__append_106)
+ $(am__append_76) $(am__append_79) $(am__append_85) \
+ $(am__append_88) $(am__append_91) $(am__append_94) \
+ $(am__append_97) $(am__append_100) $(am__append_103) \
+ $(am__append_107)
check_DATA = $(am__append_3) $(am__append_20) $(am__append_24) \
$(am__append_30) $(am__append_36) $(am__append_43) \
$(am__append_46) $(am__append_50) $(am__append_54) \
$(am__append_57) $(am__append_63) $(am__append_74) \
- $(am__append_77) $(am__append_80) $(am__append_85) \
- $(am__append_88) $(am__append_91) $(am__append_94) \
- $(am__append_97) $(am__append_100) $(am__append_103) \
- $(am__append_107)
+ $(am__append_77) $(am__append_80) $(am__append_86) \
+ $(am__append_89) $(am__append_92) $(am__append_95) \
+ $(am__append_98) $(am__append_101) $(am__append_104) \
+ $(am__append_108)
BUILT_SOURCES = $(am__append_40)
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
@@ -4147,6 +4156,12 @@ pr20308e_test$(EXEEXT): $(pr20308e_test_OBJECTS) $(pr20308e_test_DEPENDENCIES) $
@NATIVE_LINKER_FALSE@pr20976$(EXEEXT): $(pr20976_OBJECTS) $(pr20976_DEPENDENCIES) $(EXTRA_pr20976_DEPENDENCIES)
@NATIVE_LINKER_FALSE@ @rm -f pr20976$(EXEEXT)
@NATIVE_LINKER_FALSE@ $(LINK) $(pr20976_OBJECTS) $(pr20976_LDADD) $(LIBS)
+@GCC_FALSE@pr22266$(EXEEXT): $(pr22266_OBJECTS) $(pr22266_DEPENDENCIES) $(EXTRA_pr22266_DEPENDENCIES)
+@GCC_FALSE@ @rm -f pr22266$(EXEEXT)
+@GCC_FALSE@ $(LINK) $(pr22266_OBJECTS) $(pr22266_LDADD) $(LIBS)
+@NATIVE_LINKER_FALSE@pr22266$(EXEEXT): $(pr22266_OBJECTS) $(pr22266_DEPENDENCIES) $(EXTRA_pr22266_DEPENDENCIES)
+@NATIVE_LINKER_FALSE@ @rm -f pr22266$(EXEEXT)
+@NATIVE_LINKER_FALSE@ $(LINK) $(pr22266_OBJECTS) $(pr22266_LDADD) $(LIBS)
protected_1$(EXEEXT): $(protected_1_OBJECTS) $(protected_1_DEPENDENCIES) $(EXTRA_protected_1_DEPENDENCIES)
@rm -f protected_1$(EXEEXT)
$(protected_1_LINK) $(protected_1_OBJECTS) $(protected_1_LDADD) $(LIBS)
@@ -4509,6 +4524,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr20308d_test-pr20308_main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr20308e_test-pr20308_main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr20976.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr22266.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protected_3.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protected_main_1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protected_main_2.Po@am__quote@
@@ -5731,6 +5747,8 @@ incremental_comdat_test_1.log: incremental_comdat_test_1$(EXEEXT)
@p='incremental_comdat_test_1$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
exception_x86_64_bnd_test.log: exception_x86_64_bnd_test$(EXEEXT)
@p='exception_x86_64_bnd_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+pr22266.log: pr22266$(EXEEXT)
+ @p='pr22266$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
.test.log:
@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
@@ -7383,6 +7401,10 @@ uninstall-am:
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ pr22266_main.o pr22266_ar.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr22266_ar.o: pr22266_a.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -r -T $(srcdir)/pr22266_script.t -o $@ pr22266_a.o
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10.o: script_test_10.s
@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $<
@NATIVE_OR_CROSS_LINKER_TRUE@script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
diff --git a/gold/testsuite/pr22266_a.c b/gold/testsuite/pr22266_a.c
new file mode 100644
index 0000000..b58254c
--- /dev/null
+++ b/gold/testsuite/pr22266_a.c
@@ -0,0 +1,5 @@
+__attribute__((section(".data.a")))
+static int int_from_a_1 = 0x11223344;
+
+__attribute__((section(".data.rel.ro.a")))
+int *p_int_from_a_2 = &int_from_a_1;
diff --git a/gold/testsuite/pr22266_main.c b/gold/testsuite/pr22266_main.c
new file mode 100644
index 0000000..1f3476e
--- /dev/null
+++ b/gold/testsuite/pr22266_main.c
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+
+extern int *p_int_from_a_2;
+
+int main (void) {
+ if (*p_int_from_a_2 != 0x11223344)
+ abort ();
+ return 0;
+}
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*)
+ }
+}