[PATCH] D24460: [Polly] Remove -fvisibility=hidden and FORCE_STATIC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 09:13:54 PDT 2016


Meinersbur created this revision.
Meinersbur added reviewers: grosser, jdoerfert.
Meinersbur added subscribers: pollydev, llvm-commits.
Meinersbur added a project: Polly.
Herald added subscribers: mgorny, beanz.

The flag -fvisibility=hidden flag was used for the integrated Integer Set Library (and PPCG) to keep their definitions local to Polly. The motivation was the be loaded into a DragonEgg-powered GCC, where GCC might itself using ISL for its Graphite extension. The symbols of Polly's ISL and GCC's ISL would clash.

The DragonEgg project is not actively developed anymore, but Polly's unittests need to call ISL functions to set up a testing environment. Unfortunately, the -fvisibility=hidden flag means that the ISL symbols are not available to the gtest executable as it resides outside of libPolly when linked dynamically. Currently, CMake links a second copy of ISL into the unittests which leads to subtle bugs. What got observed is that two isl_ids for isl_id_none exist, one for each library instance. Because isl_id's are compared by address, isl_id_none could happen to be different from isl_id_none, depending on which library instance set the address and does the comparison.

Also remove the FORCE_STATIC flag which was introduced to keep the ISL symbols visible inside the same libPolly shared object, even when build with BUILD_SHARED_LIBS.

https://reviews.llvm.org/D24460

Files:
  cmake/polly_macros.cmake
  lib/External/CMakeLists.txt

Index: lib/External/CMakeLists.txt
===================================================================
--- lib/External/CMakeLists.txt
+++ lib/External/CMakeLists.txt
@@ -256,7 +256,7 @@
     isl/imath/imrat.c
     )
 
-add_polly_library(PollyISL FORCE_STATIC
+add_polly_library(PollyISL
   ${ISL_FILES}
 )
 
@@ -274,19 +274,10 @@
 # ISL requires at least C99 to compile. gcc < 5.0 use -std=gnu89 as default.
 target_enable_c99(PollyISL)
 
-# Define the FLAGS for the compilation of isl and imath
-#
-# We first set the visibility of all isl functions to hidden to ensure we do
-# not clash with other isl versions that got linked into a program that uses
-# Polly. (This happens e.g when linking Polly with dragonegg)
-#
-# This is the reason for the FORCE_STATIC flag above; without it, not even Polly
-# could access ISL's symbols in shared library builds.
-#
-# We also disable warnings which should be coped with upstream.
+# Disable warnings which should be coped with upstream for isl and imath.
 if (NOT MSVC)
   set_target_properties(PollyISL PROPERTIES
-    COMPILE_FLAGS "-fvisibility=hidden -w"
+    COMPILE_FLAGS "-w"
   )
 endif ()
 
@@ -332,12 +323,12 @@
   ${PET_SOURCE_DIR}/include
 )
 
-add_polly_library(PollyPPCG FORCE_STATIC
+add_polly_library(PollyPPCG
   ${PPCG_FILES}
 )
 
 if (NOT MSVC)
   set_target_properties(PollyPPCG PROPERTIES
-    COMPILE_FLAGS "-fvisibility=hidden -w"
+    COMPILE_FLAGS "-w"
   )
 endif ()
Index: cmake/polly_macros.cmake
===================================================================
--- cmake/polly_macros.cmake
+++ cmake/polly_macros.cmake
@@ -2,7 +2,7 @@
 include(CMakeParseArguments)
 
 macro(add_polly_library name)
-  cmake_parse_arguments(ARG "FORCE_STATIC" "" "" ${ARGN})
+  cmake_parse_arguments(ARG "" "" "" ${ARGN})
   set(srcs ${ARG_UNPARSED_ARGUMENTS})
   if(MSVC_IDE OR XCODE)
     file( GLOB_RECURSE headers *.h *.td *.def)
@@ -15,12 +15,6 @@
   endif(MSVC_IDE OR XCODE)
   if (MODULE)
     set(libkind MODULE)
-  elseif (ARG_FORCE_STATIC)
-    if (SHARED_LIBRARY OR BUILD_SHARED_LIBS)
-      message(STATUS "${name} is being built as static library because it is compiled with -fvisibility=hidden; "
-                     "Its symbols are not visible from outside a shared library")
-    endif ()
-    set(libkind STATIC)
   elseif (SHARED_LIBRARY)
     set(libkind SHARED)
   else()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24460.71015.patch
Type: text/x-patch
Size: 2357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160912/36b74be9/attachment.bin>


More information about the llvm-commits mailing list