aboutsummaryrefslogtreecommitdiff
path: root/gas/dwarf2dbg.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-06-13 17:47:41 -0400
committerMark Wielaard <mjw@redhat.com>2015-06-15 09:25:21 +0200
commitd025d5e5b57fb59c56aa4d57b7fc138720a8e454 (patch)
tree3c0b2a1dc3735c698db95f32dc2d6b6715283132 /gas/dwarf2dbg.c
parent3a062fa1eeee8296dece36a9bb7ecc8d4500de18 (diff)
downloadgdb-d025d5e5b57fb59c56aa4d57b7fc138720a8e454.zip
gdb-d025d5e5b57fb59c56aa4d57b7fc138720a8e454.tar.gz
gdb-d025d5e5b57fb59c56aa4d57b7fc138720a8e454.tar.bz2
gas: Don't use frag_align but use plain padding to align .debug_aranges.
out_debug_aranges uses frag_align to make sure the addresses start out aligned. Using frag_align will call frag_var[_init], which will end up calling TC_FRAG_INIT. On arm and aarch64 TC_FRAG_INIT will generate a $d mapping symbol for the .debug_aranges to show that at that point a sequence of data items starts. Such a symbol pointing into a non-allocated debug section will confuse eu-strip -g. And it seems inefficient and wrong in general to have additional mapping symbols for debug sections, which won't contain actual code in the first place. Just keep track of the aranges header size and use plain padding to align the addresses which avoids generating any mapping symbols on aarch64 and arm. Includes a testcase for aarch64 that PASS with this patch and shows the extra $d mapping symbol in .debug_aranges before. gas/ChangeLog * 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. gas/testsuite/ChangeLog * gas/aarch64/dwarf.d: New. * gas/aarch64/dwarf.s: New.
Diffstat (limited to 'gas/dwarf2dbg.c')
-rw-r--r--gas/dwarf2dbg.c12
1 files changed, 10 insertions, 2 deletions
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)
{