]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
meson: set the symbol visibility of the shared library to hidden 2746/head
authorEli Schwartz <eschwartz@archlinux.org>
Mon, 9 Aug 2021 01:43:59 +0000 (21:43 -0400)
committerEli Schwartz <eschwartz@archlinux.org>
Tue, 10 Aug 2021 02:03:17 +0000 (22:03 -0400)
This matches the Makefile build. Due to one private xxhash symbol in use
by the program, it recompiles a private copy of xxhash.

Due to the test binaries making extensive (?) use of private symbols, it
doesn't even attempt to link to shared libzstd, and instead, all of the
original object files are added to libtestcommon itself for private
linkage. This, too, matches the Makefile build.

Ref. #2261

build/meson/lib/meson.build
build/meson/meson.build
build/meson/programs/meson.build
build/meson/tests/meson.build

index 5cc9fee86251d18e89a111b73d25ccded4dc994e..5da538729590ae281c8a1fb13e09319d4e802010 100644 (file)
@@ -108,6 +108,7 @@ libzstd = library('zstd',
   libzstd_sources,
   include_directories: libzstd_includes,
   c_args: libzstd_c_args,
+  gnu_symbol_visibility: 'hidden',
   dependencies: libzstd_deps,
   install: true,
   version: zstd_libversion)
index b74932c41e21dc4ae68bfb0e8d3b70af65cc626d..0c29a7621b91114d8a3d31c022166067cea67d4c 100644 (file)
@@ -21,7 +21,7 @@ project('zstd',
     #'werror=true'
   ],
   version: 'DUMMY',
-  meson_version: '>=0.47.0')
+  meson_version: '>=0.48.0')
 
 cc = meson.get_compiler('c')
 cxx = meson.get_compiler('cpp')
index d255627cd305adb79c2fd1ba5336a51f04a8d7b2..4181030c2ee339157dde4cedb61a28965a6ff5b2 100644 (file)
@@ -18,7 +18,9 @@ zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
   join_paths(zstd_rootdir, 'programs/benchzstd.c'),
   join_paths(zstd_rootdir, 'programs/datagen.c'),
   join_paths(zstd_rootdir, 'programs/dibio.c'),
-  join_paths(zstd_rootdir, 'programs/zstdcli_trace.c')]
+  join_paths(zstd_rootdir, 'programs/zstdcli_trace.c'),
+  # needed due to use of private symbol + -fvisibility=hidden
+  join_paths(zstd_rootdir, 'lib/common/xxhash.c')]
 
 zstd_c_args = libzstd_debug_cflags
 if use_multi_thread
index 0c4c3535a5bd96746c9408cd130b1547e83d595c..14f45982ab12fcd577f7afc08915c8875ce5606d 100644 (file)
@@ -34,32 +34,36 @@ testcommon_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'),
   join_paths(zstd_rootdir, 'programs/timefn.c'),
   join_paths(zstd_rootdir, 'programs/benchfn.c'),
   join_paths(zstd_rootdir, 'programs/benchzstd.c')]
+
 testcommon = static_library('testcommon',
-  testcommon_sources)
+  testcommon_sources,
+  # needed due to use of private symbol + -fvisibility=hidden
+  objects: libzstd.extract_all_objects(recursive: false))
+
+testcommon_dep = declare_dependency(link_with: testcommon,
+  dependencies: libzstd_deps,
+  include_directories: libzstd_includes)
 
 datagen_sources = [join_paths(zstd_rootdir, 'tests/datagencli.c')]
 datagen = executable('datagen',
   datagen_sources,
   c_args: [ '-DNDEBUG' ],
   include_directories: test_includes,
-  dependencies: libzstd_dep,
-  link_with: testcommon,
+  dependencies: testcommon_dep,
   install: false)
 
 fullbench_sources = [join_paths(zstd_rootdir, 'tests/fullbench.c')]
 fullbench = executable('fullbench',
   fullbench_sources,
   include_directories: test_includes,
-  dependencies: libzstd_dep,
-  link_with: testcommon,
+  dependencies: testcommon_dep,
   install: false)
 
 fuzzer_sources = [join_paths(zstd_rootdir, 'tests/fuzzer.c')]
 fuzzer = executable('fuzzer',
   fuzzer_sources,
   include_directories: test_includes,
-  dependencies: [ libzstd_dep, thread_dep ],
-  link_with: testcommon,
+  dependencies: [ testcommon_dep, thread_dep ],
   install: false)
 
 zstreamtest_sources = [join_paths(zstd_rootdir, 'tests/seqgen.c'),
@@ -67,22 +71,20 @@ zstreamtest_sources = [join_paths(zstd_rootdir, 'tests/seqgen.c'),
 zstreamtest = executable('zstreamtest',
   zstreamtest_sources,
   include_directories: test_includes,
-  dependencies: libzstd_dep,
-  link_with: testcommon,
+  dependencies: testcommon_dep,
   install: false)
 
 paramgrill_sources = [join_paths(zstd_rootdir, 'tests/paramgrill.c')]
 paramgrill = executable('paramgrill',
   paramgrill_sources,
   include_directories: test_includes,
-  dependencies: [ libzstd_dep, libm_dep ],
-  link_with: testcommon,
+  dependencies: [ testcommon_dep, libm_dep ],
   install: false)
 
 roundTripCrash_sources = [join_paths(zstd_rootdir, 'tests/roundTripCrash.c')]
 roundTripCrash = executable('roundTripCrash',
   roundTripCrash_sources,
-  dependencies: [ libzstd_dep ],
+  dependencies: [ testcommon_dep ],
   install: false)
 
 longmatch_sources = [join_paths(zstd_rootdir, 'tests/longmatch.c')]
@@ -111,8 +113,7 @@ decodecorpus_sources = [join_paths(zstd_rootdir, 'tests/decodecorpus.c')]
 decodecorpus = executable('decodecorpus',
   decodecorpus_sources,
   include_directories: test_includes,
-  dependencies: [ libzstd_dep, libm_dep ],
-  link_with: testcommon,
+  dependencies: [ testcommon_dep, libm_dep ],
   install: false)
 
 poolTests_sources = [join_paths(zstd_rootdir, 'tests/poolTests.c'),
@@ -123,8 +124,7 @@ poolTests_sources = [join_paths(zstd_rootdir, 'tests/poolTests.c'),
 poolTests = executable('poolTests',
   poolTests_sources,
   include_directories: test_includes,
-  dependencies: [ libzstd_dep, thread_dep ],
-  link_with: testcommon,
+  dependencies: [ testcommon_dep, thread_dep ],
   install: false)
 
 checkTag_sources = [join_paths(zstd_rootdir, 'tests/checkTag.c')]