forked from OSchip/llvm-project
124 lines
3.1 KiB
Plaintext
124 lines
3.1 KiB
Plaintext
# Check that LA25 stubs are created for branch relocations
|
|
# when a PIC function is defined in a non-PIC file and
|
|
# is called from non-pic code.
|
|
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe %t1.o %t2.o
|
|
|
|
# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
|
|
|
|
# CHECK-NOT: Contents of section .plt:
|
|
# CHECK: Contents of section .text:
|
|
# CHECK-NEXT: 400130 00000000 00000000 58001000 09000000
|
|
# ^ T1 ^ T2 ^ .pic.T1 (0x400160)
|
|
# CHECK-NEXT: 400140 08000000 07000000 2000b800 12000000
|
|
# ^ .pic.T2 (0x400170)
|
|
# CHECK-NEXT: 400150 10000000 00000e00 00000600 00000000
|
|
# CHECK-NEXT: 400160 4000193c 4c001008 30013927 00000000
|
|
# ^ .pic.T1
|
|
# CHECK-NEXT: 400170 b9414000 20d49a00 39333501 00000000
|
|
# ^ .pic.T2
|
|
|
|
# CHECK: SYMBOL TABLE:
|
|
# CHECK: 00400130 g F .text 00000004 T1
|
|
# CHECK: 00400134 g F .text 00000004 T2
|
|
# CHECK: 00400138 g F .text 00000010 T0
|
|
# CHECK: 00400148 g F .text 00000014 T3
|
|
|
|
# 1.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
|
|
Size: 8
|
|
AddressAlign: 16
|
|
Flags: [SHF_EXECINSTR, SHF_ALLOC]
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T1
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0
|
|
Size: 4
|
|
Other: [STO_MIPS_PIC]
|
|
- Name: T2
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 4
|
|
Size: 4
|
|
Other: [STO_MIPS_MICROMIPS, STO_MIPS_PIC]
|
|
|
|
# 2.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: 36
|
|
|
|
- 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
|
|
- Offset: 16
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_26_S1
|
|
- Offset: 20
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC7_S1
|
|
- Offset: 24
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC10_S1
|
|
- Offset: 28
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC16_S1
|
|
- Offset: 32
|
|
Symbol: T2
|
|
Type: R_MICROMIPS_PC23_S2
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T0
|
|
Section: .text
|
|
Value: 0
|
|
Size: 16
|
|
- Name: T3
|
|
Section: .text
|
|
Value: 16
|
|
Size: 20
|
|
Other: [STO_MIPS_MICROMIPS]
|
|
- Name: T1
|
|
- Name: T2
|
|
...
|