[llvm] 8d19cfb - [PowerPC] omit location attribute for TLS variable on AIX

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 21:55:25 PDT 2022


Author: Chen Zheng
Date: 2022-08-12T00:54:48-04:00
New Revision: 8d19cfb72e13aaac3f5b5f1af884e7799aa9e05f

URL: https://github.com/llvm/llvm-project/commit/8d19cfb72e13aaac3f5b5f1af884e7799aa9e05f
DIFF: https://github.com/llvm/llvm-project/commit/8d19cfb72e13aaac3f5b5f1af884e7799aa9e05f.diff

LOG: [PowerPC] omit location attribute for TLS variable on AIX

TLS debug on AIX is not ready for now.
The location generated in no-integrated-as mode is wrong and
in integrated-as mode causes AIX linker error.

Reviewed By: Esme

Differential Revision: https://reviews.llvm.org/D130245

Added: 
    llvm/test/CodeGen/PowerPC/tls-debug-aix.ll

Modified: 
    llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index b114f42fbb285..5859937632812 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -2469,6 +2469,13 @@ void TargetLoweringObjectFileXCOFF::Initialize(MCContext &Ctx,
   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
index 0000000000000..edcf2f0c42daf
--- /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_
+
+ at 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)


        


More information about the llvm-commits mailing list