unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: guile-devel@gnu.org
Subject: Linking to libraries in the ELF?
Date: Fri, 29 Jan 2021 17:20:40 +0100	[thread overview]
Message-ID: <875z3fr9yf.fsf@telenet.be> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 375 bytes --]

Hi guilers,

I've got this crazy idea a few days ago, about the FFI interface.
When a program written in C is compiled with some shared libraries,
these libraries are referred to in special [insert ELF terminology
here] of the binary.  I wonder if it would be reasonable and feasible
to do something similar for compiles guile modules?

C example:
$ readelf -d `which guile`

[-- Attachment #1.2: Type: text/plain, Size: 429 bytes --]

  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libguile-3.0.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libgc.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libffi.so.7]
 [snip]
 0x000000000000001d (RUNPATH)            Library runpath: [[snip]]
 [snip]

[-- Attachment #1.3: Type: text/plain, Size: 115 bytes --]


Hypothetical Scheme example:
$ readelf -d $HOME/.guix-profile/lib/guile/3.0/site-ccache/chickadee/audio/vorbis.go

[-- Attachment #1.4: Type: text/plain, Size: 539 bytes --]

  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libvorbisfile.so.3]
 0x000000000000001d (RUNPATH)            Library runpath: [[snip]]
 0x0000000037146003 (<unknown>: 37146003) 0x3000002
 0x0000000037146002 (<unknown>: 37146002) 0xe8
 0x0000000037146000 (<unknown>: 37146000) 0x20000
 0x0000000037146001 (<unknown>: 37146001) 0xaaa0
 0x000000000000000c (INIT)               0x6bd0
 0x0000000037146004 (<unknown>: 37146004) 0x15530
 0x0000000000000000 (NULL)               0x0

[-- Attachment #1.5: Type: text/plain, Size: 195 bytes --]


This would require fleshing out some details though,
such as when to use RUNPATH and when not, cross-platform support,
where to find the libraries, some things I probably forgot.

WDYT?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

             reply	other threads:[~2021-01-29 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 16:20 Maxime Devos [this message]
2021-03-09 21:04 ` Linking to libraries in the ELF? Andy Wingo

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=875z3fr9yf.fsf@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guile-devel@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).