Skip to content

Commit 3365303

Browse files
author
Chen Zheng
committed
use ir input to generate the xcoff object
1 parent a93cc52 commit 3365303

File tree

3 files changed

+149
-63
lines changed

3 files changed

+149
-63
lines changed
Binary file not shown.
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
; RUN: llc -filetype=obj -o %t -mtriple=powerpc-aix-ibm-xcoff < %s
2+
; RUN: llvm-symbolizer --obj=%t 'DATA 0x60' 'DATA 0x61' 'DATA 0x64' 'DATA 0X68' \
3+
; RUN: 'DATA 0x90' 'DATA 0x94' 'DATA 0X98' | FileCheck %s
4+
5+
; CHECK: bss_global
6+
; CHECK-NEXT: 96 4
7+
; CHECK-NEXT: /t.cpp:1
8+
; CHECK-EMPTY:
9+
10+
; CHECK: bss_global
11+
; CHECK-NEXT: 96 4
12+
; CHECK-NEXT: /t.cpp:1
13+
; CHECK-EMPTY:
14+
15+
; CHECK: data_global
16+
; CHECK-NEXT: 100 4
17+
; CHECK-NEXT: /t.cpp:2
18+
; CHECK-EMPTY:
19+
20+
; CHECK: str
21+
; CHECK-NEXT: 104 4
22+
; CHECK-NEXT: /t.cpp:4
23+
; CHECK-EMPTY:
24+
25+
; FIXME: fix the wrong size 152
26+
; CHECK: f()::function_global
27+
; CHECK-NEXT: 144 152
28+
; CHECK-NEXT: /t.cpp:8
29+
; CHECK-EMPTY:
30+
31+
; FIXME: fix the wrong size 152
32+
; CHECK: beta
33+
; CHECK-NEXT: 148 152
34+
; CHECK-NEXT: /t.cpp:13
35+
; CHECK-EMPTY:
36+
37+
; FIXME: fix the wrong size 152
38+
; CHECK: alpha
39+
; CHECK-NEXT: 152 152
40+
; CHECK-NEXT: /t.cpp:12
41+
; CHECK-EMPTY:
42+
43+
; The case is from `test/tools/llvm-symbolizer/data-location.yaml`, compiled with:
44+
; clang++ -g -gdwarf-3 -O3 t.cpp -nostdlib -target powerpc-aix-ibm-xcoff -S -emit-llvm
45+
46+
; cat t.cpp
47+
; 1 int bss_global;
48+
; 2 int data_global = 2;
49+
; 3
50+
; 4 const char* str =
51+
; 5 "12345678";
52+
; 6
53+
; 7 int* f() {
54+
; 8 static int function_global;
55+
; 9 return &function_global;
56+
; 10 }
57+
; 11
58+
; 12 static int alpha;
59+
; 13 static int beta;
60+
; 14 int *f(bool b) { return beta ? &alpha : &beta; }
61+
; 15
62+
63+
; ModuleID = 't.cpp'
64+
source_filename = "t.cpp"
65+
target datalayout = "E-m:a-p:32:32-Fi32-i64:64-n32"
66+
target triple = "powerpc-ibm-aix-xcoff"
67+
68+
@bss_global = local_unnamed_addr global i32 0, align 4, !dbg !0
69+
@data_global = local_unnamed_addr global i32 2, align 4, !dbg !5
70+
@.str = private unnamed_addr constant [9 x i8] c"12345678\00", align 1, !dbg !8
71+
@str = local_unnamed_addr global ptr @.str, align 4, !dbg !15
72+
@_ZZ1fvE15function_global = internal global i32 0, align 4, !dbg !18
73+
@_ZL4beta = internal global i32 0, align 4, !dbg !24
74+
@_ZL5alpha = internal global i32 0, align 4, !dbg !26
75+
76+
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
77+
define noundef nonnull ptr @_Z1fv() local_unnamed_addr #0 !dbg !20 {
78+
entry:
79+
ret ptr @_ZZ1fvE15function_global, !dbg !34
80+
}
81+
82+
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none)
83+
define noundef nonnull ptr @_Z1fb(i1 noundef zeroext %b) local_unnamed_addr #1 !dbg !35 {
84+
entry:
85+
call void @llvm.dbg.value(metadata i1 %b, metadata !40, metadata !DIExpression(DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value)), !dbg !41
86+
%0 = load i32, ptr @_ZL4beta, align 4, !dbg !42, !tbaa !43
87+
%tobool.not = icmp eq i32 %0, 0, !dbg !42
88+
%cond = select i1 %tobool.not, ptr @_ZL4beta, ptr @_ZL5alpha, !dbg !42
89+
ret ptr %cond, !dbg !42
90+
}
91+
92+
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
93+
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
94+
95+
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="pwr7" "target-features"="+altivec,+bpermd,+extdiv,+isa-v206-instructions,+vsx,-aix-small-local-exec-tls,-crbits,-crypto,-direct-move,-htm,-isa-v207-instructions,-isa-v30-instructions,-power8-vector,-power9-vector,-privileged,-quadword-atomics,-rop-protect,-spe" }
96+
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="pwr7" "target-features"="+altivec,+bpermd,+extdiv,+isa-v206-instructions,+vsx,-aix-small-local-exec-tls,-crbits,-crypto,-direct-move,-htm,-isa-v207-instructions,-isa-v30-instructions,-power8-vector,-power9-vector,-privileged,-quadword-atomics,-rop-protect,-spe" }
97+
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
98+
99+
!llvm.dbg.cu = !{!2}
100+
!llvm.module.flags = !{!28, !29, !30, !31, !32}
101+
!llvm.ident = !{!33}
102+
103+
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
104+
!1 = distinct !DIGlobalVariable(name: "bss_global", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)
105+
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 18.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
106+
!3 = !DIFile(filename: "t.cpp", directory: "/")
107+
!4 = !{!0, !5, !8, !15, !18, !24, !26}
108+
!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
109+
!6 = distinct !DIGlobalVariable(name: "data_global", scope: !2, file: !3, line: 2, type: !7, isLocal: false, isDefinition: true)
110+
!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
111+
!8 = !DIGlobalVariableExpression(var: !9, expr: !DIExpression())
112+
!9 = distinct !DIGlobalVariable(scope: null, file: !3, line: 5, type: !10, isLocal: true, isDefinition: true)
113+
!10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 72, elements: !13)
114+
!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12)
115+
!12 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
116+
!13 = !{!14}
117+
!14 = !DISubrange(count: 9)
118+
!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
119+
!16 = distinct !DIGlobalVariable(name: "str", scope: !2, file: !3, line: 4, type: !17, isLocal: false, isDefinition: true)
120+
!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 32)
121+
!18 = !DIGlobalVariableExpression(var: !19, expr: !DIExpression())
122+
!19 = distinct !DIGlobalVariable(name: "function_global", scope: !20, file: !3, line: 8, type: !7, isLocal: true, isDefinition: true)
123+
!20 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", scope: !3, file: !3, line: 7, type: !21, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2)
124+
!21 = !DISubroutineType(types: !22)
125+
!22 = !{!23}
126+
!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32)
127+
!24 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression())
128+
!25 = distinct !DIGlobalVariable(name: "beta", linkageName: "_ZL4beta", scope: !2, file: !3, line: 13, type: !7, isLocal: true, isDefinition: true)
129+
!26 = !DIGlobalVariableExpression(var: !27, expr: !DIExpression())
130+
!27 = distinct !DIGlobalVariable(name: "alpha", linkageName: "_ZL5alpha", scope: !2, file: !3, line: 12, type: !7, isLocal: true, isDefinition: true)
131+
!28 = !{i32 7, !"Dwarf Version", i32 3}
132+
!29 = !{i32 2, !"Debug Info Version", i32 3}
133+
!30 = !{i32 1, !"wchar_size", i32 2}
134+
!31 = !{i32 8, !"PIC Level", i32 2}
135+
!32 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
136+
!33 = !{!"clang version 18.0.0"}
137+
!34 = !DILocation(line: 9, scope: !20)
138+
!35 = distinct !DISubprogram(name: "f", linkageName: "_Z1fb", scope: !3, file: !3, line: 14, type: !36, scopeLine: 14, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !39)
139+
!36 = !DISubroutineType(types: !37)
140+
!37 = !{!23, !38}
141+
!38 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean)
142+
!39 = !{!40}
143+
!40 = !DILocalVariable(name: "b", arg: 1, scope: !35, file: !3, line: 14, type: !38)
144+
!41 = !DILocation(line: 0, scope: !35)
145+
!42 = !DILocation(line: 14, scope: !35)
146+
!43 = !{!44, !44, i64 0}
147+
!44 = !{!"int", !45, i64 0}
148+
!45 = !{!"omnipotent char", !46, i64 0}
149+
!46 = !{!"Simple C++ TBAA"}

llvm/test/DebugInfo/Symbolize/XCOFF/xcoff.test

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)