On Tue, Feb 17, 2015 at 1:55 PM, Sedat Dilek <sedat.di...@gmail.com> wrote: > On Tue, Feb 17, 2015 at 10:40 AM, Marc Dietrich <marvi...@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.espind...@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.di...@gmail.com> (mesa v10.4.4 with > llvm-toolchain v3.6.0rc2) >
Tested-by: Sedat Dilek <sedat.di...@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]"
build-and-install-log_mesa-10-4-4_llvm-3-6-0-rc3_gallivm-fixes_visibility-macro-detection_enable-glx-tls.txt.gz
Description: GNU Zip compressed data
build-and-install-log_mesa-10-4-4_llvm-3-6-0-rc3_gallivm-fixes_visibility-macro-detection_enable-glx-tls.txt.gz.sha256sum
Description: Binary data
From dba78466e1395a4039c3b4e4887ef3f2ef7e78ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= <jfons...@vmware.com> Date: Wed, 3 Dec 2014 07:48:26 +0000 Subject: [PATCH 1/4] gallivm: Update for RTDyldMemoryManager becoming an unique_ptr. Trivial. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=86958 --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index fe3c75421668..5210acca427a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -500,8 +500,12 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, MM = new ShaderMemoryManager(JMM); *OutCode = MM->getGeneratedCode(); +#if HAVE_LLVM >= 0x0306 + builder.setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager>(MM)); +#else builder.setMCJITMemoryManager(MM); #endif +#endif } else { #if HAVE_LLVM < 0x0306 BaseMemoryManager* JMM = reinterpret_cast<BaseMemoryManager*>(CMM); -- 2.3.0
From cff0b61d7af78af90374c950bc8a654607752b96 Mon Sep 17 00:00:00 2001 From: Marc Dietrich <marvi...@gmx.de> Date: Tue, 17 Feb 2015 10:40:07 +0100 Subject: [PATCH 2/4] 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 <marvi...@gmx.de> --- configure.ac | 28 ++++++---------------------- src/util/macros.h | 6 ++++++ 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 399b0959b622..612473b8f77f 100644 --- a/configure.ac +++ b/configure.ac @@ -144,6 +144,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) @@ -194,17 +195,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" @@ -216,19 +213,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 da5daff9bf82..9cc62b2f4bbd 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -107,6 +107,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.3.0
From 81b48b2d9fd29705065c587699b0ce4812404d84 Mon Sep 17 00:00:00 2001 From: Marc Dietrich <marvi...@gmx.de> Date: Tue, 17 Feb 2015 10:40:08 +0100 Subject: [PATCH 3/4] add visibility hidden to tls entry points MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid redefined symbol errors in clang. Based on a suggestion from Rafael Ãvila de EspÃndola <rafael.espind...@gmail.com> in http://llvm.org/bugs/show_bug.cgi?id=19778. Signed-off-by: Marc Dietrich <marvi...@gmx.de> --- 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 80ead821cccf..7cdbd53ed728 100644 --- a/src/mapi/Makefile.am +++ b/src/mapi/Makefile.am @@ -38,6 +38,7 @@ AM_CPPFLAGS = \ $(SELINUX_CFLAGS) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mapi \ + -I$(top_srcdir)/src/util \ -I$(top_builddir)/src/mapi GLAPI = $(top_srcdir)/src/mapi/glapi diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h index 71e9d6063059..2c5d64d6d215 100644 --- a/src/mapi/entry_x86-64_tls.h +++ b/src/mapi/entry_x86-64_tls.h @@ -25,6 +25,7 @@ * Chia-I Wu <o...@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 fa7bc15b890f..a66edec7c008 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 ece00fac0b75..1de299169fc1 100644 --- a/src/mapi/entry_x86_tsd.h +++ b/src/mapi/entry_x86_tsd.h @@ -25,6 +25,7 @@ * Chia-I Wu <o...@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.3.0
From fdc83d4a5c1c2aee6bdf4fa8db6cf41e3f5da190 Mon Sep 17 00:00:00 2001 From: Sedat Dilek <sedat.di...@gmail.com> Date: Wed, 18 Feb 2015 05:59:26 +0100 Subject: [PATCH 4/4] configure: Fix comment in visibility macro detection Fixes: "configure: add visibility macro detection to configure (v3)" Signed-off-by: Sedat Dilek <sedat.di...@gmail.com> --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 612473b8f77f..77e17d121e59 100644 --- a/configure.ac +++ b/configure.ac @@ -197,7 +197,7 @@ if test "x$GCC" = xyes; then AC_MSG_RESULT([no])]); CFLAGS=$save_CFLAGS - # Enable -fvisibility=hidden if using a gcc that supports it + # Enable -fvisibility=hidden if using a compiler that supports it if test "x${ax_cv_have_func_attribute_visibility}" = xyes; then VISIBILITY_CFLAGS="-fvisibility=hidden" VISIBILITY_CXXFLAGS="-fvisibility=hidden" -- 2.3.0
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev