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

Sedat Dilek sedat.dilek at gmail.com
Fri Sep 25 16:59:53 PDT 2015


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/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html
[4] http://cgit.freedesktop.org/xorg/proto/x11proto/commit/?id=ffd4a13042d24cb5c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-configure-add-visibility-macro-detection.patch
Type: text/x-patch
Size: 3137 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150926/bf12f898/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-mapi-add-visibility-hidden-to-tls-entry-points.patch
Type: text/x-patch
Size: 2260 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150926/bf12f898/attachment-0003.bin>


More information about the mesa-dev mailing list