2018-06-27 00:58:19 +08:00
|
|
|
# REQUIRES: mips
|
2016-05-05 01:47:11 +08:00
|
|
|
# Check MIPS N64 ABI GOT relocations
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/mips-pic.s -o %t.so.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.exe.o
|
2019-09-06 15:23:02 +08:00
|
|
|
# RUN: echo "SECTIONS { . = 0x30000; .text : { *(.text) } }" > %t.script
|
2019-07-25 15:12:23 +08:00
|
|
|
# RUN: ld.lld %t.so.o -shared -soname=t.so -o %t.so
|
2019-09-06 15:23:02 +08:00
|
|
|
# RUN: ld.lld %t.exe.o --script %t.script %t.so -o %t.exe
|
2019-07-25 15:12:23 +08:00
|
|
|
# RUN: llvm-objdump -d -t --no-show-raw-insn %t.exe | FileCheck %s
|
2019-10-03 20:08:04 +08:00
|
|
|
# RUN: llvm-readelf -r -s -A %t.exe | FileCheck -check-prefix=GOT %s
|
2016-05-05 01:47:11 +08:00
|
|
|
|
2020-03-04 08:59:33 +08:00
|
|
|
# CHECK: {{[0-9a-f]+}}1c8 .text 0000000000000000 foo
|
[llvm-objdump] Further rearrange llvm-objdump sections for compatability
Summary:
rL371826 rearranged some output from llvm-objdump for GNU objdump compatability, but there still seem to be some more.
I think this rearrangement is a little closer. Overview of the ordering which matches GNU objdump:
* Archive headers
* File headers
* Section headers
* Symbol table
* Dwarf debugging
* Relocations (if `--disassemble` is not used)
* Section contents
* Disassembly
Reviewers: jhenderson, justice_adams, grimar, ychen, espindola
Reviewed By: jhenderson
Subscribers: aprantl, emaste, arichardson, jrtc27, atanasyan, seiya, llvm-commits, MaskRay
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68066
llvm-svn: 373671
2019-10-04 06:01:08 +08:00
|
|
|
|
2016-05-05 01:47:11 +08:00
|
|
|
# CHECK: __start:
|
2019-09-06 15:23:02 +08:00
|
|
|
# CHECK-NEXT: {{.*}} ld $2, -32736($gp)
|
|
|
|
# CHECK-NEXT: {{.*}} daddiu $2, $2, 456
|
|
|
|
# CHECK-NEXT: {{.*}} addiu $2, $2, -32704
|
|
|
|
# CHECK-NEXT: {{.*}} addiu $2, $2, -32720
|
|
|
|
# CHECK-NEXT: {{.*}} addiu $2, $2, -32712
|
2016-05-05 01:47:11 +08:00
|
|
|
|
2019-09-06 15:23:02 +08:00
|
|
|
# GOT: There are no relocations in this file.
|
2016-05-05 01:47:11 +08:00
|
|
|
|
2019-09-06 15:23:02 +08:00
|
|
|
# GOT: Symbol table '.symtab'
|
|
|
|
# GOT: {{.*}}: [[FOO:[0-9a-f]+]] {{.*}} foo
|
|
|
|
# GOT: {{.*}}: [[GP:[0-9a-f]+]] {{.*}} _gp
|
|
|
|
# GOT: {{.*}}: [[BAR:[0-9a-f]+]] {{.*}} bar
|
|
|
|
|
|
|
|
# GOT: Primary GOT:
|
|
|
|
# GOT-NEXT: Canonical gp value: [[GP]]
|
2019-05-22 23:03:52 +08:00
|
|
|
# GOT-EMPTY:
|
|
|
|
# GOT-NEXT: Reserved entries:
|
2019-09-06 15:23:02 +08:00
|
|
|
# GOT-NEXT: Address Access Initial Purpose
|
|
|
|
# GOT-NEXT: {{.*}} -32752(gp) 0000000000000000 Lazy resolver
|
|
|
|
# GOT-NEXT: {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
|
2019-05-22 23:03:52 +08:00
|
|
|
# GOT-EMPTY:
|
|
|
|
# GOT-NEXT: Local entries:
|
2019-09-06 15:23:02 +08:00
|
|
|
# GOT-NEXT: Address Access Initial
|
|
|
|
# GOT-NEXT: {{.*}} -32736(gp) 0000000000030000
|
|
|
|
# GOT-NEXT: {{.*}} -32728(gp) 0000000000040000
|
|
|
|
# GOT-NEXT: {{.*}} -32720(gp) [[BAR]]
|
|
|
|
# GOT-NEXT: {{.*}} -32712(gp) [[FOO]]
|
2019-05-22 23:03:52 +08:00
|
|
|
# GOT-EMPTY:
|
|
|
|
# GOT-NEXT: Global entries:
|
2019-09-06 15:23:02 +08:00
|
|
|
# GOT-NEXT: Address Access Initial Sym.Val. Type Ndx Name
|
|
|
|
# GOT-NEXT: {{.*}} -32704(gp) 0000000000000000 0000000000000000 FUNC UND foo1a
|
2016-05-05 01:47:11 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.global __start, bar
|
|
|
|
__start:
|
|
|
|
ld $v0,%got_page(foo)($gp) # R_MIPS_GOT_PAGE
|
|
|
|
daddiu $v0,$v0,%got_ofst(foo) # R_MIPS_GOT_OFST
|
|
|
|
addiu $v0,$v0,%got_disp(foo1a) # R_MIPS_GOT_DISP
|
|
|
|
addiu $v0,$v0,%got_disp(bar) # R_MIPS_GOT_DISP
|
2016-06-20 05:39:37 +08:00
|
|
|
addiu $v0,$v0,%got_disp(foo) # R_MIPS_GOT_DISP
|
2016-05-05 01:47:11 +08:00
|
|
|
|
|
|
|
bar:
|
|
|
|
nop
|
|
|
|
foo:
|
|
|
|
nop
|