Marc Dietrich
2015-Feb-17 09:40 UTC
[LLVMdev] [PATCH 0/2 v3] add visibility hidden to tls entry points
Patch 1 adds a check for the compilers visibility macro to configure.ac. Patch 2 avoids redefined symbol errors in clang of the tls entry points. Based on a suggestion from Rafael Ávila de Espíndola <rafael.espindola at gmail.com> in http://llvm.org/bugs/show_bug.cgi?id=19778. Tested with gcc 4.9 and clang 3.6(rc) Marc Dietrich (2): configure: add visibility macro detection to configure add visibility hidden to tls entry points configure.ac | 28 ++++++---------------------- src/mapi/Makefile.am | 1 + src/mapi/entry_x86-64_tls.h | 4 ++-- src/mapi/entry_x86_tls.h | 5 +++-- src/mapi/entry_x86_tsd.h | 5 +++-- src/util/macros.h | 6 ++++++ 6 files changed, 21 insertions(+), 28 deletions(-) -- 2.2.2
Marc Dietrich
2015-Feb-17 09:40 UTC
[LLVMdev] [PATCH 1/2 v3] configure: add visibility macro detection to configure
This adds clang/gcc visibility macro detection to configure and util/macros.h. This is can be used to conveniently add e.g. a "HIDDEN" attribute to a function. Signed-off-by: Marc Dietrich <marvin24 at gmx.de> --- v2: use VISIBILITY_*FLAGS instead of *FLAGS directly v3: no change configure.ac | 28 ++++++---------------------- src/util/macros.h | 6 ++++++ 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 351027b..266764a 100644 --- a/configure.ac +++ b/configure.ac @@ -189,6 +189,7 @@ AX_GCC_FUNC_ATTRIBUTE([flatten]) AX_GCC_FUNC_ATTRIBUTE([format]) AX_GCC_FUNC_ATTRIBUTE([malloc]) AX_GCC_FUNC_ATTRIBUTE([packed]) +AX_GCC_FUNC_ATTRIBUTE([visibility]) AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes) @@ -245,17 +246,13 @@ if test "x$GCC" = xyes; then AC_MSG_RESULT([yes]), [CFLAGS="$save_CFLAGS -Wmissing-prototypes"; AC_MSG_RESULT([no])]); + CFLAGS=$save_CFLAGS # Enable -fvisibility=hidden if using a gcc that supports it - save_CFLAGS="$CFLAGS" - AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) - VISIBILITY_CFLAGS="-fvisibility=hidden" - CFLAGS="$CFLAGS $VISIBILITY_CFLAGS" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), - [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]); - - # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed. - CFLAGS=$save_CFLAGS + if test "x${ax_cv_have_func_attribute_visibility}" = xyes; then + VISIBILITY_CFLAGS="-fvisibility=hidden" + VISIBILITY_CXXFLAGS="-fvisibility=hidden" + fi # Work around aliasing bugs - developers should comment this out CFLAGS="$CFLAGS -fno-strict-aliasing" @@ -267,19 +264,6 @@ fi if test "x$GXX" = xyes; then CXXFLAGS="$CXXFLAGS -Wall" - # Enable -fvisibility=hidden if using a gcc that supports it - save_CXXFLAGS="$CXXFLAGS" - AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden]) - VISIBILITY_CXXFLAGS="-fvisibility=hidden" - CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS" - AC_LANG_PUSH([C++]) - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), - [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]); - AC_LANG_POP([C++]) - - # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed. - CXXFLAGS=$save_CXXFLAGS - # Work around aliasing bugs - developers should comment this out CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" diff --git a/src/util/macros.h b/src/util/macros.h index eec8b93..7682511 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -117,6 +117,12 @@ do { \ #define PRINTFLIKE(f, a) #endif +#ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY +#define HIDDEN __attribute__((visibility("hidden"))) +#else +#define HIDDEN +#endif + #ifdef HAVE_FUNC_ATTRIBUTE_MALLOC #define MALLOCLIKE __attribute__((__malloc__)) #else -- 2.2.2
Marc Dietrich
2015-Feb-17 09:40 UTC
[LLVMdev] [PATCH 2/2 v3] add visibility hidden to tls entry points
Avoid redefined symbol errors in clang. Based on a suggestion from Rafael Ãvila de EspÃndola <rafael.espindola at gmail.com> in http://llvm.org/bugs/show_bug.cgi?id=19778. Signed-off-by: Marc Dietrich <marvin24 at gmx.de> --- v2: - no change v3: - include util directory in Makefile.am in order to avoid relative include paths, - make tls entry points array const src/mapi/Makefile.am | 1 + src/mapi/entry_x86-64_tls.h | 4 ++-- src/mapi/entry_x86_tls.h | 5 +++-- src/mapi/entry_x86_tsd.h | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am index 6794682..c42ed52 100644 --- a/src/mapi/Makefile.am +++ b/src/mapi/Makefile.am @@ -45,6 +45,7 @@ AM_CPPFLAGS = \ $(SELINUX_CFLAGS) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mapi \ + -I$(top_srcdir)/src/util \ -I$(top_builddir)/src/mapi include Makefile.sources diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h index 71e9d60..2c5d64d 100644 --- a/src/mapi/entry_x86-64_tls.h +++ b/src/mapi/entry_x86-64_tls.h @@ -25,6 +25,7 @@ * Chia-I Wu <olv at lunarg.com> */ +#include "macros.h" #include "u_macros.h" __asm__(".text\n" @@ -62,8 +63,7 @@ entry_patch_public(void) { } -static char -x86_64_entry_start[]; +extern const char HIDDEN x86_64_entry_start[]; mapi_func entry_get_public(int slot) diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h index fa7bc15..a66edec 100644 --- a/src/mapi/entry_x86_tls.h +++ b/src/mapi/entry_x86_tls.h @@ -26,6 +26,7 @@ */ #include <string.h> +#include "macros.h" #include "u_macros.h" __asm__(".text"); @@ -72,8 +73,8 @@ __asm__(".text"); extern unsigned long x86_current_tls(); -static char x86_entry_start[]; -static char x86_entry_end[]; +extern const char HIDDEN x86_entry_start[]; +extern const char HIDDEN x86_entry_end[]; void entry_patch_public(void) diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h index ece00fa..1de2991 100644 --- a/src/mapi/entry_x86_tsd.h +++ b/src/mapi/entry_x86_tsd.h @@ -25,6 +25,7 @@ * Chia-I Wu <olv at lunarg.com> */ +#include "macros.h" #include "u_macros.h" #define X86_ENTRY_SIZE 32 @@ -59,8 +60,8 @@ __asm__(".balign 32\n" #include <string.h> #include "u_execmem.h" -static const char x86_entry_start[]; -static const char x86_entry_end[]; +extern const char HIDDEN x86_entry_start[]; +extern const char HIDDEN x86_entry_end[]; void entry_patch_public(void) -- 2.2.2
Sedat Dilek
2015-Feb-17 10:00 UTC
[LLVMdev] [PATCH 1/2 v3] configure: add visibility macro detection to configure
On Tue, Feb 17, 2015 at 10:40 AM, Marc Dietrich <marvin24 at gmx.de> wrote:> This adds clang/gcc visibility macro detection to configure and util/macros.h. > This is can be used to conveniently add e.g. a "HIDDEN" attribute to a function. > > Signed-off-by: Marc Dietrich <marvin24 at gmx.de> > --- > v2: use VISIBILITY_*FLAGS instead of *FLAGS directly > v3: no change > > configure.ac | 28 ++++++---------------------- > src/util/macros.h | 6 ++++++ > 2 files changed, 12 insertions(+), 22 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 351027b..266764a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -189,6 +189,7 @@ AX_GCC_FUNC_ATTRIBUTE([flatten]) > AX_GCC_FUNC_ATTRIBUTE([format]) > AX_GCC_FUNC_ATTRIBUTE([malloc]) > AX_GCC_FUNC_ATTRIBUTE([packed]) > +AX_GCC_FUNC_ATTRIBUTE([visibility]) > > AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes) > > @@ -245,17 +246,13 @@ if test "x$GCC" = xyes; then > AC_MSG_RESULT([yes]), > [CFLAGS="$save_CFLAGS -Wmissing-prototypes"; > AC_MSG_RESULT([no])]); > + CFLAGS=$save_CFLAGS > > # Enable -fvisibility=hidden if using a gcc that supports itCan you restore this comment with a general pointer to "...compiler that support it". BTW, what is the compiler option called for clang to suppress visibility(-hiden) feature - ... -fvisibility=no ? I would like to test w/o your patches. - Sedat -> - save_CFLAGS="$CFLAGS" > - AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) > - VISIBILITY_CFLAGS="-fvisibility=hidden" > - CFLAGS="$CFLAGS $VISIBILITY_CFLAGS" > - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), > - [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]); > - > - # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed. > - CFLAGS=$save_CFLAGS > + if test "x${ax_cv_have_func_attribute_visibility}" = xyes; then > + VISIBILITY_CFLAGS="-fvisibility=hidden" > + VISIBILITY_CXXFLAGS="-fvisibility=hidden" > + fi > > # Work around aliasing bugs - developers should comment this out > CFLAGS="$CFLAGS -fno-strict-aliasing" > @@ -267,19 +264,6 @@ fi > if test "x$GXX" = xyes; then > CXXFLAGS="$CXXFLAGS -Wall" > > - # Enable -fvisibility=hidden if using a gcc that supports it > - save_CXXFLAGS="$CXXFLAGS" > - AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden]) > - VISIBILITY_CXXFLAGS="-fvisibility=hidden" > - CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS" > - AC_LANG_PUSH([C++]) > - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), > - [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]); > - AC_LANG_POP([C++]) > - > - # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed. > - CXXFLAGS=$save_CXXFLAGS > - > # Work around aliasing bugs - developers should comment this out > CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" > > diff --git a/src/util/macros.h b/src/util/macros.h > index eec8b93..7682511 100644 > --- a/src/util/macros.h > +++ b/src/util/macros.h > @@ -117,6 +117,12 @@ do { \ > #define PRINTFLIKE(f, a) > #endif > > +#ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY > +#define HIDDEN __attribute__((visibility("hidden"))) > +#else > +#define HIDDEN > +#endif > + > #ifdef HAVE_FUNC_ATTRIBUTE_MALLOC > #define MALLOCLIKE __attribute__((__malloc__)) > #else > -- > 2.2.2 >
Sedat Dilek
2015-Feb-17 10:58 UTC
[LLVMdev] [PATCH 2/2 v3] add visibility hidden to tls entry points
On Tue, Feb 17, 2015 at 10:40 AM, Marc Dietrich <marvin24 at gmx.de> wrote:> Avoid redefined symbol errors in clang. Based on a suggestion from > Rafael Ávila de Espíndola <rafael.espindola at gmail.com> in > http://llvm.org/bugs/show_bug.cgi?id=19778. > > Signed-off-by: Marc Dietrich <marvin24 at gmx.de> > --- > v2: - no change > v3: - include util directory in Makefile.am in order to avoid relative > include paths, > - make tls entry points array const >I adapted this patch as v4 to fit mesa v10.4.4, but it fails (see log-file in attached tarball). - Sedat -> src/mapi/Makefile.am | 1 + > src/mapi/entry_x86-64_tls.h | 4 ++-- > src/mapi/entry_x86_tls.h | 5 +++-- > src/mapi/entry_x86_tsd.h | 5 +++-- > 4 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am > index 6794682..c42ed52 100644 > --- a/src/mapi/Makefile.am > +++ b/src/mapi/Makefile.am > @@ -45,6 +45,7 @@ AM_CPPFLAGS = \ > $(SELINUX_CFLAGS) \ > -I$(top_srcdir)/include \ > -I$(top_srcdir)/src/mapi \ > + -I$(top_srcdir)/src/util \ > -I$(top_builddir)/src/mapi > > include Makefile.sources > diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h > index 71e9d60..2c5d64d 100644 > --- a/src/mapi/entry_x86-64_tls.h > +++ b/src/mapi/entry_x86-64_tls.h > @@ -25,6 +25,7 @@ > * Chia-I Wu <olv at lunarg.com> > */ > > +#include "macros.h" > #include "u_macros.h" > > __asm__(".text\n" > @@ -62,8 +63,7 @@ entry_patch_public(void) > { > } > > -static char > -x86_64_entry_start[]; > +extern const char HIDDEN x86_64_entry_start[]; > > mapi_func > entry_get_public(int slot) > diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h > index fa7bc15..a66edec 100644 > --- a/src/mapi/entry_x86_tls.h > +++ b/src/mapi/entry_x86_tls.h > @@ -26,6 +26,7 @@ > */ > > #include <string.h> > +#include "macros.h" > #include "u_macros.h" > > __asm__(".text"); > @@ -72,8 +73,8 @@ __asm__(".text"); > extern unsigned long > x86_current_tls(); > > -static char x86_entry_start[]; > -static char x86_entry_end[]; > +extern const char HIDDEN x86_entry_start[]; > +extern const char HIDDEN x86_entry_end[]; > > void > entry_patch_public(void) > diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h > index ece00fa..1de2991 100644 > --- a/src/mapi/entry_x86_tsd.h > +++ b/src/mapi/entry_x86_tsd.h > @@ -25,6 +25,7 @@ > * Chia-I Wu <olv at lunarg.com> > */ > > +#include "macros.h" > #include "u_macros.h" > > #define X86_ENTRY_SIZE 32 > @@ -59,8 +60,8 @@ __asm__(".balign 32\n" > #include <string.h> > #include "u_execmem.h" > > -static const char x86_entry_start[]; > -static const char x86_entry_end[]; > +extern const char HIDDEN x86_entry_start[]; > +extern const char HIDDEN x86_entry_end[]; > > void > entry_patch_public(void) > -- > 2.2.2 >-------------- next part -------------- A non-text attachment was scrubbed... Name: for-marvin24.tar.gz Type: application/x-gzip Size: 12345 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150217/b0e02091/attachment.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: for-marvin24.tar.gz.sha256sum Type: application/octet-stream Size: 86 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150217/b0e02091/attachment.obj>
Sedat Dilek
2015-Feb-17 12:55 UTC
[LLVMdev] [PATCH 0/2 v3] add visibility hidden to tls entry points
On Tue, Feb 17, 2015 at 10:40 AM, Marc Dietrich <marvin24 at gmx.de> wrote:> Patch 1 adds a check for the compilers visibility macro to configure.ac. > Patch 2 avoids redefined symbol errors in clang of the tls entry points. > Based on a suggestion from Rafael Ávila de Espíndola <rafael.espindola at gmail.com> > in http://llvm.org/bugs/show_bug.cgi?id=19778. > > Tested with gcc 4.9 and clang 3.6(rc) > > Marc Dietrich (2): > configure: add visibility macro detection to configure > add visibility hidden to tls entry points > > configure.ac | 28 ++++++---------------------- > src/mapi/Makefile.am | 1 + > src/mapi/entry_x86-64_tls.h | 4 ++-- > src/mapi/entry_x86_tls.h | 5 +++-- > src/mapi/entry_x86_tsd.h | 5 +++-- > src/util/macros.h | 6 ++++++ > 6 files changed, 21 insertions(+), 28 deletions(-) >Tested-by: Sedat Dilek <sedat.dilek at gmail.com> (mesa v10.4.4 with llvm-toolchain v3.6.0rc2) - Sedat -> -- > 2.2.2 >
Sedat Dilek
2015-Feb-20 12:45 UTC
[LLVMdev] [PATCH 0/2 v3] add visibility hidden to tls entry points
On Tue, Feb 17, 2015 at 1:55 PM, Sedat Dilek <sedat.dilek at gmail.com> wrote:> On Tue, Feb 17, 2015 at 10:40 AM, Marc Dietrich <marvin24 at gmx.de> wrote: >> Patch 1 adds a check for the compilers visibility macro to configure.ac. >> Patch 2 avoids redefined symbol errors in clang of the tls entry points. >> Based on a suggestion from Rafael Ávila de Espíndola <rafael.espindola at gmail.com> >> in http://llvm.org/bugs/show_bug.cgi?id=19778. >> >> Tested with gcc 4.9 and clang 3.6(rc) >> >> Marc Dietrich (2): >> configure: add visibility macro detection to configure >> add visibility hidden to tls entry points >> >> configure.ac | 28 ++++++---------------------- >> src/mapi/Makefile.am | 1 + >> src/mapi/entry_x86-64_tls.h | 4 ++-- >> src/mapi/entry_x86_tls.h | 5 +++-- >> src/mapi/entry_x86_tsd.h | 5 +++-- >> src/util/macros.h | 6 ++++++ >> 6 files changed, 21 insertions(+), 28 deletions(-) >> > > Tested-by: Sedat Dilek <sedat.dilek at gmail.com> (mesa v10.4.4 with > llvm-toolchain v3.6.0rc2) >Tested-by: Sedat Dilek <sedat.dilek at gmail.com> (mesa v10.4.4 with llvm-toolchain v3.6.0rc*3* with compiler-rt) I re-compiled my Linux graphics driver stack with a self-compiled llvm-toolchain v3.6.0rc3. libdrm: v2.4.59 mesa: v10.4.4 (plus gallivm-fixes and visibility-macro-detection support) + configure: --enable-glx-tls intel-ddx: v2.99.917-149-g09b0ab9b4384 What about renaming your patches to...? 1/2: "configure: add visibility macro detection" 2/2: "mapi: add visibility hidden to tls entry points" Even 1/2 should reflect it's a code-generation option for compilers like GCC or LLVM/Clang. It's up2u. Please have a look at [1], too. Thanks. - Sedat - [1] https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html -> "-fvisibility=[default|internal|hidden|protected]" -------------- next part -------------- A non-text attachment was scrubbed... Name: build-and-install-log_mesa-10-4-4_llvm-3-6-0-rc3_gallivm-fixes_visibility-macro-detection_enable-glx-tls.txt.gz Type: application/x-gzip Size: 21839 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150220/e9978812/attachment.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: build-and-install-log_mesa-10-4-4_llvm-3-6-0-rc3_gallivm-fixes_visibility-macro-detection_enable-glx-tls.txt.gz.sha256sum Type: application/octet-stream Size: 178 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150220/e9978812/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gallivm-Update-for-RTDyldMemoryManager-becoming-an-u.patch Type: text/x-diff Size: 1144 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150220/e9978812/attachment.patch> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-configure-add-visibility-macro-detection-to-configur.patch Type: text/x-diff Size: 3067 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150220/e9978812/attachment-0001.patch> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-add-visibility-hidden-to-tls-entry-points.patch Type: text/x-diff Size: 2727 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150220/e9978812/attachment-0002.patch> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-configure-Fix-comment-in-visibility-macro-detection.patch Type: text/x-diff Size: 947 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150220/e9978812/attachment-0003.patch>
Emil Velikov
2015-Feb-26 14:44 UTC
[LLVMdev] [Mesa-dev] [PATCH 1/2 v3] configure: add visibility macro detection to configure
Hi Marc On 17/02/15 09:40, Marc Dietrich wrote:> This adds clang/gcc visibility macro detection to configure and util/macros.h. > This is can be used to conveniently add e.g. a "HIDDEN" attribute to a function. >I believe this should be OK to go in regardless of the status of patch 2. There are just a couple of trivial nitpicks.> Signed-off-by: Marc Dietrich <marvin24 at gmx.de> > --- > v2: use VISIBILITY_*FLAGS instead of *FLAGS directly > v3: no change > > configure.ac | 28 ++++++---------------------- > src/util/macros.h | 6 ++++++ > 2 files changed, 12 insertions(+), 22 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 351027b..266764a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -189,6 +189,7 @@ AX_GCC_FUNC_ATTRIBUTE([flatten]) > AX_GCC_FUNC_ATTRIBUTE([format]) > AX_GCC_FUNC_ATTRIBUTE([malloc]) > AX_GCC_FUNC_ATTRIBUTE([packed]) > +AX_GCC_FUNC_ATTRIBUTE([visibility]) > > AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes) > > @@ -245,17 +246,13 @@ if test "x$GCC" = xyes; then > AC_MSG_RESULT([yes]), > [CFLAGS="$save_CFLAGS -Wmissing-prototypes"; > AC_MSG_RESULT([no])]); > + CFLAGS=$save_CFLAGS >I'm not sure we want/need this one ?> # Enable -fvisibility=hidden if using a gcc that supports itAs spotted by Sedat, please update the comment.> - save_CFLAGS="$CFLAGS" > - AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) > - VISIBILITY_CFLAGS="-fvisibility=hidden" > - CFLAGS="$CFLAGS $VISIBILITY_CFLAGS" > - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), > - [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]); > - > - # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed. > - CFLAGS=$save_CFLAGS > + if test "x${ax_cv_have_func_attribute_visibility}" = xyes; then > + VISIBILITY_CFLAGS="-fvisibility=hidden" > + VISIBILITY_CXXFLAGS="-fvisibility=hidden" > + fi >As these two are no longer GCC "specific" we can move them out of the if test x$GCC = xyes, conditional.> # Work around aliasing bugs - developers should comment this out > CFLAGS="$CFLAGS -fno-strict-aliasing" > @@ -267,19 +264,6 @@ fi > if test "x$GXX" = xyes; then > CXXFLAGS="$CXXFLAGS -Wall" > > - # Enable -fvisibility=hidden if using a gcc that supports it > - save_CXXFLAGS="$CXXFLAGS" > - AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden]) > - VISIBILITY_CXXFLAGS="-fvisibility=hidden" > - CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS" > - AC_LANG_PUSH([C++]) > - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), > - [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]); > - AC_LANG_POP([C++]) > - > - # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed. > - CXXFLAGS=$save_CXXFLAGS > - > # Work around aliasing bugs - developers should comment this out > CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" > > diff --git a/src/util/macros.h b/src/util/macros.h > index eec8b93..7682511 100644 > --- a/src/util/macros.h > +++ b/src/util/macros.h > @@ -117,6 +117,12 @@ do { \ > #define PRINTFLIKE(f, a) > #endif > > +#ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY > +#define HIDDEN __attribute__((visibility("hidden"))) > +#else > +#define HIDDEN > +#endif > +We already define HIDDEN in the asm code. Can you check (build or otherwise) that things don't clash for --enable-asm and --{en,dis}able-shared-glapi. Check the configure log, as we conveniently toggle the latter. Thanks Emil
Possibly Parallel Threads
- [LLVMdev] [PATCH 0/2 v3] add visibility hidden to tls entry points
- [LLVMdev] [PATCH 2/2 v3] add visibility hidden to tls entry points
- [LLVMdev] [PATCH 2/2 v3] add visibility hidden to tls entry points
- [LLVMdev] [PATCH 2/2 v3] add visibility hidden to tls entry points
- [LLVMdev] [PATCH 2/2 v3] add visibility hidden to tls entry points