[build] Disable hidden inline visibility on XCOFF

IBM i and AIX use XCOFF, which rejects hidden visibility on references
to imported inline symbols. This can prevent test-repacker from linking
against libstdc++.

Disable inline visibility hiding for these hosts in Meson and CMake,
while preserving the existing setting on other systems.

The full configured Meson suite passed (288 tests), and a native CMake
shared-library build succeeded. Platform-policy checks cover AIX,
OS400, Linux, macOS, and Windows. Native IBM i/AIX was unavailable.

Co-authored-by: Chi-Iroh <69324626+Chi-Iroh@users.noreply.github.com>
Assisted-by: OpenAI Codex
This commit is contained in:
Behdad EsfahbodandChi-Iroh authored and Khaled Hosny committed 2026-10-13 12:56:42 +03:00
1 parent fba9b0dec2
commit fed245b6ab
2 files changed
+20 -10

No files matched your search

+14 -8
View File
@@ -600,6 +600,12 @@ endif ()
## Define harfbuzz library
set(HB_VISIBILITY_INLINES_HIDDEN TRUE)
# XCOFF rejects hidden visibility on references to imported inline symbols.
if(CMAKE_SYSTEM_NAME MATCHES "^(AIX|OS400)$")
set(HB_VISIBILITY_INLINES_HIDDEN FALSE)
endif()
add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers})
target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS})
if (MINGW)
@@ -608,7 +614,7 @@ endif()
target_include_directories(harfbuzz PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/harfbuzz>")
set_target_properties(harfbuzz PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (HB_HAVE_FREETYPE AND TARGET freetype)
target_link_libraries(harfbuzz freetype)
endif ()
@@ -619,7 +625,7 @@ if (HB_HAVE_ICU)
add_library(harfbuzz-icu ${PROJECT_SOURCE_DIR}/src/hb-icu.cc ${PROJECT_SOURCE_DIR}/src/hb-icu.h)
add_dependencies(harfbuzz-icu harfbuzz)
target_link_libraries(harfbuzz-icu harfbuzz ${THIRD_PARTY_LIBS})
set_target_properties(harfbuzz-icu PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz-icu PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (BUILD_SHARED_LIBS)
if (BUILD_FRAMEWORK)
@@ -646,7 +652,7 @@ if (HB_BUILD_SUBSET)
list(APPEND project_headers ${subset_project_headers})
add_dependencies(harfbuzz-subset harfbuzz)
target_link_libraries(harfbuzz-subset harfbuzz ${THIRD_PARTY_LIBS})
set_target_properties(harfbuzz-subset PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz-subset PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (MINGW)
target_compile_options(harfbuzz-subset PRIVATE "-Wa,-mbig-obj")
@@ -674,7 +680,7 @@ if (HB_BUILD_RASTER)
add_library(harfbuzz-raster ${raster_project_sources} ${raster_project_headers})
add_dependencies(harfbuzz-raster harfbuzz)
target_link_libraries(harfbuzz-raster harfbuzz ${HB_RASTER_THIRD_PARTY_LIBS})
set_target_properties(harfbuzz-raster PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz-raster PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (MINGW)
target_compile_options(harfbuzz-raster PRIVATE "-Wa,-mbig-obj")
@@ -703,7 +709,7 @@ if (HB_BUILD_VECTOR)
add_library(harfbuzz-vector ${vector_project_sources} ${vector_project_headers})
add_dependencies(harfbuzz-vector harfbuzz)
target_link_libraries(harfbuzz-vector harfbuzz ${HB_VECTOR_THIRD_PARTY_LIBS})
set_target_properties(harfbuzz-vector PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz-vector PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (MINGW)
target_compile_options(harfbuzz-vector PRIVATE "-Wa,-mbig-obj")
@@ -732,7 +738,7 @@ if (HB_BUILD_GPU)
add_library(harfbuzz-gpu ${gpu_project_sources} ${gpu_project_headers})
add_dependencies(harfbuzz-gpu harfbuzz)
target_link_libraries(harfbuzz-gpu harfbuzz)
set_target_properties(harfbuzz-gpu PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz-gpu PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (MINGW)
target_compile_options(harfbuzz-gpu PRIVATE "-Wa,-mbig-obj")
@@ -803,7 +809,7 @@ if (HB_HAVE_GOBJECT)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/src)
add_dependencies(harfbuzz-gobject harfbuzz)
target_link_libraries(harfbuzz-gobject harfbuzz ${GOBJECT_LIBRARIES} ${THIRD_PARTY_LIBS})
set_target_properties(harfbuzz-gobject PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz-gobject PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (BUILD_SHARED_LIBS)
if (BUILD_FRAMEWORK)
@@ -829,7 +835,7 @@ if (HB_HAVE_CAIRO)
add_library(harfbuzz-cairo ${PROJECT_SOURCE_DIR}/src/hb-cairo.cc ${PROJECT_SOURCE_DIR}/src/hb-static.cc ${PROJECT_SOURCE_DIR}/src/hb-cairo.h)
add_dependencies(harfbuzz-cairo harfbuzz)
target_link_libraries(harfbuzz-cairo harfbuzz ${THIRD_PARTY_LIBS})
set_target_properties(harfbuzz-cairo PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
set_target_properties(harfbuzz-cairo PROPERTIES VISIBILITY_INLINES_HIDDEN ${HB_VISIBILITY_INLINES_HIDDEN})
if (BUILD_SHARED_LIBS)
if (BUILD_FRAMEWORK)
+6 -2
View File
@@ -66,12 +66,16 @@ add_project_link_arguments(cpp.get_supported_link_arguments([
'-Bsymbolic-functions'
]), language: 'c')
visibility_inlines_hidden_argument = ['-fvisibility-inlines-hidden']
# XCOFF rejects hidden visibility on references to imported inline symbols.
if host_machine.system() in ['os400', 'aix']
visibility_inlines_hidden_argument = []
endif
add_project_arguments(cpp.get_supported_arguments([
'-fno-exceptions',
'-fno-rtti',
'-fno-threadsafe-statics',
'-fvisibility-inlines-hidden',
]), language: 'cpp')
] + visibility_inlines_hidden_argument), language: 'cpp')
if host_machine.cpu_family() == 'arm' and cpp.alignment('struct { char c; }') != 1
if cpp.has_argument('-mstructure-size-boundary=8')