[Mesa-dev] glx-tls: Visibility hidden attribute and fix x86/x86_64 tls/tdsentry points

Marc Dietrich marvin24 at gmx.de
Tue Sep 29 02:31:50 PDT 2015


Am Samstag, 26. September 2015, 04:47:19 schrieb Sedat Dilek:
> On Sat, Sep 26, 2015 at 1:59 AM, Sedat Dilek <sedat.dilek at gmail.com> wrote:
> > Hi,
> > 
> > unfortunately, we still have no cool upstream fix for
> > -fvisibility=hidden compiler flag handling.
> > There is still no visibility-attribute "hidden" available or defined.
> > 
> > I see people again fell over this issue [2].
> > 
> > I have one concern...
> > 
> > GCC uses "default" visibility-attribute (defined as PUBLIC) when
> > compiler-flag "-fvisibility=hidden" is used.
> > But CLANG needs in some cases "hidden" visibility-attribute.
> > 
> > [ src/util/macros.h ]
> > 
> > /**
> > 
> >  * PUBLIC/USED macros
> >  *
> >  * If we build the library with gcc's -fvisibility=hidden flag, we'll
> >  * use the PUBLIC macro to mark functions that are to be exported.
> >  *
> >  * We also need to define a USED attribute, so the optimizer doesn't
> >  * inline a static function that we later use in an alias. - ajax
> >  */
> > 
> > #ifndef PUBLIC
> > #  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
> > #    define PUBLIC __attribute__((visibility("default")))
> > #    define USED __attribute__((used))
> > #  elif defined(_MSC_VER)
> > #    define PUBLIC __declspec(dllexport)
> > #    define USED
> > #  else
> > #    define PUBLIC
> > #    define USED
> > #  endif
> > #endif
> > 
> > #ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY
> > #define HIDDEN __attribute__((visibility("hidden")))
> > #else
> > #define HIDDEN
> > #endif
> > 
> > [ src/util/macros.h ]
> > 
> > Alan pointed to a solution like in [4] ("Use clang's __has_attribute
> > to check for attribute support")
> > 
> > So, what can people do to help to nail this down?
> > 
> > I have attached a refreshed version of Marc's and added the TDS
> > snippet from [2] to 0002 patch.
> > ( Patches have no changelog and are against mesa v10.6.8. )
> > 
> > Hope this helps!
> > 
> > Regards,
> > - Sedat -
> > 
> > [1]
> > https://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg76122.html
> > [2] http://patchwork.freedesktop.org/patch/49494/
> > [3]
> > https://developer.apple.com/library/mac/documentation/DeveloperTools/Conc
> > eptual/CppRuntimeEnv/Articles/SymbolVisibility.html [4]
> > http://cgit.freedesktop.org/xorg/proto/x11proto/commit/?id=ffd4a13042d24c
> > b5c
> So, I played a bit more and the result is a v3 of both patches with
> some simplification etc.
> 
> Emil asked in another thread to check with --enable-asm and
> --{en|dis}able-shared-glapi, but disabling for the latter was not
> suitable for my setup (disabling OpenGL resulted in a conflict with
> dri-drivers etc.).
> 
> Brian asked if this works with GCC v4.9 - yes.

As expressed before, using hidden attribute only hides some hack on how to 
find the head of the dispatch entry table afaict.

I just replaced it with shared_dispatch_stub_0() and this works for shared-
glapi case, but not without shared-api (the first function is named 
differently). IMHO, a better fix would be to mark the head of the dispatch 
table for all cases and use this mark instead of the asm hack.

Marc




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150929/15a19394/attachment.sig>


More information about the mesa-dev mailing list