llvm.org GIT mirror llvm / 4d130cb
[Sparc] Add support for parsing DW_CFA_GNU_window_save. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200127 91177308-0d34-0410-b5e6-96231b3b80d8 Venkatraman Govindaraju 6 years ago
4 changed file(s) with 112 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
122122 HasError = true;
123123 return RelocToApply();
124124 }
125 } else if (FileFormat == "ELF32-sparc") {
126 switch (RelocType) {
127 case llvm::ELF::R_SPARC_32:
128 case llvm::ELF::R_SPARC_UA32:
129 return visitELF_SPARC_32(R, Value);
130 default:
131 HasError = true;
132 return RelocToApply();
133 }
134 } else if (FileFormat == "ELF64-sparc") {
135 switch (RelocType) {
136 case llvm::ELF::R_SPARC_32:
137 case llvm::ELF::R_SPARC_UA32:
138 return visitELF_SPARCV9_32(R, Value);
139 case llvm::ELF::R_SPARC_64:
140 case llvm::ELF::R_SPARC_UA64:
141 return visitELF_SPARCV9_64(R, Value);
142 default:
143 HasError = true;
144 return RelocToApply();
145 }
125146 }
126147 HasError = true;
127148 return RelocToApply();
271292 int64_t Addend = getAddend64BE(R);
272293 return RelocToApply(Value + Addend, 8);
273294 }
295
296 RelocToApply visitELF_SPARC_32(RelocationRef R, uint32_t Value) {
297 int32_t Addend = getAddend32BE(R);
298 return RelocToApply(Value + Addend, 4);
299 }
300
301 RelocToApply visitELF_SPARCV9_32(RelocationRef R, uint64_t Value) {
302 int32_t Addend = getAddend64BE(R);
303 return RelocToApply(Value + Addend, 4);
304 }
305
306 RelocToApply visitELF_SPARCV9_64(RelocationRef R, uint64_t Value) {
307 int64_t Addend = getAddend64BE(R);
308 return RelocToApply(Value + Addend, 8);
309 }
310
274311 };
275312
276313 }
124124 case DW_CFA_nop:
125125 case DW_CFA_remember_state:
126126 case DW_CFA_restore_state:
127 case DW_CFA_GNU_window_save:
127128 // No operands
128129 addInstruction(Opcode);
129130 break;
0 ; RUN: llc -filetype=obj -O0 < %s -mtriple sparc64-unknown-linux-gnu | llvm-dwarfdump - | FileCheck %s --check-prefix=SPARC64
1 ; RUN: llc -filetype=obj -O0 < %s -mtriple sparc-unknown-linux-gnu | llvm-dwarfdump - | FileCheck %s --check-prefix=SPARC32
2
3 ; Check for DW_CFA_GNU_Window_save in debug_frame. Also, Ensure that relocations
4 ; are performed correctly in debug_info.
5
6 ; SPARC64: file format ELF64-sparc
7
8 ; SPARC64: .debug_info
9 ; SPARC64: DW_TAG_compile_unit
10 ; SPARC64: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9,A-F,a-f]+}}] = "hello.c")
11 ; SPARC64: DW_TAG_subprogram
12 ; SPARC64: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9,A-F,a-f]+}}] = "main")
13 ; SPARC64: DW_TAG_base_type
14 ; SPARC64: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9,A-F,a-f]+}}] = "int")
15
16 ; SPARC64: .debug_frame
17 ; SPARC64: DW_CFA_def_cfa_register
18 ; SPARC64-NEXT: DW_CFA_GNU_window_save
19 ; SPARC64-NEXT: DW_CFA_register
20
21
22 ; SPARC32: file format ELF32-sparc
23
24 ; SPARC32: .debug_info
25 ; SPARC32: DW_TAG_compile_unit
26 ; SPARC32: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9,A-F,a-f]+}}] = "hello.c")
27 ; SPARC32: DW_TAG_subprogram
28 ; SPARC32: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9,A-F,a-f]+}}] = "main")
29 ; SPARC32: DW_TAG_base_type
30 ; SPARC32: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9,A-F,a-f]+}}] = "int")
31
32 ; SPARC32: .debug_frame
33 ; SPARC32: DW_CFA_def_cfa_register
34 ; SPARC32-NEXT: DW_CFA_GNU_window_save
35 ; SPARC32-NEXT: DW_CFA_register
36
37 @.str = private unnamed_addr constant [14 x i8] c"hello, world\0A\00", align 1
38
39 ; Function Attrs: nounwind
40 define signext i32 @main() #0 {
41 entry:
42 %retval = alloca i32, align 4
43 store i32 0, i32* %retval
44 %call = call signext i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)), !dbg !12
45 ret i32 0, !dbg !13
46 }
47
48 declare signext i32 @printf(i8*, ...) #1
49
50 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
51 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
52
53 !llvm.dbg.cu = !{!0}
54 !llvm.module.flags = !{!9, !10}
55 !llvm.ident = !{!11}
56
57 !0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.5 (http://llvm.org/git/clang.git 6a0714fee07fb7c4e32d3972b4fe2ce2f5678cf4) (llvm/ 672e88e934757f76d5c5e5258be41e7615094844)", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/home/venkatra/work/benchmarks/test/hello/hello.c] [DW_LANG_C99]
58 !1 = metadata !{metadata !"hello.c", metadata !"/home/venkatra/work/benchmarks/test/hello"}
59 !2 = metadata !{i32 0}
60 !3 = metadata !{metadata !4}
61 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 3, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !2, i32 4} ; [ DW_TAG_subprogram ] [line 3] [def] [scope 4] [main]
62 !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/home/venkatra/work/benchmarks/test/hello/hello.c]
63 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
64 !7 = metadata !{metadata !8}
65 !8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
66 !9 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
67 !10 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
68 !11 = metadata !{metadata !"clang version 3.5 (http://llvm.org/git/clang.git 6a0714fee07fb7c4e32d3972b4fe2ce2f5678cf4) (llvm/ 672e88e934757f76d5c5e5258be41e7615094844)"}
69 !12 = metadata !{i32 5, i32 0, metadata !4, null}
70 !13 = metadata !{i32 6, i32 0, metadata !4, null}
0 targets = set(config.root.targets_to_build.split())
1 if not 'Sparc' in targets:
2 config.unsupported = True