sail-riscv icon indicating copy to clipboard operation
sail-riscv copied to clipboard

Add DYN (Position-Independent Executable file) support

Open Arielfoever opened this issue 4 months ago • 10 comments

add a -d parameter for DYN files. Then give a offset, mostly 0x80000000 like openSBI.

Arielfoever avatar Jul 26 '25 12:07 Arielfoever

Test Results

2 101 tests  ±0   2 101 ✅ ±0   18m 3s ⏱️ +5s     1 suites ±0       0 💤 ±0      1 files   ±0       0 ❌ ±0 

Results for commit 1560d176. ± Comparison against base commit 87eb6fb8.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jul 26 '25 13:07 github-actions[bot]

I prefer and suggest we keep the -d option reserved for debug mode, and use a different one for this PR.

nadime15 avatar Jul 28 '25 14:07 nadime15

I prefer and suggest we keep the -d option reserved for debug mode, and use a different one for this PR.

which char do you like?

Arielfoever avatar Jul 29 '25 03:07 Arielfoever

In the other PR to update the CLI we've removed short options so when you rebase on that I'd just remove it.

Also I don't think having a single flag actually works because we support loading multiple elfs. We might need some syntax like foo.elf@0x100 bar.elf@0x400.

Timmmm avatar Jul 29 '25 06:07 Timmmm

Convert to draft since it needs https://github.com/riscv/sail-riscv/pull/1177 merging.

Arielfoever avatar Aug 04 '25 04:08 Arielfoever

Do we still need this pr? @Timmmm

Arielfoever avatar Nov 06 '25 15:11 Arielfoever

Yes, if we want to support loading executables at arbitrary offsets. I don't know how much demand there is for that though. What was the original motivation for this?

Timmmm avatar Nov 06 '25 15:11 Timmmm

I think the original motivation was loading the default OpenSBI payload.

pmundkur avatar Nov 06 '25 15:11 pmundkur

If I'm understanding this correctly (not a sure thing), the dynamic part lets the Sail model load ELFs at addresses that are in .json files, as opposed to some fixed address. The .S files should themselves be position independent (because they need to be run. We want that capability so that we can configure the Sail model to match what a DUT is actually executing (so exceptions report exactly the same EPC and TVAL, etc)

allenjbaum avatar Nov 06 '25 15:11 allenjbaum

I think the original motivation was loading the default OpenSBI payload.

That's correct.

Arielfoever avatar Nov 07 '25 11:11 Arielfoever