Commit bdced75
authored
build: export only the public API on Windows, not every symbol (#79)
-Wl,--export-all-symbols dumped every internal helper (FSE_*, HUF_*,
COVER_*, ...) into the PE export table alongside the real public API -
inconsistent with the tight -fvisibility=hidden surface built for
ELF/Mach-O.
zstd.h already gates its public API on ZSTD_DLL_EXPORT: with it defined,
ZSTDLIB_API expands to __declspec(dllexport) for exactly the symbols
tagged in zstd.h, the PE equivalent of ZSTDLIB_VISIBLE. Switch Windows to
-DZSTD_DLL_EXPORT=1 and keep -fvisibility=hidden on (it also governs
whether lld auto-exports undecorated globals on PE) instead of
--export-all-symbols.
Verified against a cross-compiled windows-x86_64 libzstd.dll: export
count drops from 576 to 185 symbols, and every ZSTD_*/ZDICT_* symbol the
Java bindings actually call (77, cross-checked against Bindings.java) is
still present.1 parent 955dc96 commit bdced75
1 file changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
103 | 107 | | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| |||
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
112 | | - | |
| 117 | + | |
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
| |||
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
132 | | - | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| |||
0 commit comments