[Dwarf-Discuss] armcc DWARF

Keith Walker Keith.Walker@arm.com
Wed May 23 09:33:14 GMT 2018


- Why is .debug_abbrev in a group by itself?

So that it can be placed into a COMDAT group and the linker can ensure that only one copy of the .debug_abbrev sections appears in the final image.

armcc generates a fixed table of entries into the .debug_abbrev section, so this allows the linker to ensure only one copy ends up in the final image.   All .debug_info sections in a .o file reference this one .debug_abbrev section.

This is different to many other compilers which generate a .debug_abbrev section which only contains the entries required by a single .debug_info section;  thus each .debug_abbrev section is different.   The resulting table in the final image, which concatenates all the .debug_abbrev sections together, may therefore be larger than having a single table of fixed entries.

- There are two .debug_info not in any group

Armcc partitions up the debugging information in order to allow debugging information to be removed from the final image if the associated code/data is removed.

The debugging information that should always be retained (usually type information) will be placed into sections not in a group.

The debugging information that is associated with code/data that could be discarded by the linker will be placed into the same group section;   so if the code/data is discarded so is the associated debugging information.   The .debug_info entries in a group section will often reference type entries in the .debug_info section which is always retained.

The often happens for C++ code, or if you are generating each function into its own section to allow the linker to discard unused functions.

- Which .debug_line (sec 7 or 8)would be referred to from section 6 debug_line? How would one know?

The magic of relocation entries.     The DW_AT_stmt_list entry in section 6 should have an associated relocation entry whose symbol is associated with the section to which it refers.


-----Original Message-----
From: Dwarf-Discuss <dwarf-discuss-bounces@lists.dwarfstd.org> On Behalf Of David Anderson via Dwarf-Discuss
Sent: 22 May 2018 22:33
To: dwarf-discuss at lists.dwarfstd.org
Subject: [Dwarf-Discuss] armcc DWARF

I have been given a tiny object file  created by armcc using DWARF and things make no sense to me so far.

dwarfdump (and libdwarf) use the SHT_GROUP section data to associate sections to their group.  This is a .o, not a fully linked executable or shared-library.

(libdwarf assigns group numbers itself. group 1 is  non-dwo .debug sections) (any .dwo sections present would be shown as group 2 if not listed in a section-group header, but no such are present here)

Here is dwarfdump/libdwarf/s reading of the sections and section-group sections.

Section Groups data
   Number of Elf-like sections:   35
   Number of groups           :    5
   Group to print             :    3
   Count of map entries       :   15
   [index]  group section
   [    0]    1     4 .debug_frame
   [    1]    1     5 .debug_info
   [    2]    1     6 .debug_info
   [    3]    1     7 .debug_line
   [    4]    1     8 .debug_line
   [    5]    1     9 .debug_loc
   [    6]    1    10 .debug_macinfo
   [    7]    1    11 .debug_pubnames
   [    8]    3    13 .debug_info
   [    9]    3    14 .debug_line
   [   10]    4    16 .debug_info
   [   11]    5    18 .debug_info
   [   12]    5    19 .debug_line
   [   13]    5    20 .debug_macinfo
   [   14]    6    22 .debug_abbrev

There are two .debug_info not in any group (called group 1 by libdwarf).
There is only one .debug_abbrev and it is in group six.

How is one to make sense of this?  Which .debug_line (sec 7 or 8)would be referred to from section 6 debug_line? How would one know?

Why is .debug_abbrev in a group by itself?

I would appreciate any information on how the sections tie together...
how is a reader supposed to know what goes with what?

Thanks for any hints.
David Anderson

Duct tape is like the force. It has a light side, a dark side, and it holds the universe together.... -- Carl Zwanzig

Dwarf-Discuss mailing list
Dwarf-Discuss at lists.dwarfstd.org
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

More information about the Dwarf-discuss mailing list