[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / mips-got16.s
blob5492f1ca94ede053d1b6a3b95284fa6f26b2d890
1 # REQUIRES: mips
2 # Check R_MIPS_GOT16 relocation calculation.
4 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
5 # RUN: echo "SECTIONS { \
6 # RUN: . = 0x1000; .text ALIGN(0x1000) : { *(.text) } \
7 # RUN: . = 0x3000; .data : { *(.data) } \
8 # RUN: }" > %t.script
9 # RUN: ld.lld %t.o -shared --script %t.script -o %t.so
10 # RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.so | FileCheck %s
11 # RUN: llvm-readelf -r -A %t.so | FileCheck -check-prefix=GOT %s
13 # CHECK: SYMBOL TABLE:
14 # CHECK: 00024008 l .data 00000000 .hidden bar
15 # CHECK: 00000000 *UND* 00000000 foo
17 # CHECK: <__start>:
18 # CHECK-NEXT: lw $8, -32744($gp)
19 # CHECK-NEXT: addi $8, $8, 8236
20 # CHECK-NEXT: lw $8, -32732($gp)
21 # CHECK-NEXT: addi $8, $8, -16384
22 # CHECK-NEXT: lw $8, -32728($gp)
23 # CHECK-NEXT: addi $8, $8, -16380
24 # CHECK-NEXT: lw $8, -32728($gp)
25 # CHECK-NEXT: addi $8, $8, 16388
26 # CHECK-NEXT: lw $8, -32720($gp)
27 # CHECK-NEXT: addi $8, $8, 16392
28 # CHECK-NEXT: lw $8, -32716($gp)
30 # GOT: There are no relocations in this file.
32 # GOT: Local entries:
33 # GOT-NEXT: Access Initial
34 # GOT-NEXT: -32744(gp) 00000000
35 # ^-- (0x2000 + 0x8000) & ~0xffff
36 # GOT-NEXT: -32740(gp) 00010000
37 # ^-- redundant unused entry
38 # GOT-NEXT: -32736(gp) 00000000
39 # ^-- redundant unused entry
40 # GOT-NEXT: -32732(gp) 00010000
41 # ^-- (0x3000 + 0x9000 + 0x8000) & ~0xffff
42 # GOT-NEXT: -32728(gp) 00020000
43 # ^-- (0x3000 + 0x9000 + 0x10004 + 0x8000) & ~0xffff
44 # ^-- (0x3000 + 0x9000 + 0x18004 + 0x8000) & ~0xffff
45 # GOT-NEXT: -32724(gp) 00030000
46 # ^-- redundant unused entry
47 # GOT-NEXT: -32720(gp) 00024008
48 # ^-- 'bar' address
49 # GOT-EMPTY:
50 # GOT-NEXT: Global entries:
51 # GOT-NEXT: Access Initial Sym.Val. Type Ndx Name
52 # GOT-NEXT: -32716(gp) 00000000 00000000 NOTYPE UND foo
54 .text
55 .globl __start
56 __start:
57 lw $t0,%got($LC0)($gp)
58 addi $t0,$t0,%lo($LC0)
59 lw $t0,%got($LC1)($gp)
60 addi $t0,$t0,%lo($LC1)
61 lw $t0,%got($LC1+0x10004)($gp)
62 addi $t0,$t0,%lo($LC1+0x10004)
63 lw $t0,%got($LC1+0x18004)($gp)
64 addi $t0,$t0,%lo($LC1+0x18004)
65 lw $t0,%got(bar)($gp)
66 addi $t0,$t0,%lo(bar)
67 lw $t0,%got(foo)($gp)
68 $LC0:
69 nop
71 .data
72 .space 0x9000
73 $LC1:
74 .word 0
75 .space 0x18000
76 .word 0
77 .global bar
78 .hidden bar
79 bar:
80 .word 0