summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/meson/meson.inc1
-rw-r--r--meta/recipes-devtools/meson/meson/dbc9e971bd320f3df15c1ee74f54858e6792b183.patch95
2 files changed, 96 insertions, 0 deletions
diff --git a/meta/recipes-devtools/meson/meson.inc b/meta/recipes-devtools/meson/meson.inc
index ae0091c051..84bcc8409d 100644
--- a/meta/recipes-devtools/meson/meson.inc
+++ b/meta/recipes-devtools/meson/meson.inc
@@ -16,6 +16,7 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
16 file://cross-prop-default.patch \ 16 file://cross-prop-default.patch \
17 file://0001-mesonbuild-environment.py-check-environment-for-vari.patch \ 17 file://0001-mesonbuild-environment.py-check-environment-for-vari.patch \
18 file://0001-modules-python.py-do-not-substitute-python-s-install.patch \ 18 file://0001-modules-python.py-do-not-substitute-python-s-install.patch \
19 file://dbc9e971bd320f3df15c1ee74f54858e6792b183.patch \
19 " 20 "
20SRC_URI[sha256sum] = "d60f75f0dedcc4fd249dbc7519d6f3ce6df490033d276ef1cf27453ef4938d32" 21SRC_URI[sha256sum] = "d60f75f0dedcc4fd249dbc7519d6f3ce6df490033d276ef1cf27453ef4938d32"
21SRC_URI[md5sum] = "7ea7772414dda8ae11072244bf7ba991" 22SRC_URI[md5sum] = "7ea7772414dda8ae11072244bf7ba991"
diff --git a/meta/recipes-devtools/meson/meson/dbc9e971bd320f3df15c1ee74f54858e6792b183.patch b/meta/recipes-devtools/meson/meson/dbc9e971bd320f3df15c1ee74f54858e6792b183.patch
new file mode 100644
index 0000000000..7ea8a133e6
--- /dev/null
+++ b/meta/recipes-devtools/meson/meson/dbc9e971bd320f3df15c1ee74f54858e6792b183.patch
@@ -0,0 +1,95 @@
1From dbc9e971bd320f3df15c1ee74f54858e6792b183 Mon Sep 17 00:00:00 2001
2From: Xavier Claessens <xavier.claessens@collabora.com>
3Date: Fri, 11 Oct 2019 11:01:22 -0400
4Subject: [PATCH] Remove duplicated object files in static libraries
5
6When a static library link_whole to a bunch of other static libraries,
7we have to extract all their objects recursively. But that could
8introduce duplicated objects. ar is dumb enough to allow this without
9error, but once the resulting static library is linked into an
10executable or shared library, the linker will complain about duplicated
11symbols.
12
13Upstream-Status: Backport
14Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
15
16---
17 mesonbuild/backend/backends.py | 3 ++-
18 test cases/unit/69 static link/lib/func17.c | 4 ++++
19 test cases/unit/69 static link/lib/func18.c | 6 ++++++
20 test cases/unit/69 static link/lib/func19.c | 7 +++++++
21 test cases/unit/69 static link/lib/meson.build | 12 ++++++++++++
22 5 files changed, 31 insertions(+), 1 deletion(-)
23 create mode 100644 test cases/unit/69 static link/lib/func17.c
24 create mode 100644 test cases/unit/69 static link/lib/func18.c
25 create mode 100644 test cases/unit/69 static link/lib/func19.c
26
27diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
28index 947be1cbef..e54809657f 100644
29--- a/mesonbuild/backend/backends.py
30+++ b/mesonbuild/backend/backends.py
31@@ -281,7 +281,8 @@ def relpath(self, todir, fromdir):
32 os.path.join('dummyprefixdir', fromdir))
33
34 def flatten_object_list(self, target, proj_dir_to_build_root=''):
35- return self._flatten_object_list(target, target.get_objects(), proj_dir_to_build_root)
36+ obj_list = self._flatten_object_list(target, target.get_objects(), proj_dir_to_build_root)
37+ return list(dict.fromkeys(obj_list))
38
39 def _flatten_object_list(self, target, objects, proj_dir_to_build_root):
40 obj_list = []
41diff --git a/test cases/unit/69 static link/lib/func17.c b/test cases/unit/69 static link/lib/func17.c
42new file mode 100644
43index 0000000000..d1d8ec498c
44--- /dev/null
45+++ b/test cases/unit/69 static link/lib/func17.c
46@@ -0,0 +1,4 @@
47+int func17()
48+{
49+ return 1;
50+}
51diff --git a/test cases/unit/69 static link/lib/func18.c b/test cases/unit/69 static link/lib/func18.c
52new file mode 100644
53index 0000000000..c149085ba4
54--- /dev/null
55+++ b/test cases/unit/69 static link/lib/func18.c
56@@ -0,0 +1,6 @@
57+int func17();
58+
59+int func18()
60+{
61+ return func17() + 1;
62+}
63diff --git a/test cases/unit/69 static link/lib/func19.c b/test cases/unit/69 static link/lib/func19.c
64new file mode 100644
65index 0000000000..69120e4bf8
66--- /dev/null
67+++ b/test cases/unit/69 static link/lib/func19.c
68@@ -0,0 +1,7 @@
69+int func17();
70+int func18();
71+
72+int func19()
73+{
74+ return func17() + func18();
75+}
76diff --git a/test cases/unit/69 static link/lib/meson.build b/test cases/unit/69 static link/lib/meson.build
77index 5f04aab6a1..8f95fc4546 100644
78--- a/test cases/unit/69 static link/lib/meson.build
79+++ b/test cases/unit/69 static link/lib/meson.build
80@@ -66,3 +66,15 @@ libfunc15 = static_library('func15', 'func15.c',
81 libfunc16 = static_library('func16', 'func16.c',
82 link_with : libfunc15,
83 install : true)
84+
85+# Verify func17.c.o gets included only once into libfunc19, otherwise
86+# func19-shared would failed with duplicated symbol.
87+libfunc17 = static_library('func17', 'func17.c',
88+ install : false)
89+libfunc18 = static_library('func18', 'func18.c',
90+ link_with : libfunc17,
91+ install : false)
92+libfunc19 = static_library('func19', 'func19.c',
93+ link_whole : [libfunc17, libfunc18],
94+ install : false)
95+shared_library('func19-shared', link_whole : [libfunc19])