Re: Hiding symbols in DSOs



gga <GGarramuno@xxxxxxx> writes:

By using strip and -fvisibility=hidden, I can most symbols from my own
code under all circumstances.
....
But I am unable to hide the symbols from the licensing library, when I

Probably because these symbols were not marked hidden.

Somehow gcc seems to think the symbols need to be exposed.

You didn't tell it otherwise, why should it think differently?

I am
looking for an easy way to strip the symbols from this static library
using either strip or during the compile/linking phase.

Use linker script to localize all undesirable symbols:

$ cat junk.c
void license_foo() { }
void license_bar() { }
void client_api() { }

$ cat junk.lds
MYLIB {
local:
license*;
};

$ gcc -shared -fPIC junk.c -Wl,--version-script,junk.lds -o junk.so && strip junk.so

$ nm -D junk.so | egrep 'license|client'
0000000000000844 T client_api

$ nm junk.so
nm: junk.so: no symbols

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.



Relevant Pages

  • About the remoting event
    ... callback port in the client side, but told that these was an exception on the ... static void Main ... Cat cat = new Cat; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: help needed with K&R code on p. 87
    ... >void printd ... The code is typical terse ... The output I get is 123, but I am not really sure how the recursion ... novice programmer rather than the newcomer to C. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: help in quicksort
    ... how many recursive calls will quicksort make in the worst case ... While I see how you can limit the worst case _depth_ of recursion to ... void q0sort(void *base, size_t nmemb, size_t size, ...
    (comp.lang.c)
  • Re: */ in string confuses checkpatch.pl
    ... The below code confuses checkpatch.pl ver 0.21. ... void foo ... 1 errors, 0 warnings, 5 lines checked ... $ cat ../checkpatch/Z213.c ...
    (Linux-Kernel)
  • Re: About the remoting event
    ... define a callback interface that the client implements, ... static void Main ... Cat cat = new Cat; ...
    (microsoft.public.dotnet.languages.csharp)