-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[AArch64] Support TLS variables in debug info #146572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
; RUN: llc -O0 -mtriple=aarch64-linux-gnu -filetype=obj < %s \ | ||
; RUN: | llvm-objdump -r - | FileCheck %s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indent the second line a bit so it's clear it's a continuation:
|
||
|
||
; CHECK: R_AARCH64_TLS_DTPREL64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does the full output look like? Because this check looks a bit non-specific. I know it's basically "do we produce this at all" but is there anything else we can check to make sure it is in fact for "var" not something else? |
||
|
||
@var = thread_local global i32 0, align 4, !dbg !0 | ||
|
||
; Function Attrs: noinline nounwind optnone | ||
define i32 @foo() #0 !dbg !11 { | ||
entry: | ||
%0 = load i32, ptr @var, align 4, !dbg !14 | ||
ret i32 %0, !dbg !15 | ||
} | ||
|
||
attributes #0 = { noinline nounwind optnone } | ||
|
||
!llvm.dbg.cu = !{!2} | ||
!llvm.module.flags = !{!7, !8, !9} | ||
!llvm.ident = !{!10} | ||
|
||
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) | ||
!1 = distinct !DIGlobalVariable(name: "var", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true) | ||
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) | ||
!3 = !DIFile(filename: "tls-at-location.c", directory: "/home/lliu0/llvm/tls-at-location/DebugInfo/AArch64") | ||
!4 = !{} | ||
!5 = !{!0} | ||
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
!7 = !{i32 2, !"Dwarf Version", i32 4} | ||
!8 = !{i32 2, !"Debug Info Version", i32 3} | ||
!9 = !{i32 1, !"wchar_size", i32 4} | ||
!10 = !{!"clang version 7.0.0"} | ||
!11 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !2) | ||
!12 = !DISubroutineType(types: !13) | ||
!13 = !{!6} | ||
!14 = !DILocation(line: 4, column: 10, scope: !11) | ||
!15 = !DILocation(line: 4, column: 3, scope: !11) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
; RUN: llc -filetype=obj -mtriple=aarch64--linux-gnu -o - %s | llvm-dwarfdump -v - | FileCheck %s | ||
; | ||
; RUN: llc -O0 -mtriple=aarch64-non-linux-gnu -filetype=obj < %s \ | ||
; RUN: | llvm-dwarfdump - | FileCheck %s | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indent the continuation |
||
; CHECK: .debug_info contents: | ||
; CHECK: DW_TAG_variable | ||
; CHECK-NOT: DW_AT_location | ||
; CHECK: DW_AT_name ("var") | ||
; CHECK-NEXT: DW_AT_type (0x00000040 "int") | ||
; CHECK-NEXT: DW_AT_external (true) | ||
; CHECK-NEXT: DW_AT_decl_file ("{{.*}}tls-at-location.c") | ||
; CHECK-NEXT: DW_AT_decl_line (1) | ||
; CHECK-NEXT: DW_AT_location (DW_OP_const8u 0x0, DW_OP_GNU_push_tls_address) | ||
|
||
@var = thread_local global i32 0, align 4, !dbg !0 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s | llvm-readobj -r - | FileCheck %s | ||
|
||
# CHECK: Relocations [ | ||
# CHECK: Section {{.*}} .rela.debug_info { | ||
# CHECK: 0x{{[0-9A-F]+}} R_AARCH64_TLS_DTPREL64 var {{.*}} | ||
# CHECK: } | ||
|
||
.section .tdata,"awT",@progbits | ||
.globl var | ||
var: | ||
.word 0 | ||
|
||
.section .debug_abbrev,"",@progbits | ||
.byte 1 // Abbreviation Code | ||
.byte 17 // DW_TAG_compile_unit | ||
.byte 1 // DW_CHILDREN_yes | ||
.byte 0 // EOM(1) | ||
.byte 0 // EOM(2) | ||
|
||
.byte 2 // Abbreviation Code | ||
.byte 52 // DW_TAG_variable | ||
.byte 0 // DW_CHILDREN_no | ||
.byte 2; // DW_AT_location | ||
.byte 24 // DW_FORM_exprloc | ||
.byte 0 // EOM(1) | ||
.byte 0 // EOM(2) | ||
|
||
.section .debug_info,"",@progbits | ||
.Lcu_begin0: | ||
.word .Lcu_end - .Lcu_body // Length of Unit | ||
.Lcu_body: | ||
.hword 4 // DWARF version number | ||
.word .debug_abbrev // Offset Into Abbrev. Section | ||
.byte 8 // Address Size (in bytes) | ||
.byte 1 // Abbrev [1] DW_TAG_compile_unit | ||
.byte 2 // Abbrev [2] DW_TAG_variable | ||
.xword var@DTPREL | ||
.Lcu_end: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should be removed.