Conversation
The ZSTDLIB_STATIC_API and ZDICTLIB_STATIC_API cache settings are currently applied only to libzstd_static. Setting them to hidden therefore leaves static-only APIs exported from libzstd_shared. Apply the existing definitions to the shared target as well so the documented visibility controls affect the library for which symbol hiding matters. Signed-off-by: Yongqiang Tian <yqtian668@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zstd distinguishes its stable API from functions declared with
ZSTDLIB_STATIC_APIandZDICTLIB_STATIC_API. The latter macros can be set tohidden visibility when those static-only APIs should not be exported from the
shared library.
The CMake build exposes cache settings for both macros and accepts
hidden,but passes the resulting definitions only to
libzstd_static. Consequently,configuring a shared build with
-DZSTDLIB_STATIC_API=hidden -DZDICTLIB_STATIC_API=hiddensucceeds withoutapplying either definition to
libzstd_shared; its shared object continues toexport the static-only APIs.
This change passes both existing definitions to
libzstd_shared, where theirvisibility attributes can affect the shared export set. Both cache settings
remain empty by default, so the default build is unchanged.
Validation:
ZSTD_*andZDICT_*static-onlyAPIs, while stable APIs remain exported;
This is related to the broader CMake/Make consistency discussion in issue
#2261, but specifically fixes the two existing CMake cache settings.