auipc t2,%got_pcrel_hi(printf)# 获取printf在GOT中的地址 ld t3,%pcrel_lo(t2)(t2)# 加载GOT条目(此时指向PLT) jalr t3 # 跳转到PLT条目 首次调用:PLT条目调用动态链接器解析printf的真实地址,并更新GOT。 后续调用:直接通过GOT跳转到真实地址。 2.6. 调试信息(DWARF) DWARF帮助调试器理解程序结构。例如...
auipc ra, %pcrel_hi(label) jalr ra, %pcrel_lo(label)(ra) ret:从子程序返回。 对应基本指令:jalr x0, 0(ra) 条件跳转伪指令 beqz rs, label:如果 rs == 0,跳转到 label。 对应基本指令:beq rs, x0, label bnez rs, label:如果 rs != 0,跳转到 label。 对应基本指令:bne rs, x0, lab...
0: R_RISCV_PCREL_HI20 msg 4: 00850513 addi a0,a0,8 # 8 <_start+0x8> 4: R_RISCV_PCREL_LO12_I .L11 1. 2. 3. 4. 5. Constants The following example shows loading a constant using the %hi and %lo assembler functions. AI检测代码解析 .equ UART_BASE, 0x40003000 lui a0, %h...
1: auipc t0, %pcrel_hi(mtvec) addi t0, t0, %pcrel(1b)Assembler NotationDescription %hi(symbol) Absolute(HI20) %lo(symbol) Absolute(LO12) %pcrel_hi(symbol) PC-relative (HI20) %pcrel_lo(label) PC-relative (LO12)nm软件nm软件可以列出目标文件中的符号。直接nm加上文件名,不使用交叉...
1: auipc t0, %pcrel_hi(global) addi t1, t0, %pcrel_lo(1b)+0 addi t0, t0, %pcrel_lo(1b)+8 .data .balign 4096 global: .fill 2, 8, 0 it's a fairly simple program: it takes the address of a global symbol and an offset into that global symbol. When assembled it generates...
.section.text.globl _start_start:1: auipca0, %got_pcrel_hi(msg)# load msg(hi)lda0, %pcrel_lo(1b)(a0)# load msg(lo)jalra, puts2:j2b.section.rodatamsg:.string"Hello World\n" which generates the following assembler output and relocations as seen by objdump: ...
At label:R_RISCV_PCREL_HI20relocation entry → symbol R_RISCV_PCREL_LO12_Irelocation entry → label GNU ld's error message isn't very obvious here, it says "missing matching%pcrel_hi", presumably because it's only looking in the same section? It's not actually saying anything about...
sync: binutils: fix relocation truncated to fit: R_RISCV_PCREL_HI20 Mar 4, 2024 contrib Vagrant plugin check so it will not fail in the middle of provisioning Nov 5, 2020 dejagnu @ c298959 dejagnu: Bump dejagnu to include multilib fix May 5, 2023 gcc @ f9ffd92 chore: binutils/gcc...
PCREL_LO12 relocation points to a symbol '.Lpcrel_hi2'++## This test is checking that we warn the user when the relocations in their+## object don't follow the RISC-V psABI. In particular, the psABI requires+## that PCREL_LO12 relocations are in the same section as the pcrel_...
PCREL_HI20 at c000001c [00000517] to sym=0x80209030 st_value=c0101000 _calc_imm: offset=1052644: hi=257 lo=-28 elf_read: Read 24 bytes from offset 216 elf_symvalue: Other: 0000001c+c0000000=c000001c up_relocateadd: PCREL_LO12_I at c0000020 [00050513] to sym=0x80209070 st_val...