forked from OSchip/llvm-project
106 lines
2.7 KiB
Plaintext
106 lines
2.7 KiB
Plaintext
# Check ELF Header for non-pic executable file.
|
|
|
|
# Build shared library
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
|
|
# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o
|
|
|
|
# Build executable
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
|
|
# RUN: lld -flavor gnu -target mipsel -e glob -o %t.exe %t-o.o %t.so
|
|
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
|
|
|
|
# CHECK: Format: ELF32-mips
|
|
# CHECK: Arch: mipsel
|
|
# CHECK: AddressSize: 32bit
|
|
# CHECK: LoadName:
|
|
# CHECK: ElfHeader {
|
|
# CHECK: Ident {
|
|
# CHECK: Magic: (7F 45 4C 46)
|
|
# CHECK: Class: 32-bit (0x1)
|
|
# CHECK: DataEncoding: LittleEndian (0x1)
|
|
# CHECK: FileVersion: 1
|
|
# CHECK: OS/ABI: SystemV (0x0)
|
|
# CHECK: ABIVersion: 1
|
|
# CHECK: Unused: (00 00 00 00 00 00 00)
|
|
# CHECK: }
|
|
# CHECK: Type: Executable (0x2)
|
|
# CHECK: Machine: EM_MIPS (0x8)
|
|
# CHECK: Version: 1
|
|
# CHECK: Entry: 0x{{[0-9A-F]+}}
|
|
# CHECK: ProgramHeaderOffset: 0x{{[0-9A-F]+}}
|
|
# CHECK: SectionHeaderOffset: 0x{{[0-9A-F]+}}
|
|
# CHECK: Flags [ (0x50001005)
|
|
# CHECK: EF_MIPS_ABI_O32 (0x1000)
|
|
# CHECK: EF_MIPS_ARCH_32 (0x50000000)
|
|
# CHECK: EF_MIPS_CPIC (0x4)
|
|
# CHECK: EF_MIPS_NOREORDER (0x1)
|
|
# CHECK: ]
|
|
# CHECK: HeaderSize: 52
|
|
# CHECK: ProgramHeaderEntrySize: 32
|
|
# CHECK: ProgramHeaderCount: {{[0-9]+}}
|
|
# CHECK: SectionHeaderEntrySize: 40
|
|
# CHECK: SectionHeaderCount: {{[0-9]+}}
|
|
# CHECK: StringTableSectionIndex: {{[0-9]+}}
|
|
# CHECK: }
|
|
|
|
# so.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
|
|
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Size: 0x0C
|
|
AddressAlign: 16
|
|
Flags: [SHF_EXECINSTR, SHF_ALLOC]
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T1
|
|
Section: .text
|
|
Type: STT_FUNC
|
|
Value: 0x0
|
|
Size: 4
|
|
|
|
# o.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
|
|
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x04
|
|
Size: 0x08
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
AddressAlign: 0x04
|
|
Info: .text
|
|
Relocations:
|
|
- Offset: 0x00
|
|
Symbol: T1
|
|
Type: R_MIPS_26
|
|
|
|
Symbols:
|
|
Local:
|
|
- Name: .text
|
|
Type: STT_SECTION
|
|
Section: .text
|
|
Global:
|
|
- Name: glob
|
|
Section: .text
|
|
- Name: T1
|
|
...
|