This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch][gold] Fix pr18327


The difference in behavior introduced in
67f95b96b4d5e8e19520d94bebae92db2f67af74 was that
Output_section::find_merge_section started returning non-null for
eh_frame sections. The old "lookup_maps_->find_merge_section" would
only include SHF_MERGE sections.

Finding the output section is a good thing, but the patch also handled
a given offset not being mapped in that section incorrectly.

This patch just fixes Output_section::is_input_address_mapped.

Cheers,
Rafael

2015-04-27  Rafael Ãvila de EspÃndola <rafael.espindola@gmail.com>

* output.cc (Output_section::is_input_address_mapped): Assume a missing
entry is mapped.
* Makefile.am: Add the eh_test test.
* Makefile.in: Regenerate.
diff --git a/gold/output.cc b/gold/output.cc
index ee6c475..f34a7d8 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -2901,8 +2901,10 @@ Output_section::is_input_address_mapped(const Relobj* object,
     {
       section_offset_type output_offset;
       bool found = posd->output_offset(object, shndx, offset, &output_offset);
+      // By default we assume that the address is mapped. See comment at the
+      // end.
       if (!found)
-        return false;
+        return true;
       return output_offset != -1;
     }
 
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index e47174d..e2390eb 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -375,6 +375,14 @@ basic_test.o: basic_test.cc
 basic_test: basic_test.o gcctestdir/ld
 	$(CXXLINK) -Bgcctestdir/ basic_test.o
 
+check_PROGRAMS += eh_test
+eh_test_a.o: eh_test_a.cc
+	$(CXXCOMPILE) -O0 -c -o $@ $<
+eh_test_b.o: eh_test_b.cc
+	$(CXXCOMPILE) -O0 -c -o $@ $<
+eh_test: eh_test_a.o eh_test_b.o  gcctestdir/ld
+	$(CXXLINK_S) -Bgcctestdir/ eh_test_a.o eh_test_b.o
+
 if HAVE_STATIC
 check_PROGRAMS += basic_static_test
 basic_static_test: basic_test.o gcctestdir/ld
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 4d7a54f..fe8da13 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -123,7 +123,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	libweak_undef_2.a
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_5 = icf_virtual_function_folding_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	large_symbol_alignment \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@	basic_test basic_pic_test
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	basic_test basic_pic_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	eh_test
 @GCC_FALSE@large_symbol_alignment_DEPENDENCIES =
 @NATIVE_LINKER_FALSE@large_symbol_alignment_DEPENDENCIES =
 @GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@am__append_6 = basic_static_test \
@@ -824,7 +825,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_2 = icf_virtual_function_folding_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	large_symbol_alignment$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	basic_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@	basic_pic_test$(EXEEXT)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	basic_pic_test$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	eh_test$(EXEEXT)
 @GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_3 = basic_static_test$(EXEEXT) \
 @GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@	basic_static_pic_test$(EXEEXT)
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_4 = basic_pie_test$(EXEEXT) \
@@ -1081,6 +1083,13 @@ discard_locals_test_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 dynamic_list_2_OBJECTS = $(am_dynamic_list_2_OBJECTS)
 dynamic_list_2_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
 	$(dynamic_list_2_LDFLAGS) $(LDFLAGS) -o $@
+eh_test_SOURCES = eh_test.c
+eh_test_OBJECTS = eh_test.$(OBJEXT)
+eh_test_LDADD = $(LDADD)
+eh_test_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_ehdr_start_test_1_OBJECTS = ehdr_start_test_1-ehdr_start_test.$(OBJEXT)
 ehdr_start_test_1_OBJECTS = $(am_ehdr_start_test_1_OBJECTS)
 ehdr_start_test_1_LINK = $(CXXLD) $(ehdr_start_test_1_CXXFLAGS) \
@@ -1991,9 +2000,9 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
 	$(common_test_1_SOURCES) $(common_test_2_SOURCES) \
 	$(constructor_static_test_SOURCES) $(constructor_test_SOURCES) \
 	$(copy_test_SOURCES) $(discard_locals_test_SOURCES) \
-	$(dynamic_list_2_SOURCES) $(ehdr_start_test_1_SOURCES) \
-	$(ehdr_start_test_2_SOURCES) $(ehdr_start_test_3_SOURCES) \
-	$(ehdr_start_test_5_SOURCES) \
+	$(dynamic_list_2_SOURCES) eh_test.c \
+	$(ehdr_start_test_1_SOURCES) $(ehdr_start_test_2_SOURCES) \
+	$(ehdr_start_test_3_SOURCES) $(ehdr_start_test_5_SOURCES) \
 	$(exception_same_shared_test_SOURCES) \
 	$(exception_separate_shared_12_test_SOURCES) \
 	$(exception_separate_shared_21_test_SOURCES) \
@@ -2989,6 +2998,12 @@ discard_locals_test$(EXEEXT): $(discard_locals_test_OBJECTS) $(discard_locals_te
 dynamic_list_2$(EXEEXT): $(dynamic_list_2_OBJECTS) $(dynamic_list_2_DEPENDENCIES) 
 	@rm -f dynamic_list_2$(EXEEXT)
 	$(dynamic_list_2_LINK) $(dynamic_list_2_OBJECTS) $(dynamic_list_2_LDADD) $(LIBS)
+@GCC_FALSE@eh_test$(EXEEXT): $(eh_test_OBJECTS) $(eh_test_DEPENDENCIES) 
+@GCC_FALSE@	@rm -f eh_test$(EXEEXT)
+@GCC_FALSE@	$(LINK) $(eh_test_OBJECTS) $(eh_test_LDADD) $(LIBS)
+@NATIVE_LINKER_FALSE@eh_test$(EXEEXT): $(eh_test_OBJECTS) $(eh_test_DEPENDENCIES) 
+@NATIVE_LINKER_FALSE@	@rm -f eh_test$(EXEEXT)
+@NATIVE_LINKER_FALSE@	$(LINK) $(eh_test_OBJECTS) $(eh_test_LDADD) $(LIBS)
 ehdr_start_test_1$(EXEEXT): $(ehdr_start_test_1_OBJECTS) $(ehdr_start_test_1_DEPENDENCIES) 
 	@rm -f ehdr_start_test_1$(EXEEXT)
 	$(ehdr_start_test_1_LINK) $(ehdr_start_test_1_OBJECTS) $(ehdr_start_test_1_LDADD) $(LIBS)
@@ -3761,6 +3776,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copy_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/discard_locals_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynamic_list_2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehdr_start_test_1-ehdr_start_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehdr_start_test_2-ehdr_start_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehdr_start_test_3-ehdr_start_test.Po@am__quote@
@@ -4402,6 +4418,8 @@ basic_test.log: basic_test$(EXEEXT)
 	@p='basic_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
 basic_pic_test.log: basic_pic_test$(EXEEXT)
 	@p='basic_pic_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+eh_test.log: eh_test$(EXEEXT)
+	@p='eh_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
 basic_static_test.log: basic_static_test$(EXEEXT)
 	@p='basic_static_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
 basic_static_pic_test.log: basic_static_pic_test$(EXEEXT)
@@ -5009,6 +5027,12 @@ uninstall-am:
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXCOMPILE) -O0 -c -o $@ $<
 @GCC_TRUE@@NATIVE_LINKER_TRUE@basic_test: basic_test.o gcctestdir/ld
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXLINK) -Bgcctestdir/ basic_test.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@eh_test_a.o: eh_test_a.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXCOMPILE) -O0 -c -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@eh_test_b.o: eh_test_b.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXCOMPILE) -O0 -c -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@eh_test: eh_test_a.o eh_test_b.o  gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXLINK_S) -Bgcctestdir/ eh_test_a.o eh_test_b.o
 @GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@basic_static_test: basic_test.o gcctestdir/ld
 @GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXLINK) -Bgcctestdir/ -static basic_test.o
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]