From 58abd4dade12c42e259af3586033385c78a2676a Mon Sep 17 00:00:00 2001 From: "Sv. Lockal" Date: Thu, 19 Mar 2026 21:42:01 +0800 Subject: [PATCH] build: Fix compilation with ld.lld When using Clang 18<->22 with ld.lld, build fails with: ``` clang++ -Wl,--version-script=.../hidesymbols.map -o lib/liboslcomp.so.1.13.7 ... ld.lld: error: version script assignment of 'global' to symbol 'test_shade' failed: symbol not defined ``` The issue is that test_shade does not belong to liboslcomp, instead it belongs to libtestshade, and ld.lld actually checks that and fails. The minimal fix is to remove test_shade from hidesymbols.map, the slightly better way is to create a separate symbols map for libtestshade. See also: https://bugs.gentoo.org/929091 Signed-off-by: Sv. Lockal --- src/build-scripts/hidesymbols.map | 2 +- src/testshade/CMakeLists.txt | 7 +++++++ src/testshade/testshade_symbols.map | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/testshade/testshade_symbols.map diff --git a/src/build-scripts/hidesymbols.map b/src/build-scripts/hidesymbols.map index 3f40d53b6a..d9be164998 100644 --- a/src/build-scripts/hidesymbols.map +++ b/src/build-scripts/hidesymbols.map @@ -1,4 +1,4 @@ { - global: *OSL*; test_shade; *osl*imageio*; *osl_input_extensions; PyInit*; + global: *OSL*; *osl*imageio*; *osl_input_extensions; PyInit*; local: osl_*; *pvt*; *; }; diff --git a/src/testshade/CMakeLists.txt b/src/testshade/CMakeLists.txt index 470c1fc787..12e1745a18 100644 --- a/src/testshade/CMakeLists.txt +++ b/src/testshade/CMakeLists.txt @@ -110,6 +110,13 @@ if (NOT CODECOV) OUTPUT_NAME libtestshade${OSL_LIBNAME_SUFFIX} ) + # Only libtestshade exports test_shade; keep it out of the global map. + if (VISIBILITY_MAP_COMMAND) + set_property (TARGET libtestshade + APPEND PROPERTY LINK_FLAGS + -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/testshade_symbols.map) + endif () + target_link_libraries (libtestshade PRIVATE oslexec oslquery oslcomp) diff --git a/src/testshade/testshade_symbols.map b/src/testshade/testshade_symbols.map new file mode 100644 index 0000000000..65589759a4 --- /dev/null +++ b/src/testshade/testshade_symbols.map @@ -0,0 +1,4 @@ +{ + global: test_shade; + local: *; +};