forked from OSchip/llvm-project
209 lines
7.0 KiB
Plaintext
209 lines
7.0 KiB
Plaintext
# 1. Check sorting of .dynsym content accordingly to .got section
|
|
# in case of using microMIPS relocations.
|
|
# 2. Check that microMIPS records in a dynamic symbol table have:
|
|
# - cleared the STO_MIPS_MICROMIPS flag
|
|
# - adjusted adress
|
|
|
|
# Build shared library
|
|
# RUN: yaml2obj -format=elf %s > %t.o
|
|
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t-so %t.o
|
|
# RUN: llvm-readobj -dyn-symbols %t-so | FileCheck -check-prefix=CHECK-DYN %s
|
|
|
|
# Build shared library (yaml format)
|
|
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
|
|
# RUN: --output-filetype=yaml -o %t-yaml %t.o
|
|
# RUN: FileCheck -check-prefix=CHECK-GOT %s < %t-yaml
|
|
|
|
# CHECK-DYN: Format: ELF32-mips
|
|
# CHECK-DYN: Arch: mipsel
|
|
# CHECK-DYN: AddressSize: 32bit
|
|
# CHECK-DYN: LoadName:
|
|
# CHECK-DYN: DynamicSymbols [
|
|
# CHECK-DYN: Symbol {
|
|
# CHECK-DYN: Name: @ (0)
|
|
# CHECK-DYN: Value: 0x0
|
|
# CHECK-DYN: Size: 0
|
|
# CHECK-DYN: Binding: Local (0x0)
|
|
# CHECK-DYN: Type: None (0x0)
|
|
# CHECK-DYN: Other: 0
|
|
# CHECK-DYN: Section: Undefined (0x0)
|
|
# CHECK-DYN: }
|
|
# CHECK-DYN: Symbol {
|
|
# CHECK-DYN: Name: bar@ (5)
|
|
# CHECK-DYN: Value: 0x139
|
|
# CHECK-DYN: Size: 4
|
|
# CHECK-DYN: Binding: Global (0x1)
|
|
# CHECK-DYN: Type: Function (0x2)
|
|
# CHECK-DYN: Other: 0
|
|
# CHECK-DYN: Section: .text (0x4)
|
|
# CHECK-DYN: }
|
|
# CHECK-DYN: Symbol {
|
|
# CHECK-DYN: Name: foo@ (1)
|
|
# CHECK-DYN: Value: 0x121
|
|
# CHECK-DYN: Size: 24
|
|
# CHECK-DYN: Binding: Global (0x1)
|
|
# CHECK-DYN: Type: Function (0x2)
|
|
# CHECK-DYN: Other: 0
|
|
# CHECK-DYN: Section: .text (0x4)
|
|
# CHECK-DYN: }
|
|
# CHECK-DYN: Symbol {
|
|
# CHECK-DYN: Name: ext1@ (9)
|
|
# CHECK-DYN: Value: 0x0
|
|
# CHECK-DYN: Size: 0
|
|
# CHECK-DYN: Binding: Global (0x1)
|
|
# CHECK-DYN: Type: None (0x0)
|
|
# CHECK-DYN: Other: 0
|
|
# CHECK-DYN: Section: Undefined (0x0)
|
|
# CHECK-DYN: }
|
|
# CHECK-DYN: Symbol {
|
|
# CHECK-DYN: Name: ext2@ (14)
|
|
# CHECK-DYN: Value: 0x0
|
|
# CHECK-DYN: Size: 0
|
|
# CHECK-DYN: Binding: Global (0x1)
|
|
# CHECK-DYN: Type: None (0x0)
|
|
# CHECK-DYN: Other: 0
|
|
# CHECK-DYN: Section: Undefined (0x0)
|
|
# CHECK-DYN: }
|
|
# CHECK-DYN: ]
|
|
|
|
# CHECK-GOT: - type: got
|
|
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
|
|
# CHECK-GOT: alignment: 2^2
|
|
# CHECK-GOT: section-choice: custom-required
|
|
# CHECK-GOT: section-name: .got
|
|
# CHECK-GOT: permissions: rw-
|
|
# CHECK-GOT: - type: got
|
|
# CHECK-GOT: content: [ 00, 00, 00, 80 ]
|
|
# CHECK-GOT: alignment: 2^2
|
|
# CHECK-GOT: section-choice: custom-required
|
|
# CHECK-GOT: section-name: .got
|
|
# CHECK-GOT: permissions: rw-
|
|
# CHECK-GOT: - ref-name: L000
|
|
# CHECK-GOT: type: got
|
|
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
|
|
# CHECK-GOT: alignment: 2^2
|
|
# CHECK-GOT: section-choice: custom-required
|
|
# CHECK-GOT: section-name: .got
|
|
# CHECK-GOT: permissions: rw-
|
|
# CHECK-GOT: references:
|
|
# CHECK-GOT: - kind: LLD_R_MIPS_32_HI16
|
|
# CHECK-GOT: offset: 0
|
|
# CHECK-GOT: target: L007
|
|
# CHECK-GOT: - ref-name: L002
|
|
# CHECK-GOT: type: got
|
|
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
|
|
# CHECK-GOT: alignment: 2^2
|
|
# CHECK-GOT: section-choice: custom-required
|
|
# CHECK-GOT: section-name: .got
|
|
# CHECK-GOT: permissions: rw-
|
|
# CHECK-GOT: references:
|
|
# CHECK-GOT: - kind: LLD_R_MIPS_32_HI16
|
|
# CHECK-GOT: offset: 0
|
|
# CHECK-GOT: target: L008
|
|
# CHECK-GOT: - ref-name: L004
|
|
# CHECK-GOT: type: got
|
|
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
|
|
# CHECK-GOT: alignment: 2^2
|
|
# CHECK-GOT: section-choice: custom-required
|
|
# CHECK-GOT: section-name: .got
|
|
# CHECK-GOT: permissions: rw-
|
|
# CHECK-GOT: references:
|
|
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
|
|
# CHECK-GOT: offset: 0
|
|
# CHECK-GOT: target: foo
|
|
# CHECK-GOT: - ref-name: L005
|
|
# CHECK-GOT: type: got
|
|
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
|
|
# CHECK-GOT: alignment: 2^2
|
|
# CHECK-GOT: section-choice: custom-required
|
|
# CHECK-GOT: section-name: .got
|
|
# CHECK-GOT: permissions: rw-
|
|
# CHECK-GOT: references:
|
|
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
|
|
# CHECK-GOT: offset: 0
|
|
# CHECK-GOT: target: ext1
|
|
# CHECK-GOT: - ref-name: L006
|
|
# CHECK-GOT: type: got
|
|
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
|
|
# CHECK-GOT: alignment: 2^2
|
|
# CHECK-GOT: section-choice: custom-required
|
|
# CHECK-GOT: section-name: .got
|
|
# CHECK-GOT: permissions: rw-
|
|
# CHECK-GOT: references:
|
|
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
|
|
# CHECK-GOT: offset: 0
|
|
# CHECK-GOT: target: ext2
|
|
|
|
---
|
|
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
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x04
|
|
Size: 0x1C
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
AddressAlign: 0x04
|
|
Info: .text
|
|
Relocations:
|
|
- Offset: 0x00
|
|
Symbol: .rodata.str1
|
|
Type: R_MICROMIPS_GOT16
|
|
- Offset: 0x04
|
|
Symbol: .rodata.str1
|
|
Type: R_MICROMIPS_LO16
|
|
- Offset: 0x08
|
|
Symbol: .rodata.str2
|
|
Type: R_MICROMIPS_GOT16
|
|
- Offset: 0x0C
|
|
Symbol: .rodata.str2
|
|
Type: R_MICROMIPS_LO16
|
|
- Offset: 0x10
|
|
Symbol: foo
|
|
Type: R_MICROMIPS_CALL16
|
|
- Offset: 0x14
|
|
Symbol: ext1
|
|
Type: R_MICROMIPS_CALL16
|
|
- Offset: 0x18
|
|
Symbol: ext2
|
|
Type: R_MICROMIPS_CALL16
|
|
- Name: .rodata.str1
|
|
Type: SHT_PROGBITS
|
|
AddressAlign: 0x01
|
|
Size: 0x05
|
|
- Name: .rodata.str2
|
|
Type: SHT_PROGBITS
|
|
AddressAlign: 0x01
|
|
Size: 0x05
|
|
|
|
Symbols:
|
|
Local:
|
|
- Name: .text
|
|
Type: STT_SECTION
|
|
Section: .text
|
|
- Name: .rodata.str1
|
|
Type: STT_SECTION
|
|
Section: .rodata.str1
|
|
- Name: .rodata.str2
|
|
Type: STT_SECTION
|
|
Section: .rodata.str2
|
|
Global:
|
|
- Name: bar
|
|
Section: .text
|
|
Value: 0x18
|
|
Other: [ STO_MIPS_MICROMIPS ]
|
|
- Name: foo
|
|
Section: .text
|
|
Other: [ STO_MIPS_MICROMIPS ]
|
|
- Name: ext1
|
|
- Name: ext2
|
|
...
|