aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <rafael.espindola@gmail.com>2015-04-27 14:33:02 -0400
committerRafael Ávila de Espíndola <rafael.espindola@gmail.com>2015-04-27 14:35:17 -0400
commitcfbf0e3c5b637d66b2b1aeadecae9c187b825b2f (patch)
treebe86234359ffb2555ab01fd46b40e3d82dee18c6 /gold
parent4fff86c517abb5ba454befe0ec0f284f720dde00 (diff)
downloadgdb-cfbf0e3c5b637d66b2b1aeadecae9c187b825b2f.zip
gdb-cfbf0e3c5b637d66b2b1aeadecae9c187b825b2f.tar.gz
gdb-cfbf0e3c5b637d66b2b1aeadecae9c187b825b2f.tar.bz2
If a range is missing, assume the input address is mapped.
When Output_section::is_input_address_mapped is called we have entries for all dropped ranges, but not for all ranges.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog10
-rw-r--r--gold/output.cc4
-rw-r--r--gold/testsuite/Makefile.am8
-rw-r--r--gold/testsuite/Makefile.in34
-rw-r--r--gold/testsuite/eh_test_a.cc4
-rw-r--r--gold/testsuite/eh_test_b.cc23
6 files changed, 77 insertions, 6 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index c5b3093..6b627d4 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,13 @@
+2015-04-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+
+ PR gold/18327
+ * output.cc (Output_section::is_input_address_mapped): Assume a missing
+ entry is mapped.
+ * testsuite/Makefile.am: Add the eh_test test.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/eh_test_a.cc: New test.
+ * testsuite/eh_test_b.cc: New test.
+
2015-04-23 Sriraman Tallam <tmsriram@google.com>
* options.h (--weak-unresolved-symbols): New option.
* symtab.cc (Symbol_table::sized_write_globals): Change symbol
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
diff --git a/gold/testsuite/eh_test_a.cc b/gold/testsuite/eh_test_a.cc
new file mode 100644
index 0000000..ad4bcc2
--- /dev/null
+++ b/gold/testsuite/eh_test_a.cc
@@ -0,0 +1,4 @@
+void
+bar()
+{
+}
diff --git a/gold/testsuite/eh_test_b.cc b/gold/testsuite/eh_test_b.cc
new file mode 100644
index 0000000..50538df
--- /dev/null
+++ b/gold/testsuite/eh_test_b.cc
@@ -0,0 +1,23 @@
+#include <iostream>
+#include <cstdlib>
+
+void
+foo()
+{
+}
+
+int
+main()
+{
+ try
+ {
+ throw(1);
+ }
+ catch(int)
+ {
+ std::cout << "caught" << std::endl;
+ exit(0);
+ }
+ std::cout << "failed" << std::endl;
+ exit(1);
+}