sparc-pic.s
3.49 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
102
103
! RUN: llvm-mc %s -arch=sparcv9 --position-independent -filetype=obj | llvm-readobj -r | FileCheck --check-prefix=PIC %s
! RUN: llvm-mc %s -arch=sparcv9 -filetype=obj | llvm-readobj -r | FileCheck --check-prefix=NOPIC %s
! PIC: Relocations [
! PIC-NOT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
! PIC: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT22 AGlobalVar 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT10 AGlobalVar 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT22 AGlobalVar 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT10 AGlobalVar 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT22 .LC0 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOT10 .LC0 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 bar 0x0
! PIC: 0x{{[0-9,A-F]+}} R_SPARC_GOT13 value 0x0
! PIC: ]
! NOPIC: Relocations [
! NOPIC-NOT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
! NOPIC: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x4
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x8
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 AGlobalVar 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 AGlobalVar 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 AGlobalVar 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 AGlobalVar 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 .rodata 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 .rodata 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_WDISP30 bar 0x0
! NOPIC: 0x{{[0-9,A-F]+}} R_SPARC_13 value 0x0
! NOPIC: ]
.section ".rodata"
.align 8
.LC0:
.asciz "string"
.section ".text"
.text
.globl foo
.align 4
.type foo,@function
foo:
.cfi_startproc
save %sp, -176, %sp
.cfi_def_cfa_register %fp
.cfi_window_save
.cfi_register 15, 31
.Ltmp4:
call .Ltmp5
.Ltmp6:
sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp6-.Ltmp4)), %i1
.Ltmp5:
or %i1, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp5-.Ltmp4)), %i1
set _GLOBAL_OFFSET_TABLE_, %i1
add %i1, %o7, %i1
sethi %hi(AGlobalVar), %i2
add %i2, %lo(AGlobalVar), %i2
set AGlobalVar, %i2
ldx [%i1+%i2], %i3
ldx [%i3], %i3
sethi %hi(.LC0), %i2
add %i2, %lo(.LC0), %i2
ldx [%i1+%i2], %i4
call bar
add %i0, %i1, %o0
ret
restore %g0, %o0, %o0
.Ltmp7:
.size foo, .Ltmp7-foo
.cfi_endproc
.type AGlobalVar,@object ! @AGlobalVar
.section .bss,#alloc,#write
.globl AGlobalVar
.align 8
AGlobalVar:
.xword 0 ! 0x0
.size AGlobalVar, 8
.section ".text"
.text
.globl pic13
.align 4
.type pic13,@function
pic13:
save %sp, -128, %sp
.Ltmp0:
call .Ltmp1
.Ltmp2:
sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp2-.Ltmp0)), %i0
.Ltmp1:
or %i0, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp1-.Ltmp0)), %i0
add %i0, %o7, %i0
ldx [%i0+value], %i0
ld [%i0], %i0
ret
restore
.Lfunc_end0:
.size pic13, .Lfunc_end0-pic13