diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -2469,6 +2469,13 @@ PersonalityEncoding = 0; LSDAEncoding = 0; CallSiteEncoding = dwarf::DW_EH_PE_udata4; + + // AIX debug for thread local location is not ready. And for integrated as + // mode, the relocatable address for the thread local variable will cause + // linker error. So disable the location attribute generation for thread local + // variables for now. + // FIXME: when TLS debug on AIX is ready, remove this setting. + SupportDebugThreadLocalLocation = false; } MCSection *TargetLoweringObjectFileXCOFF::getStaticCtorSection( diff --git a/llvm/test/CodeGen/PowerPC/tls-debug-aix.ll b/llvm/test/CodeGen/PowerPC/tls-debug-aix.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/tls-debug-aix.ll @@ -0,0 +1,54 @@ +; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s --check-prefix=ASM +; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s --check-prefix=ASM +; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj < %s | \ +; RUN: llvm-dwarfdump -i - | FileCheck %s --check-prefix=OBJ +; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s | \ +; RUN: llvm-dwarfdump -i - | FileCheck %s --check-prefix=OBJ + +; ASM: .dwsect 0x10000 +; ASM-NEXT: .dwinfo: +; ASM: .byte{{.*}}DW_TAG_variable +; ASM-NOT: .byte{{.*}}DW_AT_location +; ASM-NOT: .vbyte{{.*}}i[TL] +; ASM: .byte{{.*}}DW_TAG_ + +; OBJ: DW_TAG_variable +; OBJ-NEXT: DW_AT_name{{.*}}("i") +; OBJ-NEXT: DW_AT_type +; OBJ-NEXT: DW_AT_external +; OBJ-NEXT: DW_AT_decl_file +; OBJ-NEXT: DW_AT_decl_line +; OBJ-NOT: DW_AT_location{{.*}}DW_OP_form_tls_address +; OBJ: DW_TAG_ + +@i = thread_local global i32 20, align 4, !dbg !0 + +define i32 @foo() !dbg !12 { +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + %0 = load i32, i32* @i, align 4, !dbg !16 + ret i32 %0, !dbg !16 +} + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!6, !7, !8, !9, !10} +!llvm.ident = !{!11} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "i", scope: !2, file: !3, line: 2, type: !5, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "IBM Open XL C/C++ for AIX", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None) +!3 = !DIFile(filename: "t.c", directory: ".") +!4 = !{!0} +!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!6 = !{i32 7, !"Dwarf Version", i32 3} +!7 = !{i32 2, !"Debug Info Version", i32 3} +!8 = !{i32 1, !"wchar_size", i32 2} +!9 = !{i32 7, !"PIC Level", i32 2} +!10 = !{i32 7, !"frame-pointer", i32 2} +!11 = !{!"IBM Open XL C/C++ for AIX"} +!12 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 3, type: !13, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15) +!13 = !DISubroutineType(types: !14) +!14 = !{!5} +!15 = !{} +!16 = !DILocation(line: 4, scope: !12)