bug-gnulib
[Top][All Lists]
Advanced

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

Re: linker-script.m4?


From: Simon Josefsson
Subject: Re: linker-script.m4?
Date: Mon, 02 Mar 2009 14:58:36 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.90 (gnu/linux)

Ralf Wildenhues <address@hidden> 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 @@
>> address@hidden Library Version Scripts
>> address@hidden 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:
>> +
>> address@hidden
>> +if HAVE_LD_VERSION_SCRIPT
>> +libfoo_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libfoo.map
>> +endif
>> address@hidden 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 <address@hidden>
Date: Mon, 2 Mar 2009 14:58:05 +0100
Subject: [PATCH] Mention libtool -export-symbols as a backup alternative.
 Suggested by Ralf Wildenhues <address@hidden>.

---
 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
address@hidden  It will hide internal symbols from your
+library, but will not add ELF versioning symbols.  Your usage would
+then be something like:
+
address@hidden
+if HAVE_LD_VERSION_SCRIPT
+libfoo_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libfoo.map
+else
+libfoo_la_LDFLAGS += -export-symbols $(srcdir)/libfoo.sym
+endif
address@hidden smallexample
+
+See the Libtool manual for the file syntax, but a small example would
+be:
+
address@hidden
+libfoo_init
+libfoo_doit
+libfoo_done
address@hidden 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}:
+
address@hidden
+if HAVE_LD_VERSION_SCRIPT
+libfoo_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libfoo.map
+else
+libfoo_la_LDFLAGS += -export-symbols-regex '^libfoo_.*'
+endif
address@hidden smallexample
-- 
1.5.6.5





reply via email to

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