pabs3 has quit [Read error: Connection reset by peer]
pabs3 has joined #riscv
peepsalot has joined #riscv
peeps[zen] has quit [Ping timeout: 245 seconds]
jacklsw has joined #riscv
[itchyjunk] has quit [Read error: Connection reset by peer]
hendursa1 has quit [Ping timeout: 276 seconds]
cp- has quit [Ping timeout: 245 seconds]
hendursaga has joined #riscv
cp- has joined #riscv
jacklsw has quit [Ping timeout: 265 seconds]
cp- has quit [Excess Flood]
cp- has joined #riscv
peeps[zen] has joined #riscv
peepsalot has quit [Ping timeout: 265 seconds]
Narrat has joined #riscv
cp- has quit [Read error: Connection reset by peer]
mahmutov has joined #riscv
___nick___ has joined #riscv
jjido has joined #riscv
cp- has joined #riscv
EchelonX has joined #riscv
<EchelonX>
Would someone be able to help me understand why I can not get linker relaxation to work in my program?
<jrtc27>
if you post details of what you're doing and what problems you hit someone might
<EchelonX>
Operations which should be able to occur relative to GP with a single instruction, do not get simplified from AUIPC and Lx, Sx, ADDI, etc...]
<EchelonX>
Well I'm trying to better understand RISC-V and have been attempting to write an SBI implementation
<EchelonX>
But...currently, I am just trying to write some machine-level code
<EchelonX>
It is probably just easier if I point you to the Github REPO where it is
<EchelonX>
Just a minute, I need to push the latest changes
<EchelonX>
jrtc27: The linker script is ./emulation.ld, the entry point is in ./src/kernel/kstart_entry.s
<EchelonX>
And that calls the C function kmain() in ./src/kernel/kernel.c
<EchelonX>
Building is easy. Just make sure that you set the correct tuple at the start of the Makefile. Then run "make all"
<EchelonX>
Emulation can be done with "make emu" or "make emu-debug", assuming you have QEMU installed
<EchelonX>
"make debug" run in another terminal will connect GDB to "make emu-debug" to allow stepping through instructions
<EchelonX>
jrtc27: Anyway, the problem is that even though I have defined __global_pointer$ in ./emulation.ld it still doesn't relax references to global variables, etc...
<EchelonX>
I don't understand why
<jrtc27>
saying "go build my software" is not a good way to get people to help you
<jrtc27>
reduce it down to a simple example
<jrtc27>
and there is no kstart_entry.s, only entry.s
<EchelonX>
Branch riscv_sbi
<EchelonX>
And, yes, I agree. It's just kind of hard to reduce further. Most of what is there is just infrastructure.
<EchelonX>
It doesn't actually do much
<jrtc27>
it does way more than it needs to
<jrtc27>
have a single file, one or two commands to build the tiny example
<EchelonX>
There is a lot of unused stuff, but the current execution pathway is very simple
<EchelonX>
I will try to break it down for you
<EchelonX>
Into one file
<EchelonX>
Just a minute
mmohammadi9812 has joined #riscv
adjtm_ has quit [Remote host closed the connection]
<jrtc27>
it doesn't work because my_string is right on the boundary
<jrtc27>
binutils is conservative in what it relaxes since there are cases where not doing so would be unsound
<jrtc27>
as relaxation itself moves things
<EchelonX>
Okay, let me try that
Ivii has joined #riscv
<jrtc27>
though it seems to work with 0x7ff
<jrtc27>
this might just be an off-by-one error for the negative case
<EchelonX>
Yes. I just tried that too. Hmm...now I have to figure out what is different in my larger program for it not be working.
Ivii has quit [Client Quit]
Ivii has joined #riscv
<jrtc27>
exactly
<jrtc27>
this is the value of reducing the code
<jrtc27>
not just that it's a courtesy to someone helping you
rjek has left #riscv [#riscv]
BOKALDO has quit [Quit: Leaving]
unmanbearpig has joined #riscv
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #riscv
mmohammadi9812 has quit [Remote host closed the connection]
mwbrown has joined #riscv
<EchelonX>
jrtc27: Looks to be mostly working now. It seems like an alignment conflict was hampering the linkers decision to relax the instructions. I eased the alignment constraints and it is much more actively relaxing very the GP. For some reason, it is still not relaxing access to the strings in .rodata
<EchelonX>
Not really sure why, but it must be some protection measure against breaking the code
<jrtc27>
string constants from C aren't relaxed because they're special, they go in SHF_MERGE sections
<jrtc27>
which means they jump around all over the place during linking
<EchelonX>
Do you have any links for further reading on that?