unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: Re: Embedding stuff in ELF section of compiled module
Date: Sat, 9 Nov 2024 10:31:17 -0800	[thread overview]
Message-ID: <e73db99c-2d54-43cb-b095-76fb9f02fa4b@gmail.com> (raw)
In-Reply-To: <8734k0tp4x.fsf@laura>

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




  reply	other threads:[~2024-11-09 18:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-09 15:15 Embedding stuff in ELF section of compiled module Olivier Dion
2024-11-09 18:31 ` Matt Wette [this message]
2024-11-10 12:05 ` Maxime Devos via General Guile related discussions

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e73db99c-2d54-43cb-b095-76fb9f02fa4b@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).