2018-06-27 00:58:19 +08:00
|
|
|
# REQUIRES: mips
|
2016-11-24 06:22:16 +08:00
|
|
|
# Check that the linker use a value of _gp symbol defined
|
|
|
|
# in a linker script to calculate GOT relocations.
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
|
2016-12-08 14:19:47 +08:00
|
|
|
|
2016-11-24 06:22:16 +08:00
|
|
|
# RUN: echo "SECTIONS { \
|
|
|
|
# RUN: .text : { *(.text) } \
|
2017-01-10 07:16:01 +08:00
|
|
|
# RUN: _gp = ABSOLUTE(.) + 0x100; \
|
2016-12-08 14:19:47 +08:00
|
|
|
# RUN: .got : { *(.got) } }" > %t.rel.script
|
2017-09-21 02:30:57 +08:00
|
|
|
# RUN: ld.lld -shared -o %t.rel.so --script %t.rel.script %t.o
|
|
|
|
# RUN: llvm-objdump -s -t %t.rel.so | FileCheck --check-prefix=REL %s
|
|
|
|
|
|
|
|
# RUN: echo "SECTIONS { \
|
|
|
|
# RUN: .text : { *(.text) } \
|
|
|
|
# RUN: _gp = 0x100 + ABSOLUTE(.); \
|
|
|
|
# RUN: .got : { *(.got) } }" > %t.rel.script
|
2016-12-08 14:19:47 +08:00
|
|
|
# RUN: ld.lld -shared -o %t.rel.so --script %t.rel.script %t.o
|
|
|
|
# RUN: llvm-objdump -s -t %t.rel.so | FileCheck --check-prefix=REL %s
|
|
|
|
|
|
|
|
# RUN: echo "SECTIONS { \
|
|
|
|
# RUN: .text : { *(.text) } \
|
|
|
|
# RUN: _gp = 0x200; \
|
|
|
|
# RUN: .got : { *(.got) } }" > %t.abs.script
|
|
|
|
# RUN: ld.lld -shared -o %t.abs.so --script %t.abs.script %t.o
|
|
|
|
# RUN: llvm-objdump -s -t %t.abs.so | FileCheck --check-prefix=ABS %s
|
2016-11-24 06:22:16 +08:00
|
|
|
|
2020-03-05 09:19:18 +08:00
|
|
|
# REL: 000000e0 l .text 00000000 foo
|
|
|
|
# REL: 00000000 l *ABS* 00000000 .hidden _gp_disp
|
|
|
|
# REL: 000001ec l *ABS* 00000000 .hidden _gp
|
[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
|
|
|
|
2018-06-27 01:04:47 +08:00
|
|
|
# REL: Contents of section .reginfo:
|
2018-06-27 06:13:32 +08:00
|
|
|
# REL-NEXT: 0018 10000104 00000000 00000000 00000000
|
|
|
|
# REL-NEXT: 0028 00000000 000001ec
|
2018-06-27 01:04:47 +08:00
|
|
|
# ^-- _gp
|
|
|
|
|
2016-12-08 14:19:47 +08:00
|
|
|
# REL: Contents of section .text:
|
2018-06-27 01:04:47 +08:00
|
|
|
# REL-NEXT: 00e0 3c080000 2108010c 8f82ff1c
|
2016-12-08 14:19:47 +08:00
|
|
|
# ^-- %hi(_gp_disp)
|
|
|
|
# ^-- %lo(_gp_disp)
|
2018-06-27 01:04:47 +08:00
|
|
|
# ^-- 8 - (0x1ec - 0x100)
|
2016-12-08 14:19:47 +08:00
|
|
|
# G - (GP - .got)
|
|
|
|
|
|
|
|
# REL: Contents of section .data:
|
2017-01-10 09:21:30 +08:00
|
|
|
# REL-NEXT: 00f0 fffffef4
|
2018-06-27 01:04:47 +08:00
|
|
|
# ^-- 0x30-0x1ec
|
2018-05-30 16:48:53 +08:00
|
|
|
# foo - GP
|
2016-12-08 14:19:47 +08:00
|
|
|
|
2020-03-05 09:19:18 +08:00
|
|
|
# ABS: 000000e0 l .text 00000000 foo
|
|
|
|
# ABS: 00000000 l *ABS* 00000000 .hidden _gp_disp
|
|
|
|
# ABS: 00000200 l *ABS* 00000000 .hidden _gp
|
2018-06-27 01:04:47 +08:00
|
|
|
|
|
|
|
# ABS: Contents of section .reginfo:
|
2018-06-27 06:13:32 +08:00
|
|
|
# ABS-NEXT: 0018 10000104 00000000 00000000 00000000
|
|
|
|
# ABS-NEXT: 0028 00000000 00000200
|
2018-06-27 01:04:47 +08:00
|
|
|
# ^-- _gp
|
2016-12-08 14:19:47 +08:00
|
|
|
|
|
|
|
# ABS: Contents of section .text:
|
2018-06-27 01:04:47 +08:00
|
|
|
# ABS-NEXT: 00e0 3c080000 21080120 8f82ff08
|
2016-12-08 14:19:47 +08:00
|
|
|
# ^-- %hi(_gp_disp)
|
|
|
|
# ^-- %lo(_gp_disp)
|
2017-01-17 05:17:23 +08:00
|
|
|
# ^-- 8 - (0x200 - 0x100)
|
2016-12-08 14:19:47 +08:00
|
|
|
# G - (GP - .got)
|
|
|
|
|
|
|
|
# ABS: Contents of section .data:
|
2018-06-27 01:04:47 +08:00
|
|
|
# ABS-NEXT: 00f0 fffffee0
|
|
|
|
# ^-- 0xe0-0x200
|
2018-05-30 16:48:53 +08:00
|
|
|
# foo - GP
|
2016-12-08 14:19:47 +08:00
|
|
|
|
2016-11-24 06:22:16 +08:00
|
|
|
.text
|
|
|
|
foo:
|
|
|
|
lui $t0, %hi(_gp_disp)
|
|
|
|
addi $t0, $t0, %lo(_gp_disp)
|
|
|
|
lw $v0, %call16(bar)($gp)
|
|
|
|
|
|
|
|
.data
|
|
|
|
.gpword foo
|