2014-03-09 21:19:46 +08:00
|
|
|
# Check handling of HI16 and LO16 relocations for regular symbol.
|
|
|
|
#
|
|
|
|
# R_MIPS_HI16: (AHL + S) - (short)(AHL + S)
|
|
|
|
# R_MIPS_LO16: AHL + S
|
|
|
|
# where AHL = (AHI << 16) + ALO
|
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
# RUN: yaml2obj -format=elf %s > %t.o
|
|
|
|
# RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t.o
|
|
|
|
# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
# CHECK: Contents of section .text:
|
|
|
|
# CHECK-NEXT: 400110 4000083c 51010885 4000083c 4f010885
|
|
|
|
# CHECK-NEXT: 400120 4000083c 4f030885 4000083c 51ff0885
|
|
|
|
# CHECK-NEXT: 400130 4200083c 4f010885 3e00083c 51010885
|
|
|
|
# CHECK-NEXT: 400140 4002083c 4f010885 40fe083c 51010885
|
|
|
|
# CHECK-NEXT: 400150 00000000
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
# CHECK: SYMBOL TABLE:
|
|
|
|
# CHECK: 00400110 g F .text 00000020 T0
|
|
|
|
# CHECK: 00400130 g F .text 00000020 T1
|
|
|
|
# CHECK: 00400150 g F .text 00000004 T2
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
FileHeader:
|
|
|
|
Class: ELFCLASS32
|
|
|
|
Data: ELFDATA2LSB
|
|
|
|
Type: ET_REL
|
|
|
|
Machine: EM_MIPS
|
|
|
|
Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2]
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
Sections:
|
|
|
|
- Name: .text.1
|
|
|
|
Type: SHT_PROGBITS
|
|
|
|
Content: "0000083c010008850000083cffff08850000083cff0108850000083c01fe0885"
|
|
|
|
# ^ %hi(T2+1) ^ %hi(T2-1) ^ %hi(T2+0x1ff) ^ %hi(T2-0x1ff)
|
|
|
|
# ^ %lo(T2+1) ^ %lo(T2-1) ^ %lo(T2+0x1ff) ^ %lo(T2-0x1ff)
|
|
|
|
AddressAlign: 16
|
|
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
- Name: .rel.text.1
|
|
|
|
Type: SHT_REL
|
|
|
|
Info: .text.1
|
|
|
|
AddressAlign: 4
|
|
|
|
Relocations:
|
|
|
|
- Offset: 0x0
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0x4
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
|
|
|
- Offset: 0x8
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0xC
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
|
|
|
- Offset: 0x10
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0x14
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
|
|
|
- Offset: 0x18
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0x1C
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
- Name: .text.2
|
|
|
|
Type: SHT_PROGBITS
|
|
|
|
Content: "0200083cffff0885feff083c010008850002083cffff088500fe083c01000885"
|
|
|
|
# ^ %hi(T2+0x1ffff) ^ %hi(T2+0x1ffffff)
|
|
|
|
# ^ %lo(T2+0x1ffff) ^ %lo(T2+0x1ffffff)
|
|
|
|
# ^ %hi(T2-0x1ffff) ^ %hi(T2-0x1ffffff)
|
|
|
|
# ^ %lo(T2-0x1ffff) ^ %lo(T2-0x1ffffff)
|
|
|
|
AddressAlign: 16
|
|
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
- Name: .rel.text.2
|
|
|
|
Type: SHT_REL
|
|
|
|
Info: .text.2
|
|
|
|
AddressAlign: 4
|
|
|
|
Relocations:
|
|
|
|
- Offset: 0x0
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0x4
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
|
|
|
- Offset: 0x8
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0xC
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
|
|
|
- Offset: 0x10
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0x14
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
|
|
|
- Offset: 0x18
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_HI16
|
|
|
|
- Offset: 0x1C
|
|
|
|
Symbol: T2
|
|
|
|
Type: R_MIPS_LO16
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
- Name: .text.3
|
|
|
|
Type: SHT_PROGBITS
|
|
|
|
Content: "00000000"
|
|
|
|
AddressAlign: 16
|
|
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
2014-03-09 21:19:46 +08:00
|
|
|
|
2015-03-31 21:04:01 +08:00
|
|
|
Symbols:
|
|
|
|
Global:
|
|
|
|
- Name: T0
|
|
|
|
Section: .text.1
|
|
|
|
Type: STT_FUNC
|
|
|
|
Value: 0
|
|
|
|
Size: 64
|
|
|
|
- Name: T1
|
|
|
|
Section: .text.2
|
|
|
|
Type: STT_FUNC
|
|
|
|
Value: 0
|
|
|
|
Size: 64
|
|
|
|
- Name: T2
|
|
|
|
Section: .text.3
|
|
|
|
Type: STT_FUNC
|
|
|
|
Value: 0
|
|
|
|
Size: 4
|