Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / mips-got-relocs.s
blob6d8b00eab1b2337c6af01de27e30f5dc590cbb2d
1 # REQUIRES: mips
2 # Check R_MIPS_GOT16 relocation calculation.
4 # RUN: echo "SECTIONS { \
5 # RUN: . = 0x20000; .text : { *(.text) } \
6 # RUN: . = 0x30000; .got : { *(.got) } \
7 # RUN: }" > %t.script
9 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-be.o
10 # RUN: ld.lld %t-be.o --script %t.script -o %t-be.exe
11 # RUN: llvm-readobj --sections -r --symbols -A %t-be.exe \
12 # RUN: | FileCheck -check-prefix=ELF %s
13 # RUN: llvm-objdump --no-print-imm-hex -d %t-be.exe | FileCheck --check-prefix=DIS %s
15 # RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o
16 # RUN: ld.lld %t-el.o --script %t.script -o %t-el.exe
17 # RUN: llvm-readobj --sections -r --symbols -A %t-el.exe \
18 # RUN: | FileCheck -check-prefix=ELF %s
19 # RUN: llvm-objdump --no-print-imm-hex -d %t-el.exe | FileCheck --check-prefix=DIS %s
21 # RUN: ld.lld -shared %t-be.o --script %t.script -o %t-be.so
22 # RUN: llvm-readobj --sections -r --symbols -A %t-be.so \
23 # RUN: | FileCheck -check-prefix=ELF %s
24 # RUN: llvm-objdump --no-print-imm-hex -d %t-be.so | FileCheck --check-prefix=DIS %s
26 # RUN: ld.lld -shared %t-el.o --script %t.script -o %t-el.so
27 # RUN: llvm-readobj --sections -r --symbols -A %t-el.so \
28 # RUN: | FileCheck -check-prefix=ELF %s
29 # RUN: llvm-objdump --no-print-imm-hex -d %t-el.so | FileCheck --check-prefix=DIS %s
31 .text
32 .globl __start
33 __start:
34 lui $2, %got(v1)
36 .data
37 .globl v1
38 v1:
39 .word 0
41 # ELF: Section {
42 # ELF: Name: .got
43 # ELF: Flags [
44 # ELF-NEXT: SHF_ALLOC
45 # ELF-NEXT: SHF_MIPS_GPREL
46 # ELF-NEXT: SHF_WRITE
47 # ELF-NEXT: ]
49 # ELF: Relocations [
50 # ELF-NEXT: ]
52 # ELF: Symbol {
53 # ELF: Name: v1
54 # ELF-NEXT: Value: 0x[[V1:[0-9A-F]+]]
56 # ELF: {{.*}} GOT {
57 # ELF-NEXT: Canonical gp value: 0x37FF0
59 # ELF: Entry {
60 # ELF: Address: 0x30008
61 # ELF-NEXT: Access: -32744
62 # ELF-NEXT: Initial: 0x[[V1]]
64 # "v1 GOT entry address" - _gp
65 # 0x30008 - 0x37FF0 = -0x7fe8 == 0x8018 == 32792
66 # DIS: lui $2, 32792