Ralf Wildenhues <ralf.wildenh...@gmx.de> writes:

> Hi Simon,
>
> * Simon Josefsson wrote on Mon, Mar 02, 2009 at 11:02:44AM CET:
>> --- /dev/null
>> +++ b/doc/linker-script.texi
>> @@ -0,0 +1,26 @@
>> +...@node Library Version Scripts
>> +...@section Library Version Scripts
>> +
>> +The @code{linker-script} module can be used to add shared library
>> +versioning support.  You use the module by importing it to your
>> +library, and then add the following lines to the @code{Makefile.am}
>> +that builds the library:
>> +
>> +...@smallexample
>> +if HAVE_LD_VERSION_SCRIPT
>> +libfoo_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libfoo.map
>> +endif
>> +...@end smallexample
>
> How about suggesting libtool's -export-symbols as a more portable but
> less powerful alternative for systems that do not support GNU ld version
> scripts?  Alternatively, of course support for, say, Solaris ld version
> scripts would be nice too.

Good idea.  How about the patch below?

/Simon

>From 77bbca3c2d4d87aa8e8ec7dd1d09386987a3f1ce Mon Sep 17 00:00:00 2001
From: Simon Josefsson <si...@josefsson.org>
Date: Mon, 2 Mar 2009 14:58:05 +0100
Subject: [PATCH] Mention libtool -export-symbols as a backup alternative.
 Suggested by Ralf Wildenhues <ralf.wildenh...@gmx.de>.

---
 doc/linker-script.texi |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/doc/linker-script.texi b/doc/linker-script.texi
index 26a270d..d03fc35 100644
--- a/doc/linker-script.texi
+++ b/doc/linker-script.texi
@@ -24,3 +24,38 @@ LIBFOO_1.0 @{
     *;
 @};
 @end smallexample
+
+If you target platforms that do not support linker scripts (i.e., all
+platforms that doesn't use GNU LD) you may want to consider a more
+portable but less powerful alternative: libtool
+...@code{-export-symbols}.  It will hide internal symbols from your
+library, but will not add ELF versioning symbols.  Your usage would
+then be something like:
+
+...@smallexample
+if HAVE_LD_VERSION_SCRIPT
+libfoo_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libfoo.map
+else
+libfoo_la_LDFLAGS += -export-symbols $(srcdir)/libfoo.sym
+endif
+...@end smallexample
+
+See the Libtool manual for the file syntax, but a small example would
+be:
+
+...@smallexample
+libfoo_init
+libfoo_doit
+libfoo_done
+...@end smallexample
+
+To avoid the need for a file if your symbols are easily expressed
+using a regular expression, you may use @code{-export-symbols-regex}:
+
+...@smallexample
+if HAVE_LD_VERSION_SCRIPT
+libfoo_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libfoo.map
+else
+libfoo_la_LDFLAGS += -export-symbols-regex '^libfoo_.*'
+endif
+...@end smallexample
-- 
1.5.6.5



Reply via email to