eh-frame.s
5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Test the bits of .eh_frame on mips that are already implemented correctly.
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips-unknown-linux-gnu
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,ABS32 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF32,DWARF32_ABS %s
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mipsel-unknown-linux-gnu
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,ABS32 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF32,DWARF32_ABS %s
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips64-unknown-linux-gnu
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,ABS64 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF64,DWARF64_ABS %s
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips64el-unknown-linux-gnu
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,ABS64 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF64,DWARF64_ABS %s
/// Check that position-indenpendent code use PC-relative relocations:
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips-unknown-linux-gnu --position-independent
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,PIC32 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF32,DWARF32_PIC %s
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mipsel-unknown-linux-gnu --position-independent
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,PIC32 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF32,DWARF32_PIC %s
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips64-unknown-linux-gnu --position-independent
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,PIC64 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF64,DWARF64_PIC %s
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips64el-unknown-linux-gnu --position-independent
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,PIC64 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF64,DWARF64_PIC %s
/// However using the large code model forces R_MIPS_64 since there is no R_MIPS_PC64 relocation:
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips64-unknown-linux-gnu --position-independent --large-code-model
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,ABS64 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF64,DWARF64_ABS %s
// RUN: llvm-mc -filetype=obj %s -o %t.o -triple mips64el-unknown-linux-gnu --position-independent --large-code-model
// RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS,ABS64 %s
// RUN: llvm-dwarfdump -eh-frame %t.o | FileCheck --check-prefixes=DWARF64,DWARF64_ABS %s
func:
.cfi_startproc
.cfi_endproc
// RELOCS: Relocations [
// RELOCS: Section ({{.+}}) .rel{{a?}}.eh_frame {
// ABS32-NEXT: R_MIPS_32
// ABS64-NEXT: R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE
// PIC32-NEXT: R_MIPS_PC32
// PIC64-NEXT: R_MIPS_PC32/R_MIPS_NONE/R_MIPS_NONE
// RELOCS-NEXT: }
// DWARF32: 00000000 00000010 00000000 CIE
// DWARF32-NEXT: Format: DWARF32
// DWARF32-NEXT: Version: 1
// DWARF32-NEXT: Augmentation: "zR"
// DWARF32-NEXT: Code alignment factor: 1
// DWARF32-NEXT: Data alignment factor: -4
// DWARF32-NEXT: Return address column: 31
// DWARF32_ABS-NEXT: Augmentation data: 0B
// ^^ fde pointer encoding: DW_EH_PE_sdata4
// DWARF32_PIC-NEXT: Augmentation data: 1B
// ^^ fde pointer encoding: DW_EH_PE_pcrel | DW_EH_PE_sdata4
// DWARF32-EMPTY:
// DWARF32-NEXT: DW_CFA_def_cfa_register: reg29
//
// DWARF32_ABS: 00000014 00000010 00000018 FDE cie=00000000 pc=00000000...00000000
// DWARF32_PIC: 00000014 00000010 00000018 FDE cie=00000000 pc=0000001c...0000001c
// DWARF32-NEXT: Format: DWARF32
// DWARF32-NEXT: DW_CFA_nop:
// DWARF32-NEXT: DW_CFA_nop:
// DWARF32-NEXT: DW_CFA_nop:
// DWARF64: 00000000 00000010 00000000 CIE
// DWARF64-NEXT: Format: DWARF32
// DWARF64-NEXT: Version: 1
// DWARF64-NEXT: Augmentation: "zR"
// DWARF64-NEXT: Code alignment factor: 1
// DWARF64-NEXT: Data alignment factor: -8
// ^^ GAS uses -4. Should be ok as long as
// all offsets we need are a multiple of 8.
// DWARF64-NEXT: Return address column: 31
// DWARF64_ABS-NEXT: Augmentation data: 0C
// ^^ fde pointer encoding: DW_EH_PE_sdata8
// DWARF64_PIC: Augmentation data: 1B
// ^^ fde pointer encoding: DW_EH_PE_pcrel | DW_EH_PE_sdata4
// DWARF64-EMPTY:
// DWARF64-NEXT: DW_CFA_def_cfa_register: reg29
// DWARF64_PIC-NEXT: DW_CFA_nop:
//
// DWARF64_ABS: 00000014 00000018 00000018 FDE cie=00000000 pc=00000000...00000000
// DWARF64_PIC: 00000014 00000010 00000018 FDE cie=00000000 pc=00000000...00000000
// DWARF64-NEXT: Format: DWARF32
// DWARF64-NEXT: DW_CFA_nop:
// DWARF64-NEXT: DW_CFA_nop:
// DWARF64-NEXT: DW_CFA_nop: