llvm-project/lld/test/old-elf/Mips/got-page-64-micro.test

211 lines
5.8 KiB
Plaintext

# Check handling of R_MICROMIPS_GOT_DISP / PAGE / OFST relocations
# in case of N64 ABI.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: lld -flavor old-gnu -target mips64el -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: 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: 0x120008FF0
# GOT-NEXT: Reserved entries [
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001000
# GOT-NEXT: Access: -32752
# GOT-NEXT: Initial: 0x0
# GOT-NEXT: Purpose: Lazy resolver
# GOT-NEXT: }
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001008
# GOT-NEXT: Access: -32744
# GOT-NEXT: Initial: 0x8000000000000000
# GOT-NEXT: Purpose: Module pointer (GNU extension)
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Local entries [
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001010
# GOT-NEXT: Access: -32736
# GOT-NEXT: Initial: 0x[[LT1]]
# GOT-NEXT: }
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001018
# GOT-NEXT: Access: -32728
# GOT-NEXT: Initial: 0x120000000
# GOT-NEXT: }
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001020
# GOT-NEXT: Access: -32720
# GOT-NEXT: Initial: 0x120000000
# GOT-NEXT: }
# GOT-NEXT: ]
# GOT-NEXT: Global entries [
# GOT-NEXT: Entry {
# GOT-NEXT: Address: 0x120001028
# GOT-NEXT: Access: -32712
# 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: 0x120001030
# GOT-NEXT: Access: -32704
# 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]+}} 38800000 20800000 38800000 40800000
# ^ = -32712 (T1)
# ^ = -32736 (LT1)
# ^ -32712 (T1)
# ^ -32704 (T2)
# RAW-NEXT: {{[0-9a-f]+}} 28800000 30800000 00000000 00000000
# ^ -32728 (PAGE)
# ^ -32720 (PAGE)
# ^ T1 OFST
# ^ T2 OFST
# RAW-NEXT: {{[0-9a-f]+}} 59020000 5d020000 00000000 00000000
# ^ LT1 OFST
# ^ LT2 OFST
# so.o
---
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
EF_MIPS_ARCH_64R2, 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: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
EF_MIPS_ARCH_64R2, EF_MIPS_MICROMIPS]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x4
Size: 0x30
- Name: .rel.text
Type: SHT_RELA
Link: .symtab
Info: .text
AddressAlign: 0x04
Relocations:
- Offset: 0x0
Symbol: T1
Type: R_MIPS_GOT_DISP
- Offset: 0x4
Symbol: LT1
Type: R_MIPS_GOT_DISP
- Offset: 0x8
Symbol: T1
Type: R_MIPS_GOT_PAGE
- Offset: 0xC
Symbol: T2
Type: R_MIPS_GOT_PAGE
- Offset: 0x10
Symbol: LT1
Type: R_MIPS_GOT_PAGE
- Offset: 0x14
Symbol: LT2
Type: R_MIPS_GOT_PAGE
- Offset: 0x18
Symbol: T1
Type: R_MIPS_GOT_OFST
- Offset: 0x1C
Symbol: T2
Type: R_MIPS_GOT_OFST
- Offset: 0x20
Symbol: LT1
Type: R_MIPS_GOT_OFST
- Offset: 0x24
Symbol: LT2
Type: R_MIPS_GOT_OFST
Symbols:
Local:
- Name: .text
Type: STT_SECTION
Section: .text
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
...