Displaying 3 results from an estimated 3 matches for "00010054".
Did you mean:
00000054
2016 Sep 07
5
[LLD] Writing thunks before the corresponding section
Hi,
MIPS LA25 thunk is used to call PIC function from non-PIC code.
Usually it contains three instructions:
lui $25, %hi(func)
addiu $25, $25, %lo(func)
j func
We can write such thunk in an arbitrary place of the generated file.
But if a PIC function requires the thunk is the first routine in a
section, we can optimize the code and escape jump instruction. To do
so we just write the
2017 Jul 12
5
[LLD] Linker Relaxation
...00 <_start>:
0: 852a mv a0,a0
2: 00 01 00 # R_RISCV_ALIGN
2: R_RISCV_ALIGN *ABS*+0x3
5: 4501 li a0,0
The linker then remove 1 byte from padding to align to the desired width:
00010054 <_start>:
10054: 852a mv a0,a0
10056: 0001 nop
10058: 4501 li a0,0
This essentially shrinks code size and must be performed as RISC-V
instructions must be 2-byte aligned. Therefore lld must be able...
2017 Jul 11
8
[LLD] Linker Relaxation
Here's an example using the gcc toolchain for embedded 32 bit RISC-V (my
HiFive1 board):
#include <stdio.h>
int foo(int i){
if (i < 100){
printf("%d\n", i);
}
return i;
}
int main(){
foo(10);
return 0;
}
After compiling to a .o with -O2 -march=RV32IC we get (just looking at foo)
00000000 <foo>:
0: 1141 addi sp,sp,-16