On 11/9/24 7:15 AM, Olivier Dion wrote:
Hi,
TLDR; Is there a way to embed a bytevector into a ELF section of a
compiled module (.go)?
I have a case where I want to generate bytevectors that follow an ABI
for event description of static tracepoints. I would like this
bytevector to be put into a know ELF section of the compiled module so
that external tools can reference it by parsing the ELF file,
i.e. without running Guile. I personnaly don't care about none-ELF
systems, so I'm fine if this solution is Linux only.
I guess this is similar to embedding something else like an audio/image
for a video game.
So, is there any way for adding section to the compiled ELF, something
along like:
(embed-bytevector ".my_section"
#vu8(bytes ...))
If not, I wonder if this is something that could be appreciated for
other users as well?
Thanks,
Olivier
You could look at `objcopy' to add a section to the .go file (outside of
Guile).
Otherwise, dig into the code in share/guile/3.0/system/vm/elf.scm.
Matt