From 33ff697cb1037a1e9361a0acee8f0faaae990bd3 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 21 Nov 2013 23:46:41 +0000 Subject: In Dwarf 3 (and Dwarf 2) attributes whose value are offsets into a section use the form DW_FORM_data4 whilst in Dwarf 4 and later they use the form DW_FORM_sec_offset. This patch updates the places where such attributes are generated to use the appropriate form depending on the Dwarf version. The DIE entries affected have the following tags: DW_AT_stmt_list, DW_AT_ranges, DW_AT_location, DW_AT_GNU_pubnames, DW_AT_GNU_pubtypes, DW_AT_GNU_addr_base, DW_AT_GNU_ranges_base It also adds a hidden command line option "--dwarf-version=" to llc which allows the version of Dwarf to be generated to override what is specified in the metadata; this makes it possible to update existing tests to check the debugging information generated for both Dwarf 4 (the default) and Dwarf 3 using the same metadata. Patch (slightly modified) by Keith Walker! llvm-svn: 195391 --- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 23d3afc0242..0821a9a2b98 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -212,6 +212,14 @@ public: void addLabel(DIEBlock *Die, dwarf::Form Form, const MCSymbol *Label); + /// addSectionLabel - Add a Dwarf section label attribute data and value. + /// + void addSectionLabel(DIE *Die, dwarf::Attribute Attribute, const MCSymbol *Label); + + /// addSectionOffset - Add an offset into a section attribute data and value. + /// + void addSectionOffset(DIE *Die, dwarf::Attribute Attribute, uint64_t Integer); + /// addLabelAddress - Add a dwarf label attribute data and value using /// either DW_FORM_addr or DW_FORM_GNU_addr_index. void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label); @@ -220,9 +228,9 @@ public: /// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index. void addOpAddress(DIEBlock *Die, const MCSymbol *Label); - /// addDelta - Add a label delta attribute data and value. - void addDelta(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form, - const MCSymbol *Hi, const MCSymbol *Lo); + /// addSectionDelta - Add a label delta attribute data and value. + void addSectionDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol *Hi, + const MCSymbol *Lo); /// addDIEEntry - Add a DIE attribute data and value. void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry); -- cgit v1.2.3