diff options
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/dwarf2dbg.c | 12 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/aarch64/dwarf.d | 27 | ||||
-rw-r--r-- | gas/testsuite/gas/aarch64/dwarf.s | 6 |
5 files changed, 55 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index d9c525d..d81d8a1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2015-06-13 Mark Wielaard <mjw@redhat.com> + + * dwarf2dbg.c (out_header): Document EXPR->X_add_number value, + out_debug_aranges depends on it. + (out_debug_aranges): Track size of header to properly pad header + for address alignment. + 2015-06-11 John David Anglin <danglin@gcc.gnu.org> PR gas/18427 diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index e67c992..ecaccc9 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1458,7 +1458,8 @@ out_file_list (void) /* Switch to SEC and output a header length field. Return the size of offsets used in SEC. The caller must set EXPR->X_add_symbol value - to the end of the section. */ + to the end of the section. EXPR->X_add_number will be set to the + negative size of the header. */ static int out_header (asection *sec, expressionS *exp) @@ -1638,6 +1639,7 @@ static void out_debug_aranges (segT aranges_seg, segT info_seg) { unsigned int addr_size = sizeof_address; + offsetT size; struct line_seg *s; expressionS exp; symbolS *aranges_end; @@ -1646,21 +1648,27 @@ out_debug_aranges (segT aranges_seg, segT info_seg) sizeof_offset = out_header (aranges_seg, &exp); aranges_end = exp.X_add_symbol; + size = -exp.X_add_number; /* Version. */ out_two (DWARF2_ARANGES_VERSION); + size += 2; /* Offset to .debug_info. */ TC_DWARF2_EMIT_OFFSET (section_symbol (info_seg), sizeof_offset); + size += sizeof_offset; /* Size of an address (offset portion). */ out_byte (addr_size); + size++; /* Size of a segment descriptor. */ out_byte (0); + size++; /* Align the header. */ - frag_align (ffs (2 * addr_size) - 1, 0, 0); + while ((size++ % (2 * addr_size)) > 0) + out_byte (0); for (s = all_segs; s; s = s->next) { diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 81e3836..6d6a90c 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-13 Mark Wielaard <mjw@redhat.com> + + * gas/aarch64/dwarf.d: New. + * gas/aarch64/dwarf.s: New. + 2015-06-03 Matthew Wahab <matthew.wahab@arm.com> * gas/arm/armv8-a+rdma.d: New. diff --git a/gas/testsuite/gas/aarch64/dwarf.d b/gas/testsuite/gas/aarch64/dwarf.d new file mode 100644 index 0000000..46aa6d0 --- /dev/null +++ b/gas/testsuite/gas/aarch64/dwarf.d @@ -0,0 +1,27 @@ +#readelf: -s --debug-dump=aranges +#as: -g + +Symbol table '.symtab' contains 10 entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 + 2: 0000000000000000 0 SECTION LOCAL DEFAULT 2 + 3: 0000000000000000 0 SECTION LOCAL DEFAULT 3 + 4: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x + 5: 0000000000000000 0 SECTION LOCAL DEFAULT 6 + 6: 0000000000000000 0 SECTION LOCAL DEFAULT 8 + 7: 0000000000000000 0 SECTION LOCAL DEFAULT 4 + 8: 0000000000000000 0 SECTION LOCAL DEFAULT 9 + 9: 0000000000000000 8 FUNC GLOBAL DEFAULT 1 testfunc +Contents of the .debug_aranges section: + + Length: 44 + Version: 2 + Offset into .debug_info: 0x0 + Pointer Size: 8 + Segment Size: 0 + + Address Length + 0000000000000000 0000000000000008 + 0000000000000000 0000000000000000 + diff --git a/gas/testsuite/gas/aarch64/dwarf.s b/gas/testsuite/gas/aarch64/dwarf.s new file mode 100644 index 0000000..6660205 --- /dev/null +++ b/gas/testsuite/gas/aarch64/dwarf.s @@ -0,0 +1,6 @@ +.globl testfunc +testfunc: + nop + ret +.type testfunc, @function +.size testfunc, .-testfunc |