[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using a linker version script
From: |
Ludovic Courtès |
Subject: |
Re: Using a linker version script |
Date: |
Fri, 14 Aug 2009 00:15:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Hi Neil,
Neil Jerram <address@hidden> 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,address@hidden");
__asm__ (".symver scm_from_string,address@hidden");
> 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'.