| # Check handling of R_MICROMIPS_CALL_HI16 / R_MICROMIPS_CALL_LO16 relocations. |
| |
| # RUN: yaml2obj -format=elf -docnum 1 %s > %t1.so.o |
| # RUN: lld -flavor old-gnu -target mipsel -shared -o %t1.so %t1.so.o |
| # RUN: yaml2obj -format=elf -docnum 2 %s > %t2.so.o |
| # RUN: lld -flavor old-gnu -target mipsel -shared -o %t2.so %t2.so.o %t1.so |
| # RUN: llvm-objdump -s -t %t2.so | FileCheck -check-prefix=RAW %s |
| # RUN: llvm-readobj -mips-plt-got %t2.so | FileCheck -check-prefix=GOT %s |
| |
| # RAW: Contents of section .text: |
| # RAW-NEXT: 0130 00000000 00001880 00000000 00002080 |
| # ^ -32744 ^ -32736 |
| # RAW-NEXT: 0140 00000000 00001c80 00000000 00002480 |
| # ^ -32740 ^ -32732 |
| # RAW-NEXT: 0150 00000000 00000000 |
| |
| # RAW: SYMBOL TABLE: |
| # RAW: 00000140 l F .text 00000014 T1 |
| # RAW: 00000154 l F .text 00000004 M1 |
| |
| # GOT: Local entries [ |
| # GOT-NEXT: Entry { |
| # GOT-NEXT: Address: 0x1008 |
| # GOT-NEXT: Access: -32744 |
| # GOT-NEXT: Initial: 0x140 |
| # GOT-NEXT: } |
| # GOT-NEXT: Entry { |
| # GOT-NEXT: Address: 0x100C |
| # GOT-NEXT: Access: -32740 |
| # GOT-NEXT: Initial: 0x155 |
| # GOT-NEXT: } |
| # GOT-NEXT: ] |
| # GOT-NEXT: Global entries [ |
| # GOT-NEXT: Entry { |
| # GOT-NEXT: Address: 0x1010 |
| # 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: T2@ (4) |
| # GOT-NEXT: } |
| # GOT-NEXT: Entry { |
| # GOT-NEXT: Address: 0x1014 |
| # GOT-NEXT: Access: -32732 |
| # GOT-NEXT: Initial: 0x0 |
| # GOT-NEXT: Value: 0x0 |
| # GOT-NEXT: Type: Function (0x2) |
| # GOT-NEXT: Section: Undefined (0x0) |
| # GOT-NEXT: Name: M2@ (7) |
| # GOT-NEXT: } |
| # GOT-NEXT: ] |
| |
| # t1.so.o |
| --- |
| FileHeader: |
| Class: ELFCLASS32 |
| Data: ELFDATA2LSB |
| Type: ET_REL |
| Machine: EM_MIPS |
| Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, |
| EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] |
| |
| Sections: |
| - Name: .text |
| Type: SHT_PROGBITS |
| Size: 8 |
| AddressAlign: 16 |
| Flags: [SHF_ALLOC, SHF_EXECINSTR] |
| |
| Symbols: |
| Global: |
| - Name: T2 |
| Section: .text |
| Type: STT_FUNC |
| Value: 0 |
| Size: 4 |
| - Name: M2 |
| Section: .text |
| Type: STT_FUNC |
| Value: 4 |
| Size: 4 |
| Other: [STO_MIPS_MICROMIPS] |
| |
| # t2.so.o |
| --- |
| FileHeader: |
| Class: ELFCLASS32 |
| Data: ELFDATA2LSB |
| Type: ET_REL |
| Machine: EM_MIPS |
| Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, |
| EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS] |
| |
| Sections: |
| - Name: .text |
| Type: SHT_PROGBITS |
| Size: 40 |
| AddressAlign: 16 |
| Flags: [SHF_ALLOC, SHF_EXECINSTR] |
| |
| - Name: .rel.text |
| Type: SHT_REL |
| Info: .text |
| AddressAlign: 4 |
| Relocations: |
| - Offset: 0 |
| Symbol: T1 |
| Type: R_MICROMIPS_CALL_HI16 |
| - Offset: 4 |
| Symbol: T1 |
| Type: R_MICROMIPS_CALL_LO16 |
| - Offset: 8 |
| Symbol: T2 |
| Type: R_MICROMIPS_CALL_HI16 |
| - Offset: 12 |
| Symbol: T2 |
| Type: R_MICROMIPS_CALL_LO16 |
| - Offset: 16 |
| Symbol: M1 |
| Type: R_MICROMIPS_CALL_HI16 |
| - Offset: 20 |
| Symbol: M1 |
| Type: R_MICROMIPS_CALL_LO16 |
| - Offset: 24 |
| Symbol: M2 |
| Type: R_MICROMIPS_CALL_HI16 |
| - Offset: 28 |
| Symbol: M2 |
| Type: R_MICROMIPS_CALL_LO16 |
| |
| Symbols: |
| Local: |
| - Name: T1 |
| Section: .text |
| Type: STT_FUNC |
| Value: 16 |
| Size: 4 |
| - Name: M1 |
| Section: .text |
| Type: STT_FUNC |
| Value: 36 |
| Size: 4 |
| Other: [STO_MIPS_MICROMIPS] |
| Global: |
| - Name: T0 |
| Section: .text |
| Type: STT_FUNC |
| Value: 0 |
| Size: 16 |
| Other: [STO_MIPS_MICROMIPS] |
| - Name: T2 |
| - Name: M2 |
| ... |