Skip to content

Commit 49295d8

Browse files
MaskRayIanWood1
authored andcommitted
Sparc: Reorganize relocation and ELF tests
Following the subdirectory schemes of newer ports (LoongArch, M68k).
1 parent 34ad01c commit 49295d8

File tree

11 files changed

+74
-66
lines changed

11 files changed

+74
-66
lines changed

llvm/test/MC/Sparc/sparc-pic.s renamed to llvm/test/MC/Sparc/Relocations/relocation-specifier-pic.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
## Test relocation specifiers with different behaviors with non-PIC and PIC.
12
! RUN: llvm-mc %s -triple=sparcv9 --position-independent -filetype=obj | llvm-readobj -r - | FileCheck --check-prefix=PIC %s
23
! RUN: llvm-mc %s -triple=sparcv9 -filetype=obj | llvm-readobj -r - | FileCheck --check-prefix=NOPIC %s
34

4-
55
! PIC: .rela.text {
66
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
77
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8

llvm/test/MC/Sparc/relocation-specifier.s renamed to llvm/test/MC/Sparc/Relocations/relocation-specifier.s

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,41 @@ sethi %gdop_hix22(sym), %l1
8888
or %l1, %gdop_lox10(sym), %l1
8989
ldx [%l7 + %l1], %l2, %gdop(sym)
9090

91+
.set abs, 0xfedcba98
92+
93+
## FIXME: Don't emit GOT relocations when -position-independent is specified.
94+
# NOPIC: sethi 0x3fb72e, %o0
95+
# NOPIC-NEXT: xor %o0, 0x298, %o0
96+
# NOPIC-NEXT: sethi 0x3b72ea, %o1
97+
# NOPIC-NEXT: xor %o0, 0x188, %o1
98+
sethi %hi(abs), %o0
99+
xor %o0, %lo(abs), %o0
100+
sethi %hi(-0x12345678), %o1
101+
xor %o0, %lo(-0x12345678), %o1
102+
103+
# OBJDUMP: ld [%o0+0x7], %o0
104+
ld [%o0 + seven], %o0
105+
seven = 7
106+
107+
# OBJDUMP: sethi 0x3fb, %o0
108+
# OBJDUMP-NEXT: or %o0, 0x1cb, %o0
109+
# OBJDUMP-NEXT: ld [%o0+0xa98], %o0
110+
sethi %h44(abs), %o0
111+
or %o0, %m44(abs), %o0
112+
ld [%o0 + %l44(abs)], %o0
113+
114+
# OBJDUMP-NEXT: sethi 0x0, %o0
115+
# OBJDUMP-NEXT: sethi 0x3fb72e, %o0
116+
# OBJDUMP-NEXT: or %o0, 0x0, %o0
117+
sethi %hh(abs), %o0
118+
sethi %lm(abs), %o0
119+
or %o0, %hm(abs), %o0
120+
121+
# OBJDUMP-NEXT: sethi 0x48d1, %o0
122+
# OBJDUMP-NEXT: xor %o0, -0x168, %o0
123+
sethi %hix(abs), %o0
124+
xor %o0, %lox(abs), %o0
125+
91126
# OBJDUMP-LABEL: <.tls>:
92127
.section .tls,"ax"
93128
## Local Executable model:
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Test relocations without specifiers. See also relocation-specifier.s for relocations with specifiers.
2+
# RUN: llvm-mc %s -triple=sparcv9 | FileCheck %s --check-prefix=ASM
3+
# RUN: llvm-mc %s -triple=sparcv9 -filetype=obj -o %t
4+
# RUN: llvm-objdump -dr %t | FileCheck %s --check-prefix=OBJDUMP
5+
6+
# ASM: call local
7+
# ASM: call local1
8+
# ASM-NEXT: call undef
9+
# OBJDUMP: call 0x14
10+
# OBJDUMP-NEXT: call 0x0
11+
# OBJDUMP-NEXT: R_SPARC_WDISP30 .text1+0x4
12+
# OBJDUMP-NEXT: call 0x0
13+
# OBJDUMP-NEXT: R_SPARC_WDISP30 undef{{$}}
14+
call local
15+
call local1
16+
call undef
17+
18+
# ASM: or %g1, sym, %g3
19+
# ASM-NEXT: or %g1, sym+4, %g3
20+
# OBJDUMP: or %g1, 0x0, %g3
21+
# OBJDUMP-NEXT: 0000000c: R_SPARC_13 sym{{$}}
22+
# OBJDUMP-NEXT: or %g1, 0x0, %g3
23+
# OBJDUMP-NEXT: 00000010: R_SPARC_13 sym+0x4
24+
or %g1, sym, %g3
25+
or %g1, (sym+4), %g3
26+
27+
local:
28+
29+
.section .text1,"ax"
30+
nop
31+
local1:
32+
33+
.data
34+
# This test needs to placed last in the file
35+
# ASM: .half a-.Ltmp0
36+
.half a - .
37+
.byte a - .
38+
a:

llvm/test/MC/Sparc/sparc-fixups.s

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

llvm/test/MC/Sparc/sparc-relocations.s

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

0 commit comments

Comments
 (0)