Index: include/llvm/MC/MCDwarf.h =================================================================== --- include/llvm/MC/MCDwarf.h +++ include/llvm/MC/MCDwarf.h @@ -354,7 +354,7 @@ // needed to be gathered for each symbol that will have a dwarf label. class MCGenDwarfLabelEntry { private: - // Name of the symbol without a leading underbar, if any. + // Name of the symbol. StringRef Name; // The dwarf file number this symbol is in. unsigned FileNumber; Index: lib/MC/MCDwarf.cpp =================================================================== --- lib/MC/MCDwarf.cpp +++ lib/MC/MCDwarf.cpp @@ -994,7 +994,7 @@ // The DW_TAG_label DIE abbrev (2). MCOS->EmitULEB128IntValue(2); - // AT_name, of the label without any leading underbar. + // AT_name, of the label. MCOS->EmitBytes(Entry.getName()); MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string. @@ -1148,11 +1148,7 @@ if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSectionOnly())) return; - // The dwarf label's name does not have the symbol name's leading - // underbar if any. StringRef Name = Symbol->getName(); - if (Name.startswith("_")) - Name = Name.substr(1, Name.size()-1); // Get the dwarf file number to be used for the dwarf label. unsigned FileNumber = context.getGenDwarfFileNumber(); Index: test/MC/MachO/gen-dwarf.s =================================================================== --- test/MC/MachO/gen-dwarf.s +++ test/MC/MachO/gen-dwarf.s @@ -49,7 +49,7 @@ // CHECK: DW_AT_language (DW_LANG_Mips_Assembler) // CHECK: DW_TAG_label -// CHECK: DW_AT_name ("bar") +// CHECK: DW_AT_name ("_bar") // CHECK: DW_AT_decl_file ([[FILE:".*gen-dwarf.s"]]) // CHECK: DW_AT_decl_line (5) // CHECK: DW_AT_low_pc (0x0000000000000000) @@ -60,7 +60,7 @@ // CHECK: NULL // CHECK: DW_TAG_label -// CHECK: DW_AT_name ("foo") +// CHECK: DW_AT_name ("_foo") // CHECK: DW_AT_decl_file ([[FILE]]) // CHECK: DW_AT_decl_line (9) // CHECK: DW_AT_low_pc (0x0000000000000007) @@ -71,7 +71,7 @@ // CHECK: NULL // CHECK: DW_TAG_label -// CHECK: DW_AT_name ("baz") +// CHECK: DW_AT_name ("_baz") // CHECK: DW_AT_decl_file ([[FILE]]) // CHECK: DW_AT_decl_line (10) // CHECK: DW_AT_low_pc (0x0000000000000007)