| # .option norelax |
| # .global _start |
| # _start: |
| # call _start + 4 |
| # |
| # .section .reloc_neg, "ax", @progbits |
| # L1: |
| # call L1 - 4 |
| # |
| # 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: '97000000E7804000' |
| # |
| # 11000: 00000097 auipc ra,0x0 |
| # 11004: 004080e7 jalr 4(ra) |
| # |
| # CHECK: - Name: .reloc_neg |
| # CHECK: Content: 97000000E780C0FF |
| # |
| # 11008: 00000097 auipc ra,0x0 |
| # 1100c: ffc080e7 jalr -4(ra) |
| |
| --- !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: '97000000E7800000' |
| - Name: .rela.text |
| Type: SHT_RELA |
| Flags: [ SHF_INFO_LINK ] |
| Link: .symtab |
| AddressAlign: 0x0000000000000004 |
| Info: .text |
| Relocations: |
| - Offset: 0x0000000000000000 |
| Symbol: _start |
| Type: R_RISCV_CALL |
| Addend: 4 |
| - 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: '97000000E7800000' |
| - 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_CALL |
| Addend: -4 |
| 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 |
| ... |