aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/MC/MCDwarf.cpp22
-rw-r--r--test/MC/MachO/gen-dwarf.s25
2 files changed, 22 insertions, 25 deletions
diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp
index 986b8b6..83fa069 100644
--- a/lib/MC/MCDwarf.cpp
+++ b/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);
diff --git a/test/MC/MachO/gen-dwarf.s b/test/MC/MachO/gen-dwarf.s
index a443d75..4fbc32d 100644
--- a/test/MC/MachO/gen-dwarf.s
+++ b/test/MC/MachO/gen-dwarf.s
@@ -7,6 +7,7 @@ _bar:
L1: leave
ret
_foo:
+_baz:
nop
.data
_x: .long 1
@@ -24,12 +25,11 @@ _x: .long 1
// CHECK: DW_AT_producer DW_FORM_string
// CHECK: DW_AT_language DW_FORM_data2
-// CHECK: [2] DW_TAG_subprogram DW_CHILDREN_yes
+// CHECK: [2] DW_TAG_label DW_CHILDREN_yes
// CHECK: DW_AT_name DW_FORM_string
// CHECK: DW_AT_decl_file DW_FORM_data4
// CHECK: DW_AT_decl_line DW_FORM_data4
// CHECK: DW_AT_low_pc DW_FORM_addr
-// CHECK: DW_AT_high_pc DW_FORM_addr
// CHECK: DW_AT_prototyped DW_FORM_flag
// CHECK: [3] DW_TAG_unspecified_parameters DW_CHILDREN_no
@@ -48,24 +48,33 @@ _x: .long 1
// CHECK: DW_AT_producer [DW_FORM_string] ("llvm-mc (based on {{.*}})")
// CHECK: DW_AT_language [DW_FORM_data2] (0x8001)
-// CHECK: DW_TAG_subprogram [2] *
+// CHECK: DW_TAG_label [2] *
// CHECK: DW_AT_name [DW_FORM_string] ("bar")
// CHECK: DW_AT_decl_file [DW_FORM_data4] (0x00000001)
// CHECK: DW_AT_decl_line [DW_FORM_data4] (0x00000005)
// CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
-// CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000007)
// CHECK: DW_AT_prototyped [DW_FORM_flag] (0x00)
// CHECK: DW_TAG_unspecified_parameters [3]
// CHECK: NULL
-// CHECK: DW_TAG_subprogram [2] *
+// CHECK: DW_TAG_label [2] *
// CHECK: DW_AT_name [DW_FORM_string] ("foo")
// CHECK: DW_AT_decl_file [DW_FORM_data4] (0x00000001)
// CHECK: DW_AT_decl_line [DW_FORM_data4] (0x00000009)
// CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000007)
-// CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000008)
+// CHECK: DW_AT_prototyped [DW_FORM_flag] (0x00)
+
+// CHECK: DW_TAG_unspecified_parameters [3]
+
+// CHECK: NULL
+
+// CHECK: DW_TAG_label [2] *
+// CHECK: DW_AT_name [DW_FORM_string] ("baz")
+// CHECK: DW_AT_decl_file [DW_FORM_data4] (0x00000001)
+// CHECK: DW_AT_decl_line [DW_FORM_data4] (0x0000000a)
+// CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000007)
// CHECK: DW_AT_prototyped [DW_FORM_flag] (0x00)
// CHECK: DW_TAG_unspecified_parameters [3]
@@ -109,5 +118,5 @@ _x: .long 1
// CHECK: 0x0000000000000000 6 0 1 0 is_stmt
// CHECK: 0x0000000000000005 7 0 1 0 is_stmt
// CHECK: 0x0000000000000006 8 0 1 0 is_stmt
-// CHECK: 0x0000000000000007 10 0 1 0 is_stmt
-// CHECK: 0x0000000000000008 10 0 1 0 is_stmt end_sequence
+// CHECK: 0x0000000000000007 11 0 1 0 is_stmt
+// CHECK: 0x0000000000000008 11 0 1 0 is_stmt end_sequence