150
|
1 # REQUIRES: mips
|
|
2 # Check R_MIPS_32 relocation calculation.
|
|
3
|
|
4 # RUN: echo "SECTIONS { \
|
|
5 # RUN: . = 0x10000; .data ALIGN(0x1000) : { *(.data) } \
|
|
6 # RUN: }" > %t.script
|
|
7
|
|
8 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-be.o
|
|
9 # RUN: ld.lld -shared %t-be.o -script %t.script -o %t-be.so
|
173
|
10 # RUN: llvm-objdump -t -s %t-be.so | FileCheck --check-prefixes=SYM,BE %s
|
150
|
11 # RUN: llvm-readelf -r -s --dynamic-table -A %t-be.so \
|
|
12 # RUN: | FileCheck -check-prefix=REL %s
|
|
13
|
|
14 # RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o
|
|
15 # RUN: ld.lld -shared %t-el.o -script %t.script -o %t-el.so
|
173
|
16 # RUN: llvm-objdump -t -s %t-el.so | FileCheck --check-prefixes=SYM,EL %s
|
|
17 # RUN: llvm-readelf --dynamic-table -r -s -A %t-el.so \
|
150
|
18 # RUN: | FileCheck -check-prefix=REL %s
|
|
19
|
|
20 .data
|
|
21 .globl v2
|
|
22 v1:
|
|
23 .word v2+4 # R_MIPS_32 target v2 addend 4
|
|
24 v2:
|
|
25 .word v1 # R_MIPS_32 target v1 addend 0
|
|
26
|
|
27 # SYM: SYMBOL TABLE:
|
173
|
28 # SYM: 00011000 l .data 00000000 v1
|
150
|
29
|
|
30 # BE: Contents of section .data:
|
|
31 # BE-NEXT: {{.*}} 00000004 00011000
|
|
32 # ^-- v2+4 ^-- v1
|
|
33
|
|
34 # EL: Contents of section .data:
|
|
35 # EL-NEXT: {{.*}} 04000000 00100100
|
|
36 # ^-- v2+4 ^-- v1
|
173
|
37
|
|
38 # REL: Dynamic section
|
|
39 # REL: (RELSZ) 16
|
|
40 # REL: (RELENT) 8
|
|
41 # REL-NOT: (RELCOUNT)
|
|
42
|
150
|
43 # REL: Relocation section
|
|
44 # REL: {{.*}} R_MIPS_REL32
|
|
45 # REL-NEXT: {{.*}} R_MIPS_REL32 [[V2:[0-9a-f]+]]
|
|
46
|
|
47 # REL: Symbol table
|
|
48 # REL: {{.*}}: [[V2]] {{.*}} v2
|
|
49
|
|
50 # REL: Global entries
|
|
51 # REL: {{.*}} -32744(gp) [[V2]] {{.*}} v2
|