blob: 9767e14903c317ffd129259988369ddcda21469a [file] [log] [blame]
# .option norelax
# .global _start
#
# _start:
# auipc a0, %pcrel_hi(_start + 4)
# addi a0, a0, %pcrel_lo(_start)
#
# .section .reloc_neg, "ax", @progbits
# L1:
# auipc a0, %pcrel_hi(L1 - 2)
# addi a0, a0, %pcrel_lo(L1)
#
#
# REQUIRES: riscv
# RUN: yaml2obj %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: obj2yaml %t | FileCheck %s
#
# CHECK: - Name: .text
# CHECK: Content: '1705000013054500'
# 11000: 00000517 auipc a0,0x0
# 11004: 00450513 addi a0,a0,4 # 11004 <_start+0x4>
#
# CHECK: - Name: .reloc_neg
# CHECK: Content: 170500001305E5FF
# 11008: 00000517 auipc a0,0x0
# 1100c: ffe50513 addi a0,a0,-2 # 11006 <_start+0x6>
--- !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: '1705000013050500'
- Name: .rela.text
Type: SHT_RELA
Flags: [ SHF_INFO_LINK ]
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000000
Symbol: _start
Type: R_RISCV_PCREL_HI20
Addend: 4
- Offset: 0x0000000000000004
Symbol: _start
Type: R_RISCV_PCREL_LO12_I
- 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_neg
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000001
Content: '1705000013050500'
- Name: .rela.reloc_neg
Type: SHT_RELA
Flags: [ SHF_INFO_LINK ]
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .reloc_neg
Relocations:
- Offset: 0x0000000000000000
Symbol: L1
Type: R_RISCV_PCREL_HI20
Addend: -2
- Offset: 0x0000000000000004
Symbol: L1
Type: R_RISCV_PCREL_LO12_I
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_neg
Type: STT_SECTION
Section: .reloc_neg
- Name: L1
Section: .reloc_neg
Global:
- Name: _start
Section: .text
...