xref: /llvm-project/lld/test/ELF/mips-64.s (revision 3736d0854a003ef7896a23014857a76472128342)
1# REQUIRES: mips
2# Check R_MIPS_64 relocation calculation.
3
4# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t-be.o
5# RUN: ld.lld -shared %t-be.o -o %t-be.so
6# RUN: llvm-objdump -s -t %t-be.so | FileCheck --check-prefixes=SYM,SYM-BE %s
7# RUN: llvm-readelf --dynamic-table -r -s -A %t-be.so | FileCheck %s
8
9# RUN: llvm-mc -filetype=obj -triple=mips64el-unknown-linux %s -o %t-el.o
10# RUN: ld.lld -shared %t-el.o -o %t-el.so
11# RUN: llvm-objdump -s -t %t-el.so | FileCheck --check-prefixes=SYM,SYM-EL %s
12# RUN: llvm-readelf --dynamic-table -r -s -A %t-el.so | FileCheck %s
13
14  .data
15  .globl v2
16v1:
17  .quad v2+8 # R_MIPS_64 target v2 addend 8
18v2:
19  .quad v1   # R_MIPS_64 target v1 addend 0
20
21# SYM: SYMBOL TABLE:
22# SYM: 00000000000203b0 l .data  0000000000000000 v1
23
24# SYM-BE: Contents of section .data:
25# SYM-BE-NEXT:  {{.*}} 00000000 00000008 00000000 000203b0
26
27# SYM-EL: Contents of section .data:
28# SYM-EL-NEXT:  {{.*}} 08000000 00000000 b0030200 00000000
29
30# CHECK: Dynamic section
31# CHECK: (RELSZ)   32 (bytes)
32# CHECK: (RELENT)  16 (bytes)
33
34# CHECK: Relocation section
35# CHECK:      [[V1:[0-9a-f]+]]  {{.*}} R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE [[V2:[0-9a-f]+]] v2
36# CHECK-NEXT: [[V2]]            {{.*}} R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE {{$}}
37
38# CHECK: Symbol table '.symtab'
39# CHECK: {{.*}}: [[V1]]  {{.*}}  v1
40# CHECK: {{.*}}: [[V2]]  {{.*}}  v2
41
42# CHECK: Primary GOT:
43# CHECK:  Global entries:
44# CHECK:   {{.*}} -32736(gp) [[V2]] [[V2]] {{.*}} v2
45