summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2012-01-10 17:52:29 +0000
committerKevin Enderby <enderby@apple.com>2012-01-10 17:52:29 +0000
commit8d4a2204b71e205723406ef14c2347354b5bd09b (patch)
tree54824d3eb9e54effb273fc9f1cea58875dac2366 /llvm/lib/MC/MCDwarf.cpp
parent67bf992a8fc4193d2714d9671a284a536331ec95 (diff)
downloadbcm5719-llvm-8d4a2204b71e205723406ef14c2347354b5bd09b.tar.gz
bcm5719-llvm-8d4a2204b71e205723406ef14c2347354b5bd09b.zip
Various crash reporting tools have a problem with the dwarf generated for
assembly source when it generates the TAG_subprogram dwarf debug info for the labels that have nothing between them as in this bit of assembly source: % cat ZeroLength.s _func1: _func2: nop One solution would be to not emit the subsequent labels with the same address and use the next label with a different address or the end of the section for the AT_high_pc value of the TAG_subprogram. Turns out in llvm-mc it is not possible in all cases to determine of two symbols have the same value at the point we put out the TAG_subprogram dwarf debug info. So we will have llvm-mc instead of putting out TAG_subprogram's put out DW_TAG_label's. And the DW_TAG_label does not have a AT_high_pc value which avoids the problem. This commit is only the functional change to make the diffs clear as to what is really being changed. The next commit will be to clean up the names of such things like MCGenDwarfSubprogramEntry to something like MCGenDwarfLabelEntry. rdar://10666925 llvm-svn: 147860
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 986b8b67df5..83fa0690e95 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -454,15 +454,14 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
EmitAbbrev(MCOS, dwarf::DW_AT_language, dwarf::DW_FORM_data2);
EmitAbbrev(MCOS, 0, 0);
- // DW_TAG_subprogram DIE abbrev (2).
+ // DW_TAG_label DIE abbrev (2).
MCOS->EmitULEB128IntValue(2);
- MCOS->EmitULEB128IntValue(dwarf::DW_TAG_subprogram);
+ MCOS->EmitULEB128IntValue(dwarf::DW_TAG_label);
MCOS->EmitIntValue(dwarf::DW_CHILDREN_yes, 1);
EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
EmitAbbrev(MCOS, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data4);
EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
- EmitAbbrev(MCOS, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr);
EmitAbbrev(MCOS, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag);
EmitAbbrev(MCOS, 0, 0);
@@ -545,7 +544,7 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS) {
// When generating dwarf for assembly source files this emits the data for
// .debug_info section which contains three parts. The header, the compile_unit
-// DIE and a list of subprogram DIEs.
+// DIE and a list of label DIEs.
static void EmitGenDwarfInfo(MCStreamer *MCOS) {
MCContext &context = MCOS->getContext();
@@ -630,7 +629,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS) {
// draft has no standard code for assembler.
MCOS->EmitIntValue(dwarf::DW_LANG_Mips_Assembler, 2);
- // Third part: the list of subprogram DIEs.
+ // Third part: the list of label DIEs.
// Loop on saved info for dwarf subprograms and create the DIEs for them.
const std::vector<const MCGenDwarfSubprogramEntry *> &Entries =
@@ -640,7 +639,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS) {
++it) {
const MCGenDwarfSubprogramEntry *Entry = *it;
- // The DW_TAG_subprogram DIE abbrev (2).
+ // The DW_TAG_label DIE abbrev (2).
MCOS->EmitULEB128IntValue(2);
// AT_name, of the label without any leading underbar.
@@ -658,17 +657,6 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS) {
MCSymbolRefExpr::VK_None, context);
MCOS->EmitAbsValue(AT_low_pc, AddrSize);
- // AT_high_pc, end address which is the next label or end of the section.
- std::vector<const MCGenDwarfSubprogramEntry *>::const_iterator next = it+1;
- if (next != Entries.end()){
- const MCGenDwarfSubprogramEntry *NextEntry = *next;
- const MCExpr *AT_high_pc = MCSymbolRefExpr::Create(NextEntry->getLabel(),
- MCSymbolRefExpr::VK_None, context);
- MCOS->EmitAbsValue(AT_high_pc, AddrSize);
- } else {
- MCOS->EmitAbsValue(End, AddrSize);
- }
-
// DW_AT_prototyped, a one byte flag value of 0 saying we have no prototype.
MCOS->EmitIntValue(0, 1);
OpenPOWER on IntegriCloud