diff options
-rw-r--r-- | gold/ChangeLog | 15 | ||||
-rw-r--r-- | gold/object.cc | 24 | ||||
-rw-r--r-- | gold/object.h | 3 | ||||
-rw-r--r-- | gold/testsuite/Makefile.am | 6 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 45 |
5 files changed, 77 insertions, 16 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index a6e11d5..d556e20 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,18 @@ +2009-06-05 Doug Kwan <dougkwan@google.com> + + * object.cc (Sized_relobj::Sized_relobj): Initialize + discarded_eh_frame_shndx_ to -1U. + (Sized_relobj::do_layout): Record index of a discard .eh_frame + section. + (Sized_relobj::do_count_local_symbols): Skip local symbols in + a discarded .eh_frame section. + (Sized_relobj::do_finalize_local_symbols): Ditto. + * object.h (class Sized_relobj): Declare new member + discarded_eh_frame_shndx_. + * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test. + (local_labels_test.o, local_labels_test): New rules. + * testsuite/Makefile.in: Regenerate. + 2009-06-04 Doug Kwan <dougkwan@google.com> * layout.cc (Layout::section_name_mapping): Add mapping for diff --git a/gold/object.cc b/gold/object.cc index 75fb679..77ddce6 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -327,7 +327,8 @@ Sized_relobj<size, big_endian>::Sized_relobj( local_values_(), local_got_offsets_(), kept_comdat_sections_(), - has_eh_frame_(false) + has_eh_frame_(false), + discarded_eh_frame_shndx_(-1U) { } @@ -1295,7 +1296,13 @@ Sized_relobj<size, big_endian>::do_layout(Symbol_table* symtab, &offset); out_sections[i] = os; if (offset == -1) - out_section_offsets[i] = invalid_address; + { + // An object can contain at most one section holding exception + // frame information. + gold_assert(this->discarded_eh_frame_shndx_ == -1U); + this->discarded_eh_frame_shndx_ = i; + out_section_offsets[i] = invalid_address; + } else out_section_offsets[i] = convert_types<Address, off_t>(offset); @@ -1453,7 +1460,8 @@ Sized_relobj<size, big_endian>::do_count_local_symbols(Stringpool* pool, // Decide whether this symbol should go into the output file. - if (shndx < shnum && out_sections[shndx] == NULL) + if ((shndx < shnum && out_sections[shndx] == NULL) + || (shndx == this->discarded_eh_frame_shndx_)) { lv.set_no_output_symtab_entry(); gold_assert(!lv.needs_output_dynsym_entry()); @@ -1558,7 +1566,15 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index, // This is a SHF_MERGE section or one which otherwise // requires special handling. - if (!lv.is_section_symbol()) + if (shndx == this->discarded_eh_frame_shndx_) + { + // This local symbol belongs to a discarded .eh_frame + // section. Just treat it like the case in which + // os == NULL above. + gold_assert(this->has_eh_frame_); + continue; + } + else if (!lv.is_section_symbol()) { // This is not a section symbol. We can determine // the final value now. diff --git a/gold/object.h b/gold/object.h index a2836d0..d5f111f 100644 --- a/gold/object.h +++ b/gold/object.h @@ -1815,6 +1815,9 @@ class Sized_relobj : public Relobj Kept_comdat_section_table kept_comdat_sections_; // Whether this object has a GNU style .eh_frame section. bool has_eh_frame_; + // If this object has a GNU style .eh_frame section that is discarded in + // output, record the index here. Otherwise it is -1U. + unsigned int discarded_eh_frame_shndx_; // The list of sections whose layout was deferred. std::vector<Deferred_layout> deferred_layout_; }; diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 5208e06..e2bf8bd 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -1074,5 +1074,11 @@ alt/libexclude_libs_test_3.a: exclude_libs_test_3.o test -d alt || mkdir -p alt $(TEST_AR) rc $@ $^ +check_PROGRAMS += local_labels_test +local_labels_test.o: ver_test_6.c + $(COMPILE) -g -c -Wa,-L -o $@ $< +local_labels_test: local_labels_test.o + $(LINK) -Bgcctestdir/ local_labels_test.o + endif GCC endif NATIVE_LINKER diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 53b7bf8..0533e7b 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -318,7 +318,8 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_2.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_3.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_4.err -@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_24 = exclude_libs_test +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_24 = exclude_libs_test \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ local_labels_test @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_25 = exclude_libs_test.sh @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_26 = exclude_libs_test.syms @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_27 = exclude_libs_test.syms libexclude_libs_test_1.a \ @@ -429,7 +430,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_3$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_4$(EXEEXT) @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_17 = \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ exclude_libs_test$(EXEEXT) +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exclude_libs_test$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ local_labels_test$(EXEEXT) basic_pic_test_SOURCES = basic_pic_test.c basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT) basic_pic_test_LDADD = $(LDADD) @@ -573,6 +575,12 @@ am__justsyms_SOURCES_DIST = justsyms_1.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_1.$(OBJEXT) justsyms_OBJECTS = $(am_justsyms_OBJECTS) justsyms_LDADD = $(LDADD) +local_labels_test_SOURCES = local_labels_test.c +local_labels_test_OBJECTS = local_labels_test.$(OBJEXT) +local_labels_test_LDADD = $(LDADD) +local_labels_test_DEPENDENCIES = libgoldtest.a ../libgold.a \ + ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) many_sections_r_test_SOURCES = many_sections_r_test.c many_sections_r_test_OBJECTS = many_sections_r_test.$(OBJEXT) many_sections_r_test_LDADD = $(LDADD) @@ -900,15 +908,15 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \ $(exclude_libs_test_SOURCES) \ flagstest_compress_debug_sections.c flagstest_o_specialfile.c \ flagstest_o_specialfile_and_compress_debug_sections.c \ - $(initpri1_SOURCES) $(justsyms_SOURCES) many_sections_r_test.c \ - $(many_sections_test_SOURCES) $(object_unittest_SOURCES) \ - plugin_test_1.c plugin_test_2.c plugin_test_3.c \ - plugin_test_4.c $(protected_1_SOURCES) $(protected_2_SOURCES) \ - $(relro_script_test_SOURCES) $(relro_test_SOURCES) \ - $(script_test_1_SOURCES) $(script_test_2_SOURCES) \ - script_test_3.c $(thin_archive_test_1_SOURCES) \ - $(thin_archive_test_2_SOURCES) $(tls_pic_test_SOURCES) \ - $(tls_shared_gd_to_ie_test_SOURCES) \ + $(initpri1_SOURCES) $(justsyms_SOURCES) local_labels_test.c \ + many_sections_r_test.c $(many_sections_test_SOURCES) \ + $(object_unittest_SOURCES) plugin_test_1.c plugin_test_2.c \ + plugin_test_3.c plugin_test_4.c $(protected_1_SOURCES) \ + $(protected_2_SOURCES) $(relro_script_test_SOURCES) \ + $(relro_test_SOURCES) $(script_test_1_SOURCES) \ + $(script_test_2_SOURCES) script_test_3.c \ + $(thin_archive_test_1_SOURCES) $(thin_archive_test_2_SOURCES) \ + $(tls_pic_test_SOURCES) $(tls_shared_gd_to_ie_test_SOURCES) \ $(tls_shared_gnu2_gd_to_ie_test_SOURCES) \ $(tls_shared_gnu2_test_SOURCES) $(tls_shared_ie_test_SOURCES) \ $(tls_shared_nonpic_test_SOURCES) $(tls_shared_test_SOURCES) \ @@ -955,7 +963,8 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \ flagstest_compress_debug_sections.c flagstest_o_specialfile.c \ flagstest_o_specialfile_and_compress_debug_sections.c \ $(am__initpri1_SOURCES_DIST) $(am__justsyms_SOURCES_DIST) \ - many_sections_r_test.c $(am__many_sections_test_SOURCES_DIST) \ + local_labels_test.c many_sections_r_test.c \ + $(am__many_sections_test_SOURCES_DIST) \ $(object_unittest_SOURCES) plugin_test_1.c plugin_test_2.c \ plugin_test_3.c plugin_test_4.c \ $(am__protected_1_SOURCES_DIST) \ @@ -1519,6 +1528,7 @@ binary_unittest_SOURCES = binary_unittest.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ alt/libexclude_libs_test_3.a +@GCC_TRUE@@NATIVE_LINKER_TRUE@local_labels_test_LDFLAGS = -Bgcctestdir/ all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -1659,6 +1669,12 @@ initpri1$(EXEEXT): $(initpri1_OBJECTS) $(initpri1_DEPENDENCIES) justsyms$(EXEEXT): $(justsyms_OBJECTS) $(justsyms_DEPENDENCIES) @rm -f justsyms$(EXEEXT) $(CXXLINK) $(justsyms_LDFLAGS) $(justsyms_OBJECTS) $(justsyms_LDADD) $(LIBS) +@GCC_FALSE@local_labels_test$(EXEEXT): $(local_labels_test_OBJECTS) $(local_labels_test_DEPENDENCIES) +@GCC_FALSE@ @rm -f local_labels_test$(EXEEXT) +@GCC_FALSE@ $(LINK) $(local_labels_test_LDFLAGS) $(local_labels_test_OBJECTS) $(local_labels_test_LDADD) $(LIBS) +@NATIVE_LINKER_FALSE@local_labels_test$(EXEEXT): $(local_labels_test_OBJECTS) $(local_labels_test_DEPENDENCIES) +@NATIVE_LINKER_FALSE@ @rm -f local_labels_test$(EXEEXT) +@NATIVE_LINKER_FALSE@ $(LINK) $(local_labels_test_LDFLAGS) $(local_labels_test_OBJECTS) $(local_labels_test_LDADD) $(LIBS) @GCC_FALSE@many_sections_r_test$(EXEEXT): $(many_sections_r_test_OBJECTS) $(many_sections_r_test_DEPENDENCIES) @GCC_FALSE@ @rm -f many_sections_r_test$(EXEEXT) @GCC_FALSE@ $(LINK) $(many_sections_r_test_LDFLAGS) $(many_sections_r_test_OBJECTS) $(many_sections_r_test_LDADD) $(LIBS) @@ -1891,6 +1907,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flagstest_o_specialfile_and_compress_debug_sections.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initpri1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/justsyms_1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_labels_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/many_sections_r_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/many_sections_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_unittest.Po@am__quote@ @@ -2613,6 +2630,10 @@ uninstall-am: uninstall-info-am @GCC_TRUE@@NATIVE_LINKER_TRUE@alt/libexclude_libs_test_3.a: exclude_libs_test_3.o @GCC_TRUE@@NATIVE_LINKER_TRUE@ test -d alt || mkdir -p alt @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AR) rc $@ $^ +@GCC_TRUE@@NATIVE_LINKER_TRUE@local_labels_test.o: ver_test_6.c +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -g -c -Wa,-L -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@local_labels_test: local_labels_test.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ local_labels_test.o # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: |