hanchenye-llvm-project/lld/test/old-elf/Mips/rel-eh-01.test

187 lines
4.5 KiB
Plaintext

# Check R_MIPS_EH relocation handling: writing result of a relocation
# calculation, adding GOT entries etc.
# 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 > %t1.o
# RUN: yaml2obj -format=elf -docnum 3 %s > %t2.o
# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t1.o %t2.o %t.so
# RUN: llvm-objdump -s -t %t.exe | FileCheck -check-prefix=RAW %s
# RUN: llvm-readobj -mips-plt-got %t.exe | FileCheck -check-prefix=GOT %s
# RAW: Contents of section .gnu_extab:
# RAW-NEXT: 400178 001880ff ff000000 1c80ffff 2080ffff
# ^ T1 GOT entry = 0xffff8018 = -32744
# ^ L1 GOT entry = 0xffff801c = -32740
# E1 GOT entry = 0xffff8020 = -32736 ^
# RAW: Contents of section .got:
# RAW-NEXT: 401000 00000000 00000080 60014000 00204000
# RAW-NEXT: 401010 00000000
# RAW: SYMBOL TABLE:
# RAW: 00402000 l .data 00000004 L1
# RAW: 00400160 g F .text 00000004 T1
# GOT: Local entries [
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x401008
# GOT-NEXT: Access: -32744
# GOT-NEXT: Initial: 0x400160
# GOT-NEXT: }
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x40100C
# GOT-NEXT: Access: -32740
# GOT-NEXT: Initial: 0x402000
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Global entries [
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x401010
# GOT-NEXT: Access: -32736
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Value: 0x0
# GOT-NEXT: Type: Function (0x2)
# GOT-NEXT: Section: Undefined (0x0)
# GOT-NEXT: Name: E1@ (1)
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Number of TLS and multi-GOT entries: 0
# so.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC,
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
AddressAlign: 16
Size: 4
Symbols:
Global:
- Name: E1
Type: STT_FUNC
Section: .text
Value: 0
Size: 4
# t1.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC,
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
AddressAlign: 16
Size: 4
Symbols:
Global:
- Name: T1
Type: STT_FUNC
Section: .text
Value: 0
Size: 4
# t2.o
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_NOREORDER, EF_MIPS_CPIC, EF_MIPS_PIC,
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
AddressAlign: 16
Size: 8
- Name: .data
Type: SHT_PROGBITS
Flags: [SHF_WRITE, SHF_ALLOC]
AddressAlign: 16
Size: 4
- Name: .gnu_extab
Type: SHT_PROGBITS
Flags: [SHF_ALLOC]
AddressAlign: 4
Size: 16
- Name: .rel.gnu_extab
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .gnu_extab
Relocations:
- Offset: 1
Symbol: T1
Type: R_MIPS_EH
- Offset: 8
Symbol: L1
Type: R_MIPS_EH
- Offset: 12
Symbol: E1
Type: R_MIPS_EH
- Name: .eh_frame_entry
Type: SHT_PROGBITS
Flags: [SHF_ALLOC]
AddressAlign: 4
Content: "0000000100000001"
- Name: .rel.eh_frame_entry
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .eh_frame_entry
Relocations:
- Offset: 0
Symbol: .text
Type: R_MIPS_PC32
- Offset: 4
Symbol: .gnu_extab
Type: R_MIPS_PC32
Symbols:
Local:
- Name: .text
Type: STT_SECTION
Section: .text
- Name: .gnu_extab
Type: STT_SECTION
Section: .gnu_extab
- Name: L1
Type: STT_OBJECT
Section: .data
Value: 0
Size: 4
Global:
- Name: T0
Type: STT_FUNC
Section: .text
Value: 0
Size: 8
- Name: E1
- Name: T1
...