summaryrefslogtreecommitdiff
path: root/dev-libs/json-c/files/json-c-0.19-meson-fix-lld-version-script-detection.patch
blob: 65e93abcbde551cdfe6ce6e8b2f77135a7f4139b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
https://github.com/json-c/json-c/pull/988

From: ShengYi Hung <aokblast@FreeBSD.org>
Date: Tue, 20 Oct 2026 23:23:48 -0500
Subject: [PATCH] meson: Fix lld version script detection

In lld, a symbol version with undefined symbol is rejected by
default. In previous CMake, we use a wildcard for all symbol, which is
fine for empty program. Add --undefined-version to the detection to
fix it.

---
--- a/meson.build
+++ b/meson.build
@@ -227,12 +227,18 @@
 
 add_project_arguments(cc.get_supported_arguments('-Wno-unused-parameter'), language : 'c')
 
-sym = cc.get_supported_link_arguments(
-  '-Wl,--version-script,@0@/json-c.sym'.format(
-    meson.current_source_dir(),
-  ),
+version_script_arg = '-Wl,--version-script,@0@/json-c.sym'.format(
+  meson.current_source_dir(),
 )
 
+sym = []
+if cc.has_link_argument(version_script_arg) or cc.has_multi_link_arguments(
+  version_script_arg,
+  '-Wl,--undefined-version',
+)
+  sym = [version_script_arg]
+endif
+
 # Source files
 sources = files(
   'arraylist.c', 'debug.c', 'json_c_version.c', 'json_object.c',