2018-06-27 00:58:19 +08:00
|
|
|
# REQUIRES: mips
|
2016-11-06 06:58:01 +08:00
|
|
|
# Check handling of N32 ABI relocation records.
|
|
|
|
|
2018-07-03 22:39:27 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
|
|
|
|
# RUN: -target-abi n32 -o %t.o %s
|
2019-09-10 06:04:20 +08:00
|
|
|
# RUN: echo "SECTIONS { \
|
|
|
|
# RUN: . = 0x20000; .text ALIGN(0x100) : { *(.text) } \
|
|
|
|
# RUN: }" > %t.script
|
|
|
|
# RUN: ld.lld %t.o -script %t.script -o %t.exe
|
|
|
|
# RUN: llvm-objdump -t -d -s --no-show-raw-insn %t.exe | FileCheck %s
|
|
|
|
# RUN: llvm-readelf -h %t.exe | FileCheck -check-prefix=ELF %s
|
2016-11-06 06:58:01 +08:00
|
|
|
|
2018-07-03 22:39:27 +08:00
|
|
|
.option pic2
|
|
|
|
.text
|
|
|
|
.type __start, @function
|
|
|
|
.global __start
|
|
|
|
__start:
|
|
|
|
lui $gp,%hi(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
|
|
|
|
# R_MIPS_SUB
|
|
|
|
# R_MIPS_HI16
|
|
|
|
loc:
|
|
|
|
daddiu $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
|
|
|
|
# R_MIPS_SUB
|
|
|
|
# R_MIPS_LO16
|
|
|
|
|
|
|
|
.section .rodata,"a",@progbits
|
|
|
|
.gpword(loc) # R_MIPS_GPREL32
|
2016-11-06 06:58:01 +08:00
|
|
|
|
2020-03-05 09:19:18 +08:00
|
|
|
# CHECK: 00020104 l .text 00000000 loc
|
|
|
|
# CHECK: 00028100 l .got 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
|
|
|
# CHECK: 00020100 g F .text 00000000 __start
|
|
|
|
|
|
|
|
# CHECK: Contents of section .rodata:
|
|
|
|
# CHECK-NEXT: {{[0-9a-f]+}} ffff8004
|
|
|
|
# ^-- loc - _gp
|
|
|
|
|
2016-11-06 06:58:01 +08:00
|
|
|
# CHECK: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
# CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK-NEXT: <__start>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: 20100: lui $gp, 1
|
|
|
|
# ^-- 0x20100 - 0x28100
|
|
|
|
# ^-- 0 - 0xffff8000
|
|
|
|
# ^-- %hi(0x8000)
|
2020-03-06 06:18:38 +08:00
|
|
|
# CHECK: <loc>:
|
2019-09-10 06:04:20 +08:00
|
|
|
# CHECK-NEXT: 20104: daddiu $gp, $gp, -32768
|
|
|
|
# ^-- 0x20100 - 0x28100
|
|
|
|
# ^-- 0 - 0xffff8000
|
|
|
|
# ^-- %lo(0x8000)
|
2016-11-06 06:58:01 +08:00
|
|
|
|
2019-09-10 06:04:20 +08:00
|
|
|
# ELF: Class: ELF32
|
|
|
|
# ELF: Data: 2's complement, big endian
|
|
|
|
# ELF: Version: 1 (current)
|
|
|
|
# ELF: OS/ABI: UNIX - System V
|
2020-01-06 06:56:27 +08:00
|
|
|
# ELF: ABI Version: 0
|
2019-09-10 06:04:20 +08:00
|
|
|
# ELF: Type: EXEC (Executable file)
|
|
|
|
# ELF: Machine: MIPS R3000
|
|
|
|
# ELF: Version: 0x1
|
|
|
|
# ELF: Entry point address: 0x20100
|
|
|
|
# ELF: Flags: 0x60000026, pic, cpic, abi2, mips64
|