Skip to content

Commit ab82c3d

Browse files
authored
[Fuchsia] Build with -fvisibility=default (#67067)
There was an issue with relative vtables when two TU's which define the same vtable object are built with different default visibilities. Some TU's are built with -fvisibility=hidden in the code base, grep for CMAKE_CXX_VISIBILITY_PRESET to find them. Our whole toolchain, is statically linked, and built with -fPIE anyway, so the cost of overriding local CMAKE_CXX_VISIBILITY_PRESET properties is not high. I've counted that adding this flag increases our llvm binary by 13 relocations. Frankly I'm not sure where those are even coming from. It would be preferable to use hidden visibility, but that breaks liblld. This can be solved by setting LLDB_EXPORT_ALL_SYMBOLS. After that some ORC tests fail which do symbolic lookup in the tests. It seems that setting CMAKE_CXX_VISIBILITY_PRESET=hidden will not be worth the maintenance burden. Setting it to default works to unblock using relative vtables, so we can just go with that.
1 parent 3353f7d commit ab82c3d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
5050
set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
5151
set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
5252

53+
# TODO(#67176): relative-vtables doesn't play well with different default
54+
# visibilities. Making everything hidden visibility causes other complications
55+
# let's choose default visibility for our entire toolchain.
56+
set(CMAKE_C_VISIBILITY_PRESET default CACHE STRING "")
57+
set(CMAKE_CXX_VISIBILITY_PRESET default CACHE STRING "")
58+
5359
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
5460
if (APPLE)
5561
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")

0 commit comments

Comments
 (0)