unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: Using a linker version script
Date: Fri, 14 Aug 2009 00:15:26 +0200	[thread overview]
Message-ID: <8763crz7gh.fsf@gnu.org> (raw)
In-Reply-To: 87zla35q8o.fsf@arudy.ossau.uklinux.net

Hi Neil,

Neil Jerram <neil@ossau.uklinux.net> writes:

> I looked at the ld doc, but that didn't make it obvious what the
> benefit of this is; could you explain?

The main advantage is that executables/libraries that use versioned
symbols include the required version in their symbol table:

  $ objdump -T guile | grep scm_
  0000000000000000      DF *UND*  0000000000000000  GUILE_2.0   scm_shell
  0000000000000000      DF *UND*  0000000000000000  GUILE_2.0   scm_boot_guile

This allows the dynamic linker to make sure the required version of each
symbol is available.

It also makes it possible to provide two versions of the same symbol,
e.g.:

  SCM scm_from_string (const char *)                --> GUILE_2.0
  SCM scm_from_string (const char *, scm_t_handler) --> GUILE_2.1

Applications that were compiled against libguile 2.0 will keep using the
GUILE_2.0 version of the function, while those compiled against 2.1 will
use the GUILE_2.1 version.

Technically, defining multiple versions of a given symbol is achieved
using the `.symver' GNU as directive:

   __asm__ (".symver scm_from_string_v2_0,scm_from_string@GUILE_2.0");
   __asm__ (".symver scm_from_string,scm_from_string@GUILE_2.1");

> Also, does having this script make it any harder to remove something
> from the API in future (e.g. by changing its declaration from SCM_API
> to SCM_INTERNAL)?

No.  Symbol versions and available symbols are managed manually.

Thanks,
Ludo'.





  reply	other threads:[~2009-08-13 22:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-09 21:45 Using a linker version script Ludovic Courtès
2009-08-13 22:00 ` Neil Jerram
2009-08-13 22:15   ` Ludovic Courtès [this message]
2009-08-14 11:53     ` Neil Jerram
2009-08-14 14:16       ` Ludovic Courtès
2009-08-14 20:59         ` Neil Jerram

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=8763crz7gh.fsf@gnu.org \
    --to=ludo@gnu.org \
    --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).