-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly hide static symbols #2501
Conversation
87ddbfc
to
859cc03
Compare
... and this reveals (at least with CMake) that |
859cc03
to
bec2baf
Compare
bec2baf
to
6ce06bf
Compare
lib/Makefile
Outdated
@@ -330,7 +330,8 @@ include $(wildcard $(DEPFILES)) | |||
# Special case : building library in single-thread mode _and_ without zstdmt_compress.c | |||
ZSTDMT_FILES = compress/zstdmt_compress.c | |||
ZSTD_NOMT_FILES = $(filter-out $(ZSTDMT_FILES),$(ZSTD_FILES)) | |||
libzstd-nomt: LDFLAGS += -shared -fPIC -fvisibility=hidden | |||
libzstd-nomt: CFLAGS += -fvisibility=hidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look ;-). I’m wondering what to do about ZSTD_getParams
since pztd
uses that dynamically even though it’s supposed to be a static-only symbol. Declaring it as a non-static API would fix the failing tests, but that might not be a stability promise the project is happy with!
(For context, I’m trying to reduce the amount of exported symbols to avoid issues such as this one — Debian carries a symbols file, which is used to generate versioned dependencies, so that a binary can have dependencies which are as “generous” as possible; but this gets confused by libzstd
’s symbols. Perhaps the correct solution is to drop that file entirely, and always request a version of libzstd
equal than or greater to the version with which a given binary was compiled...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the correct solution is to (...) always request a version of
libzstd
equal than or greater to the version with which a given binary was compiled
libzstd
library policy is to only update the "stable" section of the API when the second digit changes.
For example, in 1.4.x
series, all versions from v1.4.0
to v1.4.8
support the exact same set of symbols as "stable".
(Meanwhile, the "experimental" section can, and does, evolve at each iteration.)
The next update to "stable" API will happen at v1.5.0
.
Even then, we are restrained to only add new symbols, existing symbols are considered completely stable, and guaranteed to remain present in all v1.x.y
versions of the library.
Given that, the proposed rule (always request a version of libzstd
equal than or greater to the version with which a given binary was compiled) would work.
A slightly more generous rule would allow usage of older libzstd
as long as the second digit matches or is greater (i.e. an application compiled with v1.4.5
would still accept a v1.4.0
library, but not v1.3.6
). It's effectively the same rule, but limited to the first 2 digits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that’s what I suspected. The problem in Debian is that the default analysis results in, for example, the library package declaring that ZSTD_minCLevel
is available since 1.3.8 (which is when it appeared in the library’s symbols) even though it’s only part of the stable API since 1.4. But that really means the problem lies in the tools used ;-).
While there are some good points in this PR, Even our own applications can make intentional use of such symbols, I don't rule out that we may one day hide static symbols in the dynamic library, Anyway, on short term, my recommendation is :
|
Should I amend this PR to only include the |
lib/compress/zstd_compress.c
Outdated
@@ -1039,7 +1039,7 @@ size_t ZSTD_CCtx_loadDictionary_advanced( | |||
return 0; | |||
} | |||
|
|||
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference( | |||
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_byReference( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These prefixes (ZSTDLIB_API
, ZSTDLIB_STATIC_API
) shouldn't be needed at this stage in zstd_compress.c
.
They should remain confined within zstd.h
.
So just remove them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
lib/zstd.h
Outdated
#else | ||
# define ZSTDLIB_API ZSTDLIB_VISIBILITY | ||
# define ZSTDLIB_API ZSTDLIB_VISIBLE | ||
# define ZSTDLIB_STATIC_API ZSTDLIB_HIDDEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the default to VISIBLE
.
Make it possible for this value to be externally defined (#ifndef ZSTDLIB_STATIC_API
...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
I believe most of this PR is fine. What should be updated is that the default should remain to |
6ce06bf
to
4102a5d
Compare
This is still missing tests. |
This PR was in a relatively good shape, Current problems are :
Would you want to complete it ? Alternatively, your PR could be merged into a specific feature branch, in order to be finalized before reaching |
Yes, I do intend to complete it, I’ll try to take care of it in the next few days. I’ve pulled the |
4102a5d
to
d423296
Compare
Even with -fvisibility=hidden added to CFLAGS, any symbol which is given a default visibility attribute ends up exported in the dynamic library. This happens through zstd_internal.h which defines ..._STATIC_LINKING_ONLY before including various header files, and is included for example in lib/common/pool.c. To avoid this, this patch distinguishes static and non-static APIs, by using ZSTDLIB_API only for the latter, and introducing ZSTDLIB_STATIC_API for the former. For now, both are exported, but non-static APIs can be hidden by overriding the definition ZSTDLIB_STATIC_API. lib/Makefile is modified to allow this using make CPPFLAGS_DYNLIB=-DZSTDLIB_STATIC_API=ZSTDLIB_HIDDEN In addition, API declarations are dropped from zstd_compress.c (they aren't needed there). Signed-off-by: Stephen Kitt <[email protected]>
d423296
to
e81d567
Compare
This PR is interesting, but needs to be rebased on latest |
libzstd (1.4.8+dfsg-2.1) unstable; urgency=medium . * Non-maintainer upload. * Drop the symbols file: the symbols in the library aren’t all intended for public consumption, but they can’t be hidden (yet) either, see facebook/zstd#2501 for the discussion. We’ll rely on the shlibs file for now, with a relaxed version (1.4.0, as discussed with upstream). Closes: #969597. . libzstd (1.4.8+dfsg-2) unstable; urgency=high . * Team upload. * When a file with restricted permissions is compressed, the resulting file inherits the umask of the user for the time of the compression. This was partially mitigated previously by running a change of permissions after a `chmod`, but left a small but exploitable window just after the `fopen`. This update adds 0018-fix-file-permissions-on-compression.patch to make sure the compressed file is not group nor world readable for the _entire_ duration of the compression. Closes: #982519 . libzstd (1.4.8+dfsg-1) unstable; urgency=medium . * New upstream version 1.4.8+dfsg, Closes: #977829 * Refresh and remove patch applied by upstream * Update d/libzstd1.symbols, getSequences() got renamed to generateSequences(), no reverse deps use ZSTD_getSequences * d/rules, remove export DEB_CFLAGS_MAINT_APPEND = -fno-strict-aliasing, fixed by upstream, Closes: #957487 Call dh_makeshlibs with -V 'libzstd1 (>= 1.4.8)', new public symbols * d/copyright, drop contrib/linux-kernel/fs/squashfs/* * d/control: bump Policy to 4.5.1 . libzstd (1.4.5+dfsg-4) unstable; urgency=medium . [ Andreas Tille ] * Team upload. * debhelper-compat 13 (routine-update) . [ Sudip Mukherjee ] * Disable strict-aliasing to work around bug #957487 Intentionally not closing bug but decreasing severity for the moment. The bug should be closed by a proper upstream fix and strict-aliasing should be re-enabled. . libzstd (1.4.5+dfsg-3) unstable; urgency=medium . [ Paul Menzel ] * debian/changelog: Fix typo in 1.4.5+dfsg-2 changelog . [ Alexandre Mestiashvili ] * Add patch fixing FTBFS on Alpha, Closes: #962676 thanks to Helmut Grohne <[email protected]> . libzstd (1.4.5+dfsg-2) unstable; urgency=medium . * Drop ZSTD_LEGACY_MULTITHREADED_API, since nothing in Debian seems to use it * Fix FTCBFS: Don't build the shared library during dh_auto_install, Closes: #962367, thanks to Helmut Grohne <[email protected]> . libzstd (1.4.5+dfsg-1) unstable; urgency=medium . * New upstream version 1.4.5+dfsg * Refresh patches, remove 0019-blhc-workarounds.patch from series * Update symbols file, add ZDICT_getDictHeaderSize and remove all ZSTDMT_* symbols, also remove renamed ZSTD_CCtxParam_getParameter and ZSTD_CCtxParam_setParameter, no reverse dependencies use any of the removed symbols * Remove 0018-Alias-renamed-API-symbols.patch since no rdeps use the old symbols * Add patch fixing spelling typos * d/rules: call dh_makeshlibs with -V 'libzstd1 (>= 1.4.5)', since this version introduces new public symbols . libzstd (1.4.4+dfsg-3) unstable; urgency=medium . * Team upload. * Source only upload. . libzstd (1.4.4+dfsg-2) unstable; urgency=medium . * Team upload. * Install all the man pages. * Standards-Version: 4.5.0 (routine-update) * debhelper-compat 12 (routine-update) . libzstd (1.4.4+dfsg-1) unstable; urgency=medium . [ Justin Aplin ] * New upstream version 1.4.4+dfsg * Refresh patches * Call Salsa CI with variable DB_BUILD_PARAM: '-v1.1.2-1', since this is the oldest version in active repositories * Add Rules-Requires-Root: binary-targets to debian/control to comply with current DPM * Bump Standards-Version to 4.4.1, changes noted above * Update symbols file for libzstd1 * Call dh_makeshlibs with -V 'libzstd1 (>= 1.4.4)', since this version introduced new public symbols * Add an entry in debian/source/lintian-overrides to prevent libzstd1's Section entry from triggering binary-control-field-duplicates-source, since this field is necessary for the build . libzstd (1.4.3+dfsg-1) unstable; urgency=medium . [ Alexandre Mestiashvili ] * Fix a typo causing test failures on mips(el) architectures in d/patches/0013-skip-memory-greedy-tests.patch * Remove circle.yml from Files-Excluded section in d/copyright * New upstream version 1.4.3+dfsg . libzstd (1.4.2+dfsg-1) unstable; urgency=medium . [ Justin Aplin ] * New upstream version 1.4.2+dfsg * Refresh and drop applied by upstream patches * Add patch aliasing two renamed but unchanged symbols to maintain backwards compatibility * Build with ZSTD_LEGACY_MULTITHREADED_API=1 to maintain backwards compatibility * Update symbols file for libzstd1 * Call dh_makeshlibs with -V 'libzstd1 (>= 1.4.0)', since this version introduced new public symbols * Bump debhelper compat level to 12. * Bump Standards-Version to 4.4.0, no changes needed. * Salsa-CI integration . [ Alexandre Mestiashvili ] * Add .cirrus.yml to Files-Excluded list in d/copyright
libzstd (1.4.8+dfsg-3build1) jammy; urgency=high * No change rebuild for ppc64el baseline bump. libzstd (1.4.8+dfsg-3) unstable; urgency=medium * Team upload. * Fix watchfile to detect new versions on github * Standards-Version: 4.6.0 libzstd (1.4.8+dfsg-2.1) unstable; urgency=medium * Non-maintainer upload. * Drop the symbols file: the symbols in the library aren’t all intended for public consumption, but they can’t be hidden (yet) either, see facebook/zstd#2501 for the discussion. We’ll rely on the shlibs file for now, with a relaxed version (1.4.0, as discussed with upstream). Closes: #969597. libzstd (1.4.8+dfsg-2) unstable; urgency=high * Team upload. * When a file with restricted permissions is compressed, the resulting file inherits the umask of the user for the time of the compression. This was partially mitigated previously by running a change of permissions after a `chmod`, but left a small but exploitable window just after the `fopen`. This update adds 0018-fix-file-permissions-on-compression.patch to make sure the compressed file is not group nor world readable for the _entire_ duration of the compression. Closes: #982519 libzstd (1.4.8+dfsg-1) unstable; urgency=medium * New upstream version 1.4.8+dfsg, Closes: #977829 * Refresh and remove patch applied by upstream * Update d/libzstd1.symbols, getSequences() got renamed to generateSequences(), no reverse deps use ZSTD_getSequences * d/rules, remove export DEB_CFLAGS_MAINT_APPEND = -fno-strict-aliasing, fixed by upstream, Closes: #957487 Call dh_makeshlibs with -V 'libzstd1 (>= 1.4.8)', new public symbols * d/copyright, drop contrib/linux-kernel/fs/squashfs/* * d/control: bump Policy to 4.5.1 libzstd (1.4.5+dfsg-4) unstable; urgency=medium [ Andreas Tille ] * Team upload. * debhelper-compat 13 (routine-update) [ Sudip Mukherjee ] * Disable strict-aliasing to work around bug #957487 Intentionally not closing bug but decreasing severity for the moment. The bug should be closed by a proper upstream fix and strict-aliasing should be re-enabled. libzstd (1.4.5+dfsg-3) unstable; urgency=medium [ Paul Menzel ] * debian/changelog: Fix typo in 1.4.5+dfsg-2 changelog [ Alexandre Mestiashvili ] * Add patch fixing FTBFS on Alpha, Closes: #962676 thanks to Helmut Grohne <[email protected]> libzstd (1.4.5+dfsg-2) unstable; urgency=medium * Drop ZSTD_LEGACY_MULTITHREADED_API, since nothing in Debian seems to use it * Fix FTCBFS: Don't build the shared library during dh_auto_install, Closes: #962367, thanks to Helmut Grohne <[email protected]> libzstd (1.4.5+dfsg-1) unstable; urgency=medium * New upstream version 1.4.5+dfsg * Refresh patches, remove 0019-blhc-workarounds.patch from series * Update symbols file, add ZDICT_getDictHeaderSize and remove all ZSTDMT_* symbols, also remove renamed ZSTD_CCtxParam_getParameter and ZSTD_CCtxParam_setParameter, no reverse dependencies use any of the removed symbols * Remove 0018-Alias-renamed-API-symbols.patch since no rdeps use the old symbols * Add patch fixing spelling typos * d/rules: call dh_makeshlibs with -V 'libzstd1 (>= 1.4.5)', since this version introduces new public symbols libzstd (1.4.4+dfsg-3) unstable; urgency=medium * Team upload. * Source only upload. libzstd (1.4.4+dfsg-2) unstable; urgency=medium * Team upload. * Install all the man pages. * Standards-Version: 4.5.0 (routine-update) * debhelper-compat 12 (routine-update) libzstd (1.4.4+dfsg-1) unstable; urgency=medium [ Justin Aplin ] * New upstream version 1.4.4+dfsg * Refresh patches * Call Salsa CI with variable DB_BUILD_PARAM: '-v1.1.2-1', since this is the oldest version in active repositories * Add Rules-Requires-Root: binary-targets to debian/control to comply with current DPM * Bump Standards-Version to 4.4.1, changes noted above * Update symbols file for libzstd1 * Call dh_makeshlibs with -V 'libzstd1 (>= 1.4.4)', since this version introduced new public symbols * Add an entry in debian/source/lintian-overrides to prevent libzstd1's Section entry from triggering binary-control-field-duplicates-source, since this field is necessary for the build libzstd (1.4.3+dfsg-1) unstable; urgency=medium [ Alexandre Mestiashvili ] * Fix a typo causing test failures on mips(el) architectures in d/patches/0013-skip-memory-greedy-tests.patch * Remove circle.yml from Files-Excluded section in d/copyright * New upstream version 1.4.3+dfsg libzstd (1.4.2+dfsg-1) unstable; urgency=medium [ Justin Aplin ] * New upstream version 1.4.2+dfsg * Refresh and drop applied by upstream patches * Add patch aliasing two renamed but unchanged symbols to maintain backwards compatibility * Build with ZSTD_LEGACY_MULTITHREADED_API=1 to maintain backwards compatibility * Update symbols file for libzstd1 * Call dh_makeshlibs with -V 'libzstd1 (>= 1.4.0)', since this version introduced new public symbols * Bump debhelper compat level to 12. * Bump Standards-Version to 4.4.0, no changes needed. * Salsa-CI integration [ Alexandre Mestiashvili ] * Add .cirrus.yml to Files-Excluded list in d/copyright libzstd (1.3.8+dfsg-3) unstable; urgency=medium * Add patch fixing zstdgrep exit code when operating on files Closes: #918390, thanks to Jörg-Volker Peetz <[email protected]> libzstd (1.3.8+dfsg-2) unstable; urgency=medium * Add patch skipping tests failing on GNU/Hurd when writing to special files such as /dev/zero or /dev/random * Upload to unstable libzstd (1.3.8+dfsg-1) experimental; urgency=medium * Add .circleci to Files-Excluded * New upstream version 1.3.8+dfsg * Update docs, install all md files and CHANGELOG * Bumpt Policy to 4.3.0 * Refresh and drop applied by upstream patches * Update symbols file for libzstd1, removed! 6 symbols from experimental API, but no reverse dependencies of libzstd1 seem to use any of the removed symbols See also: facebook/zstd#1111 * Call dh_makeshlibs with -V 'libzstd1 (>= 1.3.8)', since this version introduced new public symbols * Update zstd.lintian-overrides, zstd{grep,less} got man pages libzstd (1.3.5+dfsg-2) unstable; urgency=medium * Add udeb package for libzstd1, Closes: #908834 * Bump Policy to 4.2.1 * Call dh_makeshlibs with -V 'libzstd1 (>= 1.3.5)', since this version introduced new public symbols libzstd (1.3.5+dfsg-1) unstable; urgency=medium [ Alexandre Mestiashvili ] * Add attribuition for the patch * Fix varying number of threads in pzstd man page, making build reproducible * New upstream version 1.3.5+dfsg * Refresh and drop patches applied by upstream * Update d/zstd.lintian-overrides [ Balint Reczey ] * Update symbols file * Allow Invoking `zstd --list` When `stdin` is not a `tty` libzstd (1.3.4+dfsg-3) unstable; urgency=medium * Add patch provided by Chris Lamb making build reproducible, Closes: #897904 * Update patch skipping heavy tests on mips(el) and hurd * Add patch fixing tests on GNU/Hurd * Drop not needed override_dh_auto_test libzstd (1.3.4+dfsg-2) unstable; urgency=medium * Add liblzma-dev and liblz4-dev to build-depends to enable xz and lz4 support * Patch tests to avoid FTBFS on mips(el) architectures * Use help2man for pzstd man page, drop patches providing obsolete man pages * Update zstd.lintian-overrides, add more binaries without man pages * Add override for dh_auto_test, on hurd run only simple tests * Update 0012-typos.patch, forward to upstream libzstd (1.3.4+dfsg-1) unstable; urgency=medium * Team upload. [ Alexandre Mestiashvili ] * New upstream version 1.3.4+dfsg * Refresh patches, remove indexes * Update d/libzstd1.symbols fixing minimal-version * Update d/copyright, starting from 1.3.1 patent claim is removed * Add comments to unstable symbols [ Mattia Rizzolo ] * Update copyright after the new upstream release. [ Sascha Steinbiss ] * Remove obsolete patch. * Reword patch description. libzstd (1.3.3+dfsg-2) unstable; urgency=medium * Team upload. [ Dimitri John Ledkov ] * Mark -dev and library packages Multi-Arch same. * Update Vcs fields for salsa. * Cleanup unused patches. [ Andreas Hasenack ] * d/rules: also run the clean Makefile target in the pzstd directory. [ Alexandre Mestiashvili ] * d/control: Update my email address. * d/rules: + Disable tests if DEB_BUILD_OPTIONS set to nocheck. + Use dh_auto_build instead of $(MAKE) to avoid cross build failures. Thanks to Helmut Grohne for the patch. Closes: #895925 + Use dh_auto_clean instead of $(MAKE). [ Adam Borowski ] * Enable build on riscv64. Closes: #895259 [ Mattia Rizzolo ] * Bump debhelper compat level to 11. * Bump Standards-Version to 4.1.4, no changes needed. * Remove patch skipping a test on hurd-i386: allegedly the underlying issue has been fixed instead. libzstd (1.3.3+dfsg-1) unstable; urgency=medium * Update File-Excluded list in d/copyright * New upstream version 1.3.3+dfsg, Closes: #883816 * Refresh patches * Add zlib1g-dev to Build-Deps to enable gzip support in zstd, Closes: #883827 libzstd (1.3.2+dfsg2-2) unstable; urgency=medium * Team upload. * Do not depend libzstd in zstd package since static linking seems to be the preferred way to create the executable Closes: #884876 * Standards-Version: 4.1.2 libzstd (1.3.2+dfsg2-1) unstable; urgency=medium * Update d/copyright: - don't strip examples from source tarball - note BSD and GPL-2 license for examples * New upstream version 1.3.2+dfsg2 Closes: #883271 * Drop override_dh_auto_clean in d/rules as examples are back * Drop 0010-do_not_make_examples.patch as examples are back * Remove ruby-ronn from Build-Depends, as it renders libzstd package not installable on many architectures. Use man page shipped by upstream * Apply cme fix dpkg, reformat 0010-do-not.. patch header, fix VCS-Browser field * Add override for manpage-has-errors-from-man lintian warning * Install examples with libzstd-dev libzstd (1.3.2+dfsg1-1) unstable; urgency=medium [ Alexandre Mestiashvili ] * Update Files-Excluded section in d/copyright * New upstream version 1.3.2+dfsg1 * Update d/rules: - trick dh_auto_clean with empty exmaples dir - force man page generation * Add symbols file for libzstd1 * Add 0011-skip-long-running-tests_on_hurd.patch fixing tests on gnu hurd * Add d/patches/0012-typos.patch fixing a typo * Enable autopkgtests via d/tests/control * Override lintian's complain about missing man pages * Add myself to uploaders * Add ruby-ronn to build-deps, needed for man page generation [ Andreas Tille ] * d/watch: Fix version mangling libzstd (1.3.2+dfsg-1) unstable; urgency=medium * Team upload * New upstream version Closes: #881187 * Standards-Version: 4.1.1 libzstd (1.3.1+dfsg-2) unstable; urgency=medium * Team upload * Follow hint given by James Cowgill to recude number of threads on 32Bit MIPS architecture Closes: #876416 libzstd (1.3.1+dfsg-1) unstable; urgency=medium * Team upload * New upstream version * Exclude examples from upstream tarball Closes: #869581 * debhelper 10 * cme fix dpkg-control * Standards-Version: 4.1.0 (no changes needed) * Fix copyright libzstd (1.2.0-1) unstable; urgency=medium * New upstream release (Closes: #863159). libzstd (1.1.2-1) unstable; urgency=medium * Team upload. * New upstream version 1.1.2 libzstd (1.1.1-1) unstable; urgency=medium * New upstream version 1.1.1 (Closes: #844248) * Whitespace fix to d/control * Ensure hardening flags pass through to compiler by appending to CPPFLAGS libzstd (1.1.0-1) unstable; urgency=medium * New upstream version 1.1.0 (Closes: #839960) * Change uploader email * Build new pzstd binary, including manpage * Fix miscellaneous issues with d/rules and d/*.install * Move docs from libzstd-dev to the zstd binary libzstd (1.0.0-1) unstable; urgency=medium * Imported Upstream version 1.0.0 (Closes: #836574) * Bump library package name to libzstd1 * Changed project URLs, copyrights after move to facebook. * d/rules: hardening=+all libzstd (0.8.0-1) unstable; urgency=medium [ Kevin Murray ] * New upstream version (Closes: #834114) [ Andreas Tille ] * hardening=+bindnow libzstd (0.5.1-1) unstable; urgency=medium [ Kevin Murray ] * New upstream version (fixes a FTBFS) * Package pkgconfig file (Closes: #813854) * Fix path to tagged archives in d/watch * Add vcs URLs * Bump to standards version 3.9.7 [ Mattia Rizzolo ] * debian/rules: Remove a lot of uneeded comments and lines libzstd (0.4.7-1) unstable; urgency=low * New upstream version * Remove build date encoding to enable reproducible build libzstd (0.4.5-1) unstable; urgency=low * Initial release (Closes: #806767)
1. Follow the scheme introduced in PR facebook#2501 for both `zdict.h` and `zstd_errors.h`. 2. If the `*_VISIBLE` macro isn't set, but the `*_VISIBILITY` macro is, use that. Also make this change for `zstd.h`, since we probably shouldn't have changed that macro name without backward compatibility in the first place. 3. Change all references to `*_VISIBILITY` to `*_VISIBLE`. Fixes facebook#3359.
1. Follow the scheme introduced in PR facebook#2501 for both `zdict.h` and `zstd_errors.h`. 2. If the `*_VISIBLE` macro isn't set, but the `*_VISIBILITY` macro is, use that. Also make this change for `zstd.h`, since we probably shouldn't have changed that macro name without backward compatibility in the first place. 3. Change all references to `*_VISIBILITY` to `*_VISIBLE`. Fixes facebook#3359.
1. Follow the scheme introduced in PR facebook#2501 for both `zdict.h` and `zstd_errors.h`. 2. If the `*_VISIBLE` macro isn't set, but the `*_VISIBILITY` macro is, use that. Also make this change for `zstd.h`, since we probably shouldn't have changed that macro name without backward compatibility in the first place. 3. Change all references to `*_VISIBILITY` to `*_VISIBLE`. Fixes facebook#3359.
1. Follow the scheme introduced in PR facebook#2501 for both `zdict.h` and `zstd_errors.h`. 2. If the `*_VISIBLE` macro isn't set, but the `*_VISIBILITY` macro is, use that. Also make this change for `zstd.h`, since we probably shouldn't have changed that macro name without backward compatibility in the first place. 3. Change all references to `*_VISIBILITY` to `*_VISIBLE`. Fixes facebook#3359.
1. Follow the scheme introduced in PR facebook#2501 for both `zdict.h` and `zstd_errors.h`. 2. If the `*_VISIBLE` macro isn't set, but the `*_VISIBILITY` macro is, use that. Also make this change for `zstd.h`, since we probably shouldn't have changed that macro name without backward compatibility in the first place. 3. Change all references to `*_VISIBILITY` to `*_VISIBLE`. Fixes facebook#3359.
1. Follow the scheme introduced in PR #2501 for both `zdict.h` and `zstd_errors.h`. 2. If the `*_VISIBLE` macro isn't set, but the `*_VISIBILITY` macro is, use that. Also make this change for `zstd.h`, since we probably shouldn't have changed that macro name without backward compatibility in the first place. 3. Change all references to `*_VISIBILITY` to `*_VISIBLE`. Fixes #3359.
Even with -fvisibility=hidden added to CFLAGS, any symbol which is
given a default visibility attribute ends up exported in the dynamic
library. This happens through zstd_internal.h which defines
..._STATIC_LINKING_ONLY before including various header files, and is
included for example in lib/common/pool.c.
To avoid this, this patch distinguishes static and non-static APIs;
only the latter are exported, the former are hidden.
In addition, -fvisibility=hidden is moved to CFLAGS for libzstd-mt (as
done previously for libzstd).
Signed-off-by: Stephen Kitt [email protected]