Index: lib/CodeGen/LLVMTargetMachine.cpp =================================================================== --- lib/CodeGen/LLVMTargetMachine.cpp +++ lib/CodeGen/LLVMTargetMachine.cpp @@ -196,8 +196,11 @@ if (!MCE || !MAB) return true; - // Don't waste memory on names of temp labels. - Context->setUseNamesOnTempLabels(false); + if (getObjFileLowering()->getObjectFileType() == + MCObjectFileInfo::Environment::IsELF) { + // Don't waste memory on names of temp labels. + Context->setUseNamesOnTempLabels(false); + } Triple T(getTargetTriple().str()); AsmStreamer.reset(getTarget().createMCObjectStreamer( Index: test/CodeGen/ARM/elf-debug-label-name.ll =================================================================== --- test/CodeGen/ARM/elf-debug-label-name.ll +++ test/CodeGen/ARM/elf-debug-label-name.ll @@ -0,0 +1,37 @@ +; RUN: llc < %s -mtriple=armv7l-linux-eabihf -filetype=obj -o %s.o && llvm-objdump -t %s.o | FileCheck %s --check-prefix=CHECK +; CHECK: .debug_str 00000000 .Linfo_string0 +; Function Attrs: nounwind +define arm_aapcs_vfpcc i32 @_Z1xi(i32 %a) #0 !dbg !4 { +entry: + %a.addr = alloca i32, align 4 + store i32 %a, i32* %a.addr, align 4 + call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !13, metadata !14), !dbg !15 + %0 = load i32, i32* %a.addr, align 4, !dbg !16 + ret i32 %0, !dbg !17 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!8, !9, !10, !11} +!llvm.ident = !{!12} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3) +!1 = !DIFile(filename: "file", directory: "dir") +!2 = !{} +!3 = !{!4} +!4 = distinct !DISubprogram(name: "x", linkageName: "_Z1xi", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, variables: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!8 = !{i32 2, !"Dwarf Version", i32 4} +!9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !{i32 1, !"wchar_size", i32 4} +!11 = !{i32 1, !"min_enum_size", i32 4} +!12 = !{!"clang"} +!13 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 1, type: !7) +!14 = !DIExpression() +!15 = !DILocation(line: 1, column: 11, scope: !4) +!16 = !DILocation(line: 3, column: 10, scope: !4) +!17 = !DILocation(line: 3, column: 3, scope: !4)