From 57923f48a1e2e9129fdb3dd536b38e8d1cd46089 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 1 May 2012 19:12:21 +0000 Subject: gold: Handle DW_AT_high_pc as offset from DW_AT_low_pc in gdb-index.cc. * 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. --- gold/gdb-index.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gold/gdb-index.cc') 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) { -- cgit v1.1