[Libreoffice] linking against a .a and *not* exporting those symbols ?

Caolán McNamara caolanm at redhat.com
Wed Jul 27 01:18:07 PDT 2011


On Tue, 2011-07-26 at 18:19 +0100, Michael Meeks wrote:
> Hi Caolan,
> 
> On Tue, 2011-07-26 at 15:46 +0100, Caolán McNamara wrote:
...
> > nm -D workdir/unxlngx6/LinkTarget/Library/libooxlo.so|grep
> > EVP_MD_CTX_create
> > 0000000000666d00 T EVP_MD_CTX_create
> 
> 	That is really dumb :-) this is presumably the joy of using visibility
> markup instead of map files.

Yeah, its a downside of using visibility markup vs map files.

> I believe if we compile it with:
> 
> 	-fvisibility=hidden
> 
> 	Then all of its symbols should disappear when we link them into liboox
> - if we're lucky, perhaps some of the code will go too.
> 
> 	Or perhaps I mis-understood ;-) is it easy to inject those flags ?

Not particularly easy, but ended up doing that anyway.

 I was sort of hoping for a fire-once solution which could be wrapped
around all .a files we link against without having to go around custom
hacking various externals. Those makefile.mks are already in
impossible-to-read land :-(

something like...

echo "FOO {"
echo "    local:"
nm --defined-only -g *.a | grep -v "^$" | grep -v : | cut -d' ' -f 3 |
sed 's/.*/&;/'
echo "    global:"
echo "        *;"
echo "};"

would probably work to generate a suitable map file, but then have to
collect up which libs are .a's on a given link execution, generate a
single map file from them, pass it to the compiler, etc. etc. 

Anyway, for this specific case we currently build both shared and static
libs in openssl, but indeed only deliver and use the static ones under
unix platforms.

a) We can't disable shared libs, because then the static libs build
without -fPIC, and aren't suitable for inclusion into a final .so
b) We can't just use CFLAGS because the openssl build system doesn't use
honour it
c) We can munge the flag in through $CC however
d) We then have to *just* build with make build_libs to avoid building
the openssl demos and tools which would attempt to link against the new
useless shared libs that export no symbols

C.



More information about the LibreOffice mailing list