guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linking to libraries in the ELF?


From: Maxime Devos
Subject: Linking to libraries in the ELF?
Date: Fri, 29 Jan 2021 17:20:40 +0100

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`
  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]
Hypothetical Scheme example:
$ readelf -d 
$HOME/.guix-profile/lib/guile/3.0/site-ccache/chickadee/audio/vorbis.go
  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
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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]