symbol hiding - with gcc -fvisibility

Guido Draheim guidod-2003- at gmx.de
Fri May 21 18:25:27 CDT 2004


Mike Hearn wrote:
> On Mon, 17 May 2004 04:05:51 +0200, Guido Draheim wrote:
> 
>>gcc supports the universal attribute syntax, and it does now know about more
>>symbol flavours as to their visibility. Probably you want to have "hidden".
>>Attached are two simple test*.c files and a makefile. The final sharedlib
>>symbol table contains only test3 after stripping. - using a linker script instead
>>of in-source __attribute__ is left as an excercise to the reader.
> 
> 
> Ah, thanks. I did actually try __attribute__((visibility("hidden"))) but
> it still left symbols in the .symtab - of course if you strip the binary
> as well, this disappears too.
> 



Yepp, it's kinda peculiar to need both -Wl,-x and strip -x, dunno why either.

Btw, since my mail was quoted on WWN I just had a chance to reread the stuff
and I noted immediatly there're lots'a little errors in it. Funny. Although nothing
misleading, let me atleast adjust for these two before someone else puts in:
- yes, ELF stands really for Executable and Linker Format. Originally designed to
  cover the needs of all the flavours of object files, library and executables, it has
  become such a success among unix systems because of its enormous flexibility.
- the visibility __attribute__ *is* present since 3.1/3.2 cycle but the commandline
   -fvisibility options are not. They are gcc 3.4 additions afaics - s/a gcc'zilla 15000
  (my examples were tested with gcc 3.2.2 before sending them to the list)

cheers,
-- guido                                  http://google.de/search?q=guidod




More information about the wine-devel mailing list