forked from OSchip/llvm-project
162 lines
4.8 KiB
Plaintext
162 lines
4.8 KiB
Plaintext
# .option norelax
|
|
# .global _start
|
|
#
|
|
# .section .reloc_zero, "ax", @progbits
|
|
# _start:
|
|
# L1:
|
|
# jal x0, L1
|
|
# L2:
|
|
# c.jal L2
|
|
#
|
|
# .section .reloc_max, "ax", @progbits
|
|
# L3:
|
|
# jal x0, L3 + 0xffffe
|
|
# L4:
|
|
# c.jal L4 + 0x7fe
|
|
#
|
|
# .section .reloc_min, "ax", @progbits
|
|
# L5:
|
|
# jal x0, L5 - 0x100000
|
|
# L6:
|
|
# c.jal L6 - 0x800
|
|
#
|
|
# REQUIRES: riscv
|
|
# RUN: yaml2obj %s -o %t.o
|
|
# RUN: ld.lld %t.o -o %t
|
|
# RUN: obj2yaml %t | FileCheck %s
|
|
#
|
|
# CHECK: - Name: .reloc_zero
|
|
# CHECK: Content: 6F0000000120
|
|
# 11000: 0000006f j 11000
|
|
# 11004: 2001 jal 11004
|
|
#
|
|
# CHECK: - Name: .reloc_max
|
|
# CHECK: Content: 6FF0FF7FFD2F
|
|
# 11006: 7ffff06f j 111004
|
|
# 1100a: 2ffd jal 11808
|
|
#
|
|
# CHECK: - Name: .reloc_min
|
|
# CHECK: Content: 6F0000800130
|
|
# 1100c: 8000006f j fff1100c
|
|
# 11010: 3001 jal 10810
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_RISCV
|
|
Flags: [ EF_RISCV_RVC, EF_RISCV_FLOAT_ABI_SOFT ]
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x0000000000000002
|
|
Content: ''
|
|
- Name: .data
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_WRITE, SHF_ALLOC ]
|
|
AddressAlign: 0x0000000000000001
|
|
Content: ''
|
|
- Name: .bss
|
|
Type: SHT_NOBITS
|
|
Flags: [ SHF_WRITE, SHF_ALLOC ]
|
|
AddressAlign: 0x0000000000000001
|
|
- Name: .reloc_zero
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x0000000000000001
|
|
Content: 6F0000000120
|
|
- Name: .rela.reloc_zero
|
|
Type: SHT_RELA
|
|
Flags: [ SHF_INFO_LINK ]
|
|
Link: .symtab
|
|
AddressAlign: 0x0000000000000004
|
|
Info: .reloc_zero
|
|
Relocations:
|
|
- Offset: 0x0000000000000000
|
|
Symbol: L1
|
|
Type: R_RISCV_JAL
|
|
- Offset: 0x0000000000000004
|
|
Symbol: L2
|
|
Type: R_RISCV_RVC_JUMP
|
|
- Name: .reloc_max
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x0000000000000001
|
|
Content: 6FF0FF7FFD2F
|
|
- Name: .rela.reloc_max
|
|
Type: SHT_RELA
|
|
Flags: [ SHF_INFO_LINK ]
|
|
Link: .symtab
|
|
AddressAlign: 0x0000000000000004
|
|
Info: .reloc_max
|
|
Relocations:
|
|
- Offset: 0x0000000000000000
|
|
Symbol: L3
|
|
Type: R_RISCV_JAL
|
|
Addend: 1048574
|
|
- Offset: 0x0000000000000004
|
|
Symbol: L4
|
|
Type: R_RISCV_RVC_JUMP
|
|
Addend: 2046
|
|
- Name: .reloc_min
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x0000000000000001
|
|
Content: 6F0000800130
|
|
- Name: .rela.reloc_min
|
|
Type: SHT_RELA
|
|
Flags: [ SHF_INFO_LINK ]
|
|
Link: .symtab
|
|
AddressAlign: 0x0000000000000004
|
|
Info: .reloc_min
|
|
Relocations:
|
|
- Offset: 0x0000000000000000
|
|
Symbol: L5
|
|
Type: R_RISCV_JAL
|
|
Addend: -1048576
|
|
- Offset: 0x0000000000000004
|
|
Symbol: L6
|
|
Type: R_RISCV_RVC_JUMP
|
|
Addend: -2048
|
|
Symbols:
|
|
Local:
|
|
- Name: .text
|
|
Type: STT_SECTION
|
|
Section: .text
|
|
- Name: .data
|
|
Type: STT_SECTION
|
|
Section: .data
|
|
- Name: .bss
|
|
Type: STT_SECTION
|
|
Section: .bss
|
|
- Name: .reloc_zero
|
|
Type: STT_SECTION
|
|
Section: .reloc_zero
|
|
- Name: L1
|
|
Section: .reloc_zero
|
|
- Name: L2
|
|
Section: .reloc_zero
|
|
Value: 0x0000000000000004
|
|
- Name: .reloc_max
|
|
Type: STT_SECTION
|
|
Section: .reloc_max
|
|
- Name: L3
|
|
Section: .reloc_max
|
|
- Name: L4
|
|
Section: .reloc_max
|
|
Value: 0x0000000000000004
|
|
- Name: .reloc_min
|
|
Type: STT_SECTION
|
|
Section: .reloc_min
|
|
- Name: L5
|
|
Section: .reloc_min
|
|
- Name: L6
|
|
Section: .reloc_min
|
|
Value: 0x0000000000000004
|
|
Global:
|
|
- Name: _start
|
|
Section: .reloc_zero
|
|
...
|