diff options
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 12 | ||||
-rw-r--r-- | gold/dwarf_reader.cc | 11 | ||||
-rw-r--r-- | gold/dwarf_reader.h | 7 | ||||
-rw-r--r-- | gold/gdb-index.cc | 12 | ||||
-rw-r--r-- | gold/testsuite/Makefile.am | 12 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 52 |
6 files changed, 82 insertions, 24 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 990247c..562e22a 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,15 @@ +2012-04-26 Mark Wielaard <mjw@redhat.com> + + * dwarf_reader.cc (Dwarf_die::address_attribute): New function. + * dwarf_reader.h (Dwarf_die::address_attribute): Likewise. + * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle + DW_AT_high_pc as offset from DW_AT_low_pc. + + * testsuite/Makefile.am (gdb_index_test_3.sh): New test case. + * testsuite/Makefile.in: Regenerate. + * testsuite/gdb_index_test_3.c: New test source file. + * testsuite/gdb_index_test_3.sh: New test source file. + 2012-04-25 Ian Lance Taylor <iant@google.com> * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index eaf35bf..6245dc8 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -1051,6 +1051,17 @@ Dwarf_die::ref_attribute(unsigned int attr, unsigned int* shndx) } } +off_t +Dwarf_die::address_attribute(unsigned int attr, unsigned int* shndx) +{ + const Attribute_value* attr_val = this->attribute(attr); + if (attr_val == NULL || attr_val->form != elfcpp::DW_FORM_addr) + return -1; + + *shndx = attr_val->aux.shndx; + return attr_val->val.refval; +} + // Return the offset of this DIE's first child. off_t diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h index 0c3dab6..de5722b 100644 --- a/gold/dwarf_reader.h +++ b/gold/dwarf_reader.h @@ -547,8 +547,11 @@ class Dwarf_die // Return the value of attribute ATTR as a reference. off_t - ref_attribute(unsigned int attr, - unsigned int* shndx); + ref_attribute(unsigned int attr, unsigned int* shndx); + + // Return the value of attribute ATTR as a address. + off_t + address_attribute(unsigned int attr, unsigned int* shndx); // Return the value of attribute ATTR as a flag. bool diff --git a/gold/gdb-index.cc b/gold/gdb-index.cc index a6db505..6666988 100644 --- a/gold/gdb-index.cc +++ b/gold/gdb-index.cc @@ -823,9 +823,15 @@ Gdb_index_info_reader::record_cu_ranges(Dwarf_die* die) return; } - off_t low_pc = die->ref_attribute(elfcpp::DW_AT_low_pc, &shndx); - off_t high_pc = die->ref_attribute(elfcpp::DW_AT_high_pc, &shndx2); - if ((low_pc != 0 || high_pc != 0) && low_pc != -1 && high_pc != -1) + off_t low_pc = die->address_attribute(elfcpp::DW_AT_low_pc, &shndx); + off_t high_pc = die->address_attribute(elfcpp::DW_AT_high_pc, &shndx2); + if (high_pc == -1) + { + high_pc = die->uint_attribute(elfcpp::DW_AT_high_pc); + high_pc += low_pc; + shndx2 = shndx; + } + if ((low_pc != 0 || high_pc != 0) && low_pc != -1) { if (shndx != shndx2) { diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index d3c02e0..1c970a3 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -1992,6 +1992,18 @@ gdb_index_test_2.stdout: gdb_index_test_2 endif HAVE_ZLIB +# Another simple C test (DW_AT_high_pc encoding) for --gdb-index +check_SCRIPTS += gdb_index_test_3.sh +check_DATA += gdb_index_test_3.stdout +MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3 +gdb_index_test_3.o: gdb_index_test_3.c + $(COMPILE) -O0 -g -c -o $@ $< +gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld + $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $< +gdb_index_test_3.stdout: gdb_index_test_3 + $(TEST_READELF) --debug-dump=gdb_index $< > $@ + + # End-to-end incremental linking tests. # Incremental linking is currently supported only on the x86_64 target. diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 86c0ea3..d67c1c6 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -487,9 +487,14 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__append_55 = gdb_index_test_2.stdout @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__append_56 = gdb_index_test_2.stdout gdb_index_test_2 +# Another simple C test (DW_AT_high_pc encoding) for --gdb-index +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_57 = gdb_index_test_3.sh +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_58 = gdb_index_test_3.stdout +@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_59 = gdb_index_test_3.stdout gdb_index_test_3 + # Test the --incremental-unchanged flag with an archive library. # The second link should not update the library. -@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_57 = incremental_test_2 \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_60 = incremental_test_2 \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3 \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4 \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_5 \ @@ -497,7 +502,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_copy_test \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1 \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_comdat_test_1 -@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_58 = two_file_test_tmp_2.o \ +@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_61 = two_file_test_tmp_2.o \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_tmp_3.o \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4.base \ @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_tmp_4.o \ @@ -507,22 +512,22 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ # These tests work with native and cross linkers. # Test script section order. -@NATIVE_OR_CROSS_LINKER_TRUE@am__append_59 = script_test_10.sh -@NATIVE_OR_CROSS_LINKER_TRUE@am__append_60 = script_test_10.stdout +@NATIVE_OR_CROSS_LINKER_TRUE@am__append_62 = script_test_10.sh +@NATIVE_OR_CROSS_LINKER_TRUE@am__append_63 = script_test_10.stdout # These tests work with cross linkers only. -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_61 = split_i386.sh -@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_62 = split_i386_1.stdout split_i386_2.stdout \ +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_64 = split_i386.sh +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_65 = 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_63 = split_i386_1 split_i386_2 split_i386_3 \ +@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_66 = 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_64 = split_x86_64.sh -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_65 = split_x86_64_1.stdout split_x86_64_2.stdout \ +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_67 = split_x86_64.sh +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_68 = split_x86_64_1.stdout split_x86_64_2.stdout \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout -@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_66 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \ +@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_69 = 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 @@ -537,7 +542,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ # Check Thumb to Thumb farcall veneers # Check Thumb to ARM farcall veneers -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_67 = arm_abs_global.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_70 = 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 \ @@ -551,7 +556,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.sh -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_68 = arm_abs_global.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_71 = 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 \ @@ -596,7 +601,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t.stdout -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_69 = arm_abs_global \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_72 = 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 \ @@ -644,6 +649,7 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ + $(top_srcdir)/../config/lcmessage.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/nls.m4 \ $(top_srcdir)/../config/override.m4 \ @@ -2006,19 +2012,19 @@ TEST_AS = $(top_builddir)/../gas/as-new MOSTLYCLEANFILES = *.so *.syms *.stdout $(am__append_4) \ $(am__append_17) $(am__append_26) $(am__append_28) \ $(am__append_30) $(am__append_36) $(am__append_40) \ - $(am__append_56) $(am__append_58) $(am__append_63) \ - $(am__append_66) $(am__append_69) + $(am__append_56) $(am__append_59) $(am__append_61) \ + $(am__append_66) $(am__append_69) $(am__append_72) # We will add to these later, for each individual test. Note # that we add each test under check_SCRIPTS or check_PROGRAMS; # the TESTS variable is automatically populated from these. check_SCRIPTS = $(am__append_2) $(am__append_34) $(am__append_38) \ - $(am__append_54) $(am__append_59) $(am__append_61) \ - $(am__append_64) $(am__append_67) + $(am__append_54) $(am__append_57) $(am__append_62) \ + $(am__append_64) $(am__append_67) $(am__append_70) check_DATA = $(am__append_3) $(am__append_27) $(am__append_29) \ $(am__append_35) $(am__append_39) $(am__append_55) \ - $(am__append_60) $(am__append_62) $(am__append_65) \ - $(am__append_68) + $(am__append_58) $(am__append_63) $(am__append_65) \ + $(am__append_68) $(am__append_71) BUILT_SOURCES = $(am__append_25) TESTS = $(check_SCRIPTS) $(check_PROGRAMS) @@ -3735,6 +3741,8 @@ gdb_index_test_1.sh.log: gdb_index_test_1.sh @p='gdb_index_test_1.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) gdb_index_test_2.sh.log: gdb_index_test_2.sh @p='gdb_index_test_2.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +gdb_index_test_3.sh.log: gdb_index_test_3.sh + @p='gdb_index_test_3.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) script_test_10.sh.log: script_test_10.sh @p='script_test_10.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) split_i386.sh.log: split_i386.sh @@ -5068,6 +5076,12 @@ uninstall-am: @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $< @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_2.stdout: gdb_index_test_2 @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) --debug-dump=gdb_index $< > $@ +@GCC_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_3.o: gdb_index_test_3.c +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -O0 -g -c -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_3.stdout: gdb_index_test_3 +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) --debug-dump=gdb_index $< > $@ # End-to-end incremental linking tests. # Incremental linking is currently supported only on the x86_64 target. |