libport: Mark internal functions and data tables as hidden.

Francois Gouget fgouget at free.fr
Thu Mar 3 04:05:06 CST 2016


On Tue, 1 Mar 2016, Francois Gouget wrote:

> On Tue, 1 Mar 2016, Francois Gouget wrote:
> [...]
> > I'm trying a Solaris upgrade to see if it makes a difference.
> 
> The upgrade made no difference :-(
> gcc seems to be using the Solaris linker which had no update rather than 
> GNU ld.

So the problem is that on Solaris gcc does not really support the 
visibility attribute. This typically yields lots of harmless 'visibility 
attribute not supported in this configuration' warnings. But while there 
is no .hidden attribute in the assembly code, the attribute still 
impacts the assembly. For instance:

-       movl    wine_digitmap at GOT(%ebx), %eax
+       leal    wine_digitmap at GOTOFF(%ebx), %eax
and
-       call    wine_decompose at PLT
+       call    wine_decompose

This change is what causes these errors:
 * 'relocation error: R_386_GOTOFF' for the tables and 'read-only 
   segment has dynamic relocations' with the Solaris linker 
   (5.11-1.2458).
 * 'relocations remain against allocatable but non-writable sections' 
   in both cases with the GNU linker (2.23.1, 
   LD_ALTEXEC=/usr/sfw/bin/gld).


Given that the visibility attribute does not work it seems like the best 
would be to not use it.

* One could check for it with autoconf. But autoconf macros are not 
  allowed in Wine's headers (for good reason).
  https://stackoverflow.com/questions/5987219/best-practices-for-probing-for-symbol-visibility-extensions-in-autoconf

* Or we could let the user decide whether he really wants to hide 
  symbols by providing him with a NO_HIDDEN_SYMBOLS macro in winnt.h. 
  This would sort of be the equivalent of the NONAMELESSSTRUCT macros. 
  Then of course we would immediately turn around and use autoconf to 
  decide whether to set it when compiling Wine so it's not all that 
  different from the above option.

* Another option would be to check for __sun in winnt.h:

  -#elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
  +#elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) && !defined(__sun)

  The drawback is it means we will never use the visibility attribute on 
  Solaris, even if it is supported (one day or in some configuration). 
  That's probably a very minor drawback and it seems like the simplest 
  solution so maybe this would make sense.


Thoughts?

-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
                            1 + e ^ ( i * pi ) = 0



More information about the wine-devel mailing list