frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

16-Bit Data Pointers on RV32

https://wren.wtf/shower-thoughts/16-bit-data-pointers-on-rv32/
3•todsacerdoti•2mo ago

Comments

fwsgonzo•2mo ago
That's cool! I do have a habit of writing ELF post-processors as a part of the CMake build system I inevitably end up writing. There's a handy POST_BUILD you can attach to programs which I use very often for things like execute-only (XO) and apparently also to rewrite function entries for functions I can't --wrap.

Example: https://github.com/varnish/libvmod-riscv/blob/main/program/c...

chperm can change the permissions of a segment to just execute, instead of read+execute. Of course, you will need a custom linker script because the default linker scripts will merge .text and read-only data to save space.

Currently, I'm battling a Rust program that has a built-in function called __memcmpeq, which isn't a global, so I can't --wrap it.

wren6991•2mo ago
ELF patching is a last resort! We do have some really awful Python ELF patching in the RP2350 ROM build to implement a missing relocation for 16-bit pointers in `movw` instructions, which also saves a ton of space.