2020-01-22 09:02:25 +08:00
|
|
|
# RUN: yaml2obj %s -o %t
|
2015-01-25 21:29:25 +08:00
|
|
|
# RUN: llvm-readobj -r %t | FileCheck -check-prefix=OBJ %s
|
|
|
|
# RUN: obj2yaml %t | FileCheck -check-prefix=YAML %s
|
|
|
|
|
|
|
|
# OBJ: Relocations [
|
|
|
|
# OBJ-NEXT: Section (2) .rela.text {
|
|
|
|
# OBJ-NEXT: 0x14 R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 main 0x4
|
|
|
|
# OBJ-NEXT: 0x1C R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 main 0x8
|
|
|
|
# OBJ-NEXT: 0x20 R_MIPS_GOT_PAGE/R_MIPS_NONE/R_MIPS_NONE .rodata 0x0
|
|
|
|
# OBJ-NEXT: 0x24 R_MIPS_GOT_OFST/R_MIPS_NONE/R_MIPS_NONE .rodata 0x0
|
|
|
|
# OBJ-NEXT: 0x28 R_MIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE printf 0x0
|
|
|
|
# OBJ-NEXT: 0x30 R_MIPS_GPREL16/R_MIPS_LO16/R_MIPS_NONE printf 0x0
|
|
|
|
# OBJ-NEXT: }
|
|
|
|
# OBJ-NEXT: ]
|
|
|
|
|
|
|
|
# YAML: Relocations:
|
2020-11-18 16:59:49 +08:00
|
|
|
# YAML-NEXT: - Offset: 0x14
|
2015-01-25 21:29:25 +08:00
|
|
|
# YAML-NEXT: Symbol: main
|
|
|
|
# YAML-NEXT: Type: R_MIPS_GPREL16
|
|
|
|
# YAML-NEXT: Type2: R_MIPS_SUB
|
|
|
|
# YAML-NEXT: Type3: R_MIPS_HI16
|
|
|
|
# YAML-NEXT: Addend: 4
|
2020-11-18 16:59:49 +08:00
|
|
|
# YAML-NEXT: - Offset: 0x1C
|
2015-01-25 21:29:25 +08:00
|
|
|
# YAML-NEXT: Symbol: main
|
|
|
|
# YAML-NEXT: Type: R_MIPS_GPREL16
|
|
|
|
# YAML-NEXT: Type2: R_MIPS_SUB
|
|
|
|
# YAML-NEXT: Type3: R_MIPS_LO16
|
|
|
|
# YAML-NEXT: Addend: 8
|
2020-11-18 16:59:49 +08:00
|
|
|
# YAML-NEXT: - Offset: 0x20
|
2015-01-25 21:29:25 +08:00
|
|
|
# YAML-NEXT: Symbol: .rodata
|
|
|
|
# YAML-NEXT: Type: R_MIPS_GOT_PAGE
|
2020-11-18 16:59:49 +08:00
|
|
|
# YAML-NEXT: - Offset: 0x24
|
2015-01-25 21:29:25 +08:00
|
|
|
# YAML-NEXT: Symbol: .rodata
|
|
|
|
# YAML-NEXT: Type: R_MIPS_GOT_OFST
|
2020-11-18 16:59:49 +08:00
|
|
|
# YAML-NEXT: - Offset: 0x28
|
2015-01-25 21:29:25 +08:00
|
|
|
# YAML-NEXT: Symbol: printf
|
|
|
|
# YAML-NEXT: Type: R_MIPS_CALL16
|
2020-11-18 16:59:49 +08:00
|
|
|
# YAML-NEXT: - Offset: 0x30
|
2015-01-25 21:29:25 +08:00
|
|
|
# YAML-NEXT: Symbol: printf
|
|
|
|
# YAML-NEXT: Type: R_MIPS_GPREL16
|
|
|
|
# YAML-NEXT: Type2: R_MIPS_LO16
|
|
|
|
# YAML-NEXT: SpecSym: RSS_GP0
|
|
|
|
|
2016-06-28 03:53:53 +08:00
|
|
|
--- !ELF
|
2015-01-25 21:29:25 +08:00
|
|
|
FileHeader:
|
|
|
|
Class: ELFCLASS64
|
|
|
|
Data: ELFDATA2LSB
|
|
|
|
Type: ET_REL
|
|
|
|
Machine: EM_MIPS
|
|
|
|
Flags: [ EF_MIPS_PIC, EF_MIPS_CPIC,
|
|
|
|
EF_MIPS_NOREORDER, EF_MIPS_ARCH_64R2 ]
|
|
|
|
Sections:
|
|
|
|
- Name: .text
|
|
|
|
Type: SHT_PROGBITS
|
|
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
|
|
AddressAlign: 0x10
|
|
|
|
Size: 0x60
|
|
|
|
- Name: .rela.text
|
|
|
|
Type: SHT_RELA
|
|
|
|
Flags: [ SHF_INFO_LINK ]
|
2015-07-10 02:22:55 +08:00
|
|
|
AddressAlign: 0x8
|
2015-01-25 21:29:25 +08:00
|
|
|
Info: .text
|
|
|
|
Relocations:
|
|
|
|
- Offset: 0x14
|
|
|
|
Symbol: main
|
|
|
|
Type: R_MIPS_GPREL16
|
|
|
|
Type2: R_MIPS_SUB
|
|
|
|
Type3: R_MIPS_HI16
|
|
|
|
Addend: 4
|
|
|
|
- Offset: 0x1C
|
|
|
|
Symbol: main
|
|
|
|
Type: R_MIPS_GPREL16
|
|
|
|
Type2: R_MIPS_SUB
|
|
|
|
Type3: R_MIPS_LO16
|
|
|
|
Addend: 8
|
|
|
|
- Offset: 0x20
|
|
|
|
Symbol: .rodata
|
|
|
|
Type: R_MIPS_GOT_PAGE
|
2015-01-29 00:22:50 +08:00
|
|
|
Addend: 0
|
2015-01-25 21:29:25 +08:00
|
|
|
- Offset: 0x24
|
|
|
|
Symbol: .rodata
|
|
|
|
Type: R_MIPS_GOT_OFST
|
2015-01-29 00:22:50 +08:00
|
|
|
Addend: 0
|
2015-01-25 21:29:25 +08:00
|
|
|
- Offset: 0x28
|
|
|
|
Symbol: printf
|
|
|
|
Type: R_MIPS_CALL16
|
2015-01-29 00:22:50 +08:00
|
|
|
Addend: 0
|
2015-01-25 21:29:25 +08:00
|
|
|
- Offset: 0x30
|
|
|
|
Symbol: printf
|
|
|
|
Type: R_MIPS_GPREL16
|
|
|
|
Type2: R_MIPS_LO16
|
|
|
|
SpecSym: RSS_GP0
|
2015-01-29 00:22:50 +08:00
|
|
|
Addend: 0
|
2015-01-25 21:29:25 +08:00
|
|
|
- Name: .rodata
|
|
|
|
Type: SHT_PROGBITS
|
|
|
|
Flags: [ SHF_ALLOC ]
|
|
|
|
AddressAlign: 0x10
|
|
|
|
Size: 0x0F
|
|
|
|
|
|
|
|
Symbols:
|
2019-04-03 22:53:42 +08:00
|
|
|
- Name: .text
|
|
|
|
Type: STT_SECTION
|
|
|
|
Section: .text
|
|
|
|
- Name: .rodata
|
|
|
|
Type: STT_SECTION
|
|
|
|
Section: .rodata
|
|
|
|
- Name: main
|
|
|
|
Type: STT_FUNC
|
|
|
|
Section: .text
|
|
|
|
Size: 0x58
|
|
|
|
Binding: STB_GLOBAL
|
|
|
|
- Name: printf
|
|
|
|
Binding: STB_GLOBAL
|
2015-01-25 21:29:25 +08:00
|
|
|
...
|