forked from OSchip/llvm-project
154 lines
3.8 KiB
Plaintext
154 lines
3.8 KiB
Plaintext
# Check that LA25 stubs are created for branch relocations
|
|
# when a PIC function is called from non-pic code.
|
|
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-pic.o
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-reg.o
|
|
# RUN: yaml2obj -format=elf -docnum 3 %s > %t-micro.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe \
|
|
# RUN: %t-reg.o %t-micro.o %t-pic.o
|
|
|
|
# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
|
|
|
|
# CHECK-NOT: Contents of section .plt:
|
|
# CHECK: Contents of section .text:
|
|
# CHECK-NEXT: 400130 5c001000 0f000000 0e000000 0d000000
|
|
# ^ T0 ^ .pic.T1 (0x400170)
|
|
# ^ 0x400134 + 0x3c = 0x400170
|
|
# ^ ...
|
|
# CHECK-NEXT: 400140 2000c000 1e000000 1c000000 00001a00
|
|
# ^ T3 ^ .pic.T2
|
|
# ^ ...
|
|
# CHECK-NEXT: 400150 00000c00 00000000 00000000 00000000
|
|
# CHECK-NEXT: 400160 00000000 00000000 00000000 00000000
|
|
# ^ T1 ^ T2
|
|
# CHECK-NEXT: 400170 4000193c 58001008 60013927 00000000
|
|
# ^ .pic.T1
|
|
# CHECK-NEXT: 400180 b9414000 20d4b200 39336501 00000000
|
|
# ^ .pic.T2
|
|
|
|
# CHECK: SYMBOL TABLE:
|
|
# CHECK: 00400130 g F .text 00000010 T0
|
|
# CHECK: 00400140 g F .text 00000014 T3
|
|
# CHECK: 00400160 g F .text 00000004 T1
|
|
# CHECK: 00400164 g F .text 00000004 T2
|
|
|
|
# pic.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32,
|
|
EF_MIPS_CPIC, EF_MIPS_PIC, 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: 0
|
|
Size: 4
|
|
- Name: T2
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 4
|
|
Size: 4
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
|
|
# reg.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 4
|
|
Size: 16
|
|
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
AddressAlign: 0x04
|
|
Info: .text
|
|
Relocations:
|
|
- Offset: 0
|
|
Symbol: T1
|
|
Type: R_MIPS_26
|
|
- Offset: 4
|
|
Symbol: T1
|
|
Type: R_MIPS_PC16
|
|
- Offset: 8
|
|
Symbol: T1
|
|
Type: R_MIPS_PC21_S2
|
|
- Offset: 12
|
|
Symbol: T1
|
|
Type: R_MIPS_PC26_S2
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T0
|
|
Section: .text
|
|
Size: 16
|
|
- Name: T1
|
|
|
|
# micro.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_ABI_O32, EF_MIPS_ARCH_32, EF_MIPS_CPIC, EF_MIPS_MICROMIPS]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 4
|
|
Size: 20
|
|
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
AddressAlign: 0x04
|
|
Info: .text
|
|
Relocations:
|
|
- Offset: 0
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_26_S1
|
|
- Offset: 4
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC7_S1
|
|
- Offset: 8
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC10_S1
|
|
- Offset: 12
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC16_S1
|
|
- Offset: 16
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC23_S2
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T3
|
|
Section: .text
|
|
Size: 20
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
- Name: T2
|
|
...
|