Skip to content

Commit 9e26858

Browse files
authored
export fewer things from module targets (#8089)
Closes #7722 without adding SONAME ``` e@light-hope in ~/work/slang on HEAD (68b0125) [nix-shell] [direnv] $ nm -DC --defined-only build/Debug/lib/libslang-llvm.so 0000000001a4b637 T createLLVMDownstreamCompiler_V4 0000000001a427ed T createLLVMFileCheck_V1 0000000001a4b91e W std::type_info::operator==(std::type_info const&) const 0000000001a4bb07 W std::_Sp_make_shared_tag::_S_ti() 0000000001059165 u std::ranges::_Cpo::iter_move 0000000005f92ac0 V typeinfo for std::_Sp_make_shared_tag 0000000005f92938 V vtable for std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2> e@light-hope in ~/work/slang on HEAD (68b0125) [nix-shell] [direnv] $ nm -DC --defined-only build/Debug/lib/libslang-glslang.so 00000000004701a2 T glslang_compile 000000000047012b T glslang_compile_1_1 000000000046ffd9 T glslang_compile_1_2 000000000046db75 T glslang_disassembleSPIRV 000000000046da42 T glslang_disassembleSPIRVWithResult 000000000047028b T glslang_linkSPIRV 000000000046d8fa T glslang_validateSPIRV e@light-hope in ~/work/slang on HEAD (68b0125) [nix-shell] [direnv] $ nm -DC --defined-only build/Debug/lib/libslang-glsl-module.so 0000000000135bf9 T slang_getEmbeddedModule ``` I think that the exports from libslang-llvm are unavoidable I believe, however these are weak exports so should exhibit the same problem. @NBickford-NV does this look good for you?
1 parent d0848ab commit 9e26858

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

cmake/LLVM.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ function(fetch_or_build_slang_llvm)
9292
)
9393
# If we don't include this, then the symbols in the LLVM linked here may
9494
# conflict with those of other LLVMs linked at runtime, for instance in mesa.
95+
set_target_properties(
96+
slang-llvm
97+
PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON
98+
)
9599
add_supported_cxx_linker_flags(
96100
slang-llvm
97101
PRIVATE

source/slang-glsl-module/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ slang_add_target(
2626
INCLUDE_DIRECTORIES_PRIVATE ${glsl_module_generated_header_dir}
2727
INSTALL
2828
)
29+
set_target_properties(
30+
slang-glsl-module
31+
PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON
32+
)
33+
add_supported_cxx_linker_flags(
34+
slang-glsl-module
35+
PRIVATE
36+
"-Wl,--exclude-libs,ALL"
37+
)

source/slang-glslang/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Our wrapper for glslang
2+
# Our wrapper for glslang
33
#
44
if(SLANG_ENABLE_SLANG_GLSLANG)
55
slang_add_target(
@@ -14,6 +14,10 @@ if(SLANG_ENABLE_SLANG_GLSLANG)
1414
)
1515
# Our only interface is through what we define in source/slang-glslang, in the
1616
# interests of hygiene, hide anything else we link in.
17+
set_target_properties(
18+
slang-glslang
19+
PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON
20+
)
1721
add_supported_cxx_linker_flags(
1822
slang-glslang
1923
PRIVATE

0 commit comments

Comments
 (0)