Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / mips-xgot-order.s
blobe66a5fd2235db712ffa627265589d8a3db011e9e
1 # REQUIRES: mips
2 # Check that GOT entries accessed via 16-bit indexing are allocated
3 # in the beginning of the GOT.
5 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
6 # RUN: ld.lld %t.o -o %t.exe
7 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.exe | FileCheck %s
8 # RUN: llvm-readelf -s -A %t.exe | FileCheck -check-prefix=GOT %s
10 # CHECK: Disassembly of section .text:
11 # CHECK-EMPTY:
12 # CHECK-NEXT: <__start>:
13 # CHECK-NEXT: lui $2, 0
14 # CHECK-NEXT: lw $2, -32732($2)
15 # CHECK-NEXT: lui $2, 0
16 # CHECK-NEXT: lw $2, -32728($2)
18 # CHECK: <bar>:
19 # CHECK-NEXT: lw $2, -32736($2)
20 # CHECK-NEXT: lw $2, -32744($2)
21 # CHECK-NEXT: addi $2, $2, {{.*}}
23 # GOT: Symbol table '.symtab'
24 # GOT: Num: Value Size Type Bind Vis Ndx Name
25 # GOT: [[LOC:[0-9a-f]+]] 0 NOTYPE LOCAL DEFAULT 4 loc
26 # GOT: [[START:[0-9a-f]+]] 0 NOTYPE GLOBAL DEFAULT 3 __start
27 # GOT: [[BAR:[0-9a-f]+]] 0 NOTYPE GLOBAL DEFAULT 3 bar
29 # GOT: Static GOT:
30 # GOT: Local entries:
31 # GOT: Address Access Initial
32 # GOT-NEXT: -32744(gp) 00030000
33 # GOT-NEXT: -32740(gp) 00040000
34 # GOT-NEXT: -32736(gp) [[BAR]]
35 # GOT-NEXT: -32732(gp) [[START]]
36 # GOT-NEXT: -32728(gp) [[LOC]]
38 .text
39 .global __start, bar
40 __start:
41 lui $2, %got_hi(__start)
42 lw $2, %got_lo(__start)($2)
43 lui $2, %got_hi(loc)
44 lw $2, %got_lo(loc)($2)
45 bar:
46 lw $2, %got(bar)($2)
47 lw $2, %got(loc)($2)
48 addi $2, $2, %lo(loc)
50 .data
51 loc:
52 .word 0