Blackfin and version scripts
wk at gnupg.org
Tue Jun 22 11:42:43 CEST 2010
Mike and Robin found a build problem with libgcrypt on Blackfin using
the GNU toolchain: Libgcrypt as most other GnuPG related libraries tries
to keep a well defined ABI and thus use a version script to guarantee
that. The version script is passed to libtool this way:
libgcrypt_version_script_cmd = -Wl,--version-script=$(srcdir)/libgcrypt.vers
libgcrypt_la_LDFLAGS = $(no_undefined) $(export_symbols) \
$(libgcrypt_version_script_cmd) -version-info \
$(no_undefined) $(export_symbols) are only used for W32 and not defined
if we have version script support.
Now, versions scripts are using the symbols verbatim as in the C code:
Blackfin seems to be the only platform which has version script support
and prefixes symbols with underscores. That does not work of course.
Ways to fix this are:
(1) Use autoconf to create a foo.vers from foo.vers.in while prefixing
all symbols like
@SYMBOL_PREFIX at gcry_check_version; @SYMBOL_PREFIX at gcry_control;
I think this looks too ugly and has also the drawback that we need to
get libtool's idea of the symbol prefix into autoconf. For libgcrypt
thsi is easy becuase due to the assembler modules we need to know it
anyway; but other libs don't need to know this.
(2) Another solution would be to sed the file on the fly in the
Makefile. This is better but requires that we need to maintain this
code in all projects.
(3) Introduce an new option in LD which tells it to use the native
symbol prefix of the platform for all symbols in the versions script.
This may take some time until it is implemneted and widely availabale.
(4) Let libtool do something. This may be an option to detect
-Wl,--version-script=foo on the command line and hook in a sed to
transform the symbols. It is pretty common that symols are all prefixed
with something like "foo_" or "_foo_" and thus the option could take a
list of these prefixes and - if a symbol prefix is required - transform
the version script.
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gcrypt-devel