forked from OSchip/llvm-project
252 lines
7.0 KiB
Plaintext
252 lines
7.0 KiB
Plaintext
# Check handling of R_MICROMIPS_GOT_DISP / PAGE / OFST relocations
|
|
# in case of O32 ABI.
|
|
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t-so.o
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so
|
|
# RUN: llvm-readobj -symbols -dyn-symbols -mips-plt-got %t.exe \
|
|
# RUN: | FileCheck -check-prefix=GOT %s
|
|
# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s
|
|
|
|
# GOT: Symbol {
|
|
# GOT: Name: LT3
|
|
# GOT-NEXT: Value: 0x[[LT3:[0-9A-F]+]]
|
|
# GOT: Symbol {
|
|
# GOT: Name: LT4
|
|
# GOT-NEXT: Value: 0x{{[0-9A-F]+}}
|
|
# GOT: Symbol {
|
|
# GOT: Name: T0
|
|
# GOT-NEXT: Value: 0x{{[0-9A-F]+}}
|
|
# GOT: Symbol {
|
|
# GOT: Name: LT1
|
|
# GOT-NEXT: Value: 0x[[LT1:[0-9A-F]+]]
|
|
# GOT: Symbol {
|
|
# GOT: Name: LT2
|
|
# GOT-NEXT: Value: 0x{{[0-9A-F]+}}
|
|
# GOT: Symbol {
|
|
# GOT: Name: T1@
|
|
# GOT-NEXT: Value: 0x0
|
|
# GOT: Symbol {
|
|
# GOT: Name: T2@
|
|
# GOT-NEXT: Value: 0x0
|
|
|
|
# GOT: Primary GOT {
|
|
# GOT-NEXT: Canonical gp value: 0x408FF0
|
|
# GOT-NEXT: Reserved entries [
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x401000
|
|
# GOT-NEXT: Access: -32752
|
|
# GOT-NEXT: Initial: 0x0
|
|
# GOT-NEXT: Purpose: Lazy resolver
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x401004
|
|
# GOT-NEXT: Access: -32748
|
|
# GOT-NEXT: Initial: 0x80000000
|
|
# GOT-NEXT: Purpose: Module pointer (GNU extension)
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: ]
|
|
# GOT-NEXT: Local entries [
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x401008
|
|
# GOT-NEXT: Access: -32744
|
|
# GOT-NEXT: Initial: 0x[[LT1]]
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x40100C
|
|
# GOT-NEXT: Access: -32740
|
|
# GOT-NEXT: Initial: 0x400000
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x401010
|
|
# GOT-NEXT: Access: -32736
|
|
# GOT-NEXT: Initial: 0x400000
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x401014
|
|
# GOT-NEXT: Access: -32732
|
|
# GOT-NEXT: Initial: 0x[[LT3]]
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x401018
|
|
# GOT-NEXT: Access: -32728
|
|
# GOT-NEXT: Initial: 0x400000
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: ]
|
|
# GOT-NEXT: Global entries [
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x40101C
|
|
# GOT-NEXT: Access: -32724
|
|
# GOT-NEXT: Initial: 0x0
|
|
# GOT-NEXT: Value: 0x0
|
|
# GOT-NEXT: Type: Function (0x2)
|
|
# GOT-NEXT: Section: Undefined (0x0)
|
|
# GOT-NEXT: Name: T1@
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: Entry {
|
|
# GOT-NEXT: Address: 0x401020
|
|
# GOT-NEXT: Access: -32720
|
|
# GOT-NEXT: Initial: 0x0
|
|
# GOT-NEXT: Value: 0x0
|
|
# GOT-NEXT: Type: Function (0x2)
|
|
# GOT-NEXT: Section: Undefined (0x0)
|
|
# GOT-NEXT: Name: T2@
|
|
# GOT-NEXT: }
|
|
# GOT-NEXT: ]
|
|
# GOT-NEXT: Number of TLS and multi-GOT entries: 0
|
|
# GOT-NEXT: }
|
|
|
|
# RAW: Contents of section .text:
|
|
# RAW-NEXT: {{[0-9a-f]+}} 00002c80 00001880 00002c80 00003080
|
|
# ^ = -32724 (T1)
|
|
# ^ = -32744 (LT1)
|
|
# ^ -32724 (T1)
|
|
# ^ -32720 (T2)
|
|
# RAW-NEXT: {{[0-9a-f]+}} 00001c80 00002080 00000000 00000000
|
|
# ^ -32740 (PAGE)
|
|
# ^ -32736 (PAGE)
|
|
# ^ T1 OFST
|
|
# ^ T2 OFST
|
|
# RAW-NEXT: {{[0-9a-f]+}} 0000a501 0000a901 00002480 00002880
|
|
# ^ LT1 OFST
|
|
# ^ LT2 OFST
|
|
# ^ = -32732 (LT3)
|
|
# ^ -32728 (PAGE)
|
|
# RAW-NEXT: {{[0-9a-f]+}} 0000b101 00000000
|
|
# ^ LT4 OFST
|
|
|
|
# so.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
|
|
EF_MIPS_ARCH_32R2, EF_MIPS_ABI_O32, EF_MIPS_MICROMIPS]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Size: 8
|
|
AddressAlign: 16
|
|
Flags: [SHF_EXECINSTR, SHF_ALLOC]
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T1
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0x0
|
|
Size: 0x4
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
- Name: T2
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0x4
|
|
Size: 0x4
|
|
|
|
# o.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
|
|
EF_MIPS_ARCH_32R2, EF_MIPS_ABI_O32, EF_MIPS_MICROMIPS]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x4
|
|
Size: 0x38
|
|
|
|
- Name: .rel.text
|
|
Type: SHT_RELA
|
|
Link: .symtab
|
|
Info: .text
|
|
AddressAlign: 0x04
|
|
Relocations:
|
|
- Offset: 0x0
|
|
Symbol: T1
|
|
Type: R_MICROMIPS_GOT_DISP
|
|
- Offset: 0x4
|
|
Symbol: LT1
|
|
Type: R_MICROMIPS_GOT_DISP
|
|
- Offset: 0x8
|
|
Symbol: T1
|
|
Type: R_MICROMIPS_GOT_PAGE
|
|
- Offset: 0xC
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_GOT_PAGE
|
|
- Offset: 0x10
|
|
Symbol: LT1
|
|
Type: R_MICROMIPS_GOT_PAGE
|
|
- Offset: 0x14
|
|
Symbol: LT2
|
|
Type: R_MICROMIPS_GOT_PAGE
|
|
- Offset: 0x18
|
|
Symbol: T1
|
|
Type: R_MICROMIPS_GOT_OFST
|
|
- Offset: 0x1C
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_GOT_OFST
|
|
- Offset: 0x20
|
|
Symbol: LT1
|
|
Type: R_MICROMIPS_GOT_OFST
|
|
- Offset: 0x24
|
|
Symbol: LT2
|
|
Type: R_MICROMIPS_GOT_OFST
|
|
- Offset: 0x28
|
|
Symbol: LT3
|
|
Type: R_MICROMIPS_GOT_DISP
|
|
- Offset: 0x2C
|
|
Symbol: LT4
|
|
Type: R_MICROMIPS_GOT_PAGE
|
|
- Offset: 0x30
|
|
Symbol: LT4
|
|
Type: R_MICROMIPS_GOT_OFST
|
|
|
|
Symbols:
|
|
Local:
|
|
- Name: .text
|
|
Type: STT_SECTION
|
|
Section: .text
|
|
- Name: LT3
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x30
|
|
Size: 0x4
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
- Name: LT4
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x34
|
|
Size: 0x4
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
|
|
Global:
|
|
- Name: T0
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 0x8
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
- Name: LT1
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x28
|
|
Size: 0x4
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
- Name: LT2
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x2c
|
|
Size: 0x4
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
- Name: T1
|
|
- Name: T2
|
|
...
|