summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch')
-rw-r--r--meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch420
1 files changed, 420 insertions, 0 deletions
diff --git a/meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch b/meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch
new file mode 100644
index 0000000000..34a1f46b0f
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch
@@ -0,0 +1,420 @@
1From 51112447b316813ad1ae50ea66feca4eb755a424 Mon Sep 17 00:00:00 2001
2From: Yichao Yu <yyc1992@gmail.com>
3Date: Tue, 31 Mar 2020 00:43:32 -0400
4Subject: [PATCH] Fix compilation with -fno-common.
5
6[Khem Raj]
7Making all other archs consistent with IA64 which should not have this problem.
8Also move the FIXME to the correct place.
9
10Also add some minimum comments about this...
11
12[Philippe Coval]
13
14Patch ported to v1.3-stable branch,
15patch to be used used in openembedded-core dunfell branch (on v1.3.1)
16for oniro project.
17
18Upstream-Status: Backport [https://github.com/libunwind/libunwind/pull/166]
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20Thanks-to: Yichao Yu <yyc1992@gmail.com>
21Origin: https://github.com/libunwind/libunwind/commit/29e17d8d2ccbca07c423e3089a6d5ae8a1c9cb6e
22Relate-to: https://booting.oniroproject.org/distro/oniro/-/issues/191
23Forwarded: https://github.com/libunwind/libunwind/pull/312
24Last-Update: 2021-11-25
25Signed-off-by: Philippe Coval <philippe.coval@huawei.com>
26---
27 src/aarch64/Ginit.c | 15 +++++++--------
28 src/arm/Ginit.c | 15 +++++++--------
29 src/coredump/_UPT_get_dyn_info_list_addr.c | 5 +++++
30 src/hppa/Ginit.c | 15 +++++++--------
31 src/ia64/Ginit.c | 1 +
32 src/mi/Gfind_dynamic_proc_info.c | 1 +
33 src/mips/Ginit.c | 15 +++++++--------
34 src/ppc32/Ginit.c | 11 +++++++----
35 src/ppc64/Ginit.c | 11 +++++++----
36 src/ptrace/_UPT_get_dyn_info_list_addr.c | 5 +++++
37 src/sh/Ginit.c | 15 +++++++--------
38 src/tilegx/Ginit.c | 15 +++++++--------
39 src/x86/Ginit.c | 15 +++++++--------
40 src/x86_64/Ginit.c | 15 +++++++--------
41 14 files changed, 82 insertions(+), 72 deletions(-)
42
43diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c
44index 9c4eae82..cb954b15 100644
45--- a/src/aarch64/Ginit.c
46+++ b/src/aarch64/Ginit.c
47@@ -61,13 +61,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
48
49 # endif /* UNW_LOCAL_ONLY */
50
51-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
52-
53-/* XXX fix me: there is currently no way to locate the dyn-info list
54- by a remote unwinder. On ia64, this is done via a special
55- unwind-table entry. Perhaps something similar can be done with
56- DWARF2 unwind info. */
57-
58 static void
59 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
60 {
61@@ -78,7 +71,13 @@ static int
62 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
63 void *arg)
64 {
65- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
66+#ifndef UNW_LOCAL_ONLY
67+# pragma weak _U_dyn_info_list_addr
68+ if (!_U_dyn_info_list_addr)
69+ return -UNW_ENOINFO;
70+#endif
71+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
72+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
73 return 0;
74 }
75
76diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c
77index 2720d063..0bac0d72 100644
78--- a/src/arm/Ginit.c
79+++ b/src/arm/Ginit.c
80@@ -57,18 +57,17 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
81
82 # endif /* UNW_LOCAL_ONLY */
83
84-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
85-
86-/* XXX fix me: there is currently no way to locate the dyn-info list
87- by a remote unwinder. On ia64, this is done via a special
88- unwind-table entry. Perhaps something similar can be done with
89- DWARF2 unwind info. */
90-
91 static int
92 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
93 void *arg)
94 {
95- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
96+#ifndef UNW_LOCAL_ONLY
97+# pragma weak _U_dyn_info_list_addr
98+ if (!_U_dyn_info_list_addr)
99+ return -UNW_ENOINFO;
100+#endif
101+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
102+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
103 return 0;
104 }
105
106diff --git a/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/coredump/_UPT_get_dyn_info_list_addr.c
107index 0d119055..739ed056 100644
108--- a/src/coredump/_UPT_get_dyn_info_list_addr.c
109+++ b/src/coredump/_UPT_get_dyn_info_list_addr.c
110@@ -74,6 +74,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
111
112 #else
113
114+/* XXX fix me: there is currently no way to locate the dyn-info list
115+ by a remote unwinder. On ia64, this is done via a special
116+ unwind-table entry. Perhaps something similar can be done with
117+ DWARF2 unwind info. */
118+
119 static inline int
120 get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
121 int *countp)
122diff --git a/src/hppa/Ginit.c b/src/hppa/Ginit.c
123index 461e4b93..265455a6 100644
124--- a/src/hppa/Ginit.c
125+++ b/src/hppa/Ginit.c
126@@ -64,13 +64,6 @@ _Uhppa_uc_addr (ucontext_t *uc, int reg)
127
128 # endif /* UNW_LOCAL_ONLY */
129
130-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
131-
132-/* XXX fix me: there is currently no way to locate the dyn-info list
133- by a remote unwinder. On ia64, this is done via a special
134- unwind-table entry. Perhaps something similar can be done with
135- DWARF2 unwind info. */
136-
137 static void
138 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
139 {
140@@ -81,7 +74,13 @@ static int
141 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
142 void *arg)
143 {
144- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
145+#ifndef UNW_LOCAL_ONLY
146+# pragma weak _U_dyn_info_list_addr
147+ if (!_U_dyn_info_list_addr)
148+ return -UNW_ENOINFO;
149+#endif
150+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
151+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
152 return 0;
153 }
154
155diff --git a/src/ia64/Ginit.c b/src/ia64/Ginit.c
156index b09a2ad5..8601bb3c 100644
157--- a/src/ia64/Ginit.c
158+++ b/src/ia64/Ginit.c
159@@ -68,6 +68,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
160 if (!_U_dyn_info_list_addr)
161 return -UNW_ENOINFO;
162 #endif
163+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
164 *dyn_info_list_addr = _U_dyn_info_list_addr ();
165 return 0;
166 }
167diff --git a/src/mi/Gfind_dynamic_proc_info.c b/src/mi/Gfind_dynamic_proc_info.c
168index 98d35012..2e7c62e5 100644
169--- a/src/mi/Gfind_dynamic_proc_info.c
170+++ b/src/mi/Gfind_dynamic_proc_info.c
171@@ -49,6 +49,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
172 return -UNW_ENOINFO;
173 #endif
174
175+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
176 list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr ();
177 for (di = list->first; di; di = di->next)
178 if (ip >= di->start_ip && ip < di->end_ip)
179diff --git a/src/mips/Ginit.c b/src/mips/Ginit.c
180index 3df170c7..bf7a8f5a 100644
181--- a/src/mips/Ginit.c
182+++ b/src/mips/Ginit.c
183@@ -69,13 +69,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
184
185 # endif /* UNW_LOCAL_ONLY */
186
187-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
188-
189-/* XXX fix me: there is currently no way to locate the dyn-info list
190- by a remote unwinder. On ia64, this is done via a special
191- unwind-table entry. Perhaps something similar can be done with
192- DWARF2 unwind info. */
193-
194 static void
195 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
196 {
197@@ -86,7 +79,13 @@ static int
198 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
199 void *arg)
200 {
201- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
202+#ifndef UNW_LOCAL_ONLY
203+# pragma weak _U_dyn_info_list_addr
204+ if (!_U_dyn_info_list_addr)
205+ return -UNW_ENOINFO;
206+#endif
207+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
208+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
209 return 0;
210 }
211
212diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c
213index ba302448..7b454558 100644
214--- a/src/ppc32/Ginit.c
215+++ b/src/ppc32/Ginit.c
216@@ -91,9 +91,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
217
218 # endif /* UNW_LOCAL_ONLY */
219
220-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
221-
222-
223 static void
224 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
225 {
226@@ -104,7 +101,13 @@ static int
227 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
228 void *arg)
229 {
230- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
231+#ifndef UNW_LOCAL_ONLY
232+# pragma weak _U_dyn_info_list_addr
233+ if (!_U_dyn_info_list_addr)
234+ return -UNW_ENOINFO;
235+#endif
236+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
237+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
238 return 0;
239 }
240
241diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c
242index 4c88cd6e..7bfb395a 100644
243--- a/src/ppc64/Ginit.c
244+++ b/src/ppc64/Ginit.c
245@@ -95,9 +95,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
246
247 # endif /* UNW_LOCAL_ONLY */
248
249-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
250-
251-
252 static void
253 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
254 {
255@@ -108,7 +105,13 @@ static int
256 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
257 void *arg)
258 {
259- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
260+#ifndef UNW_LOCAL_ONLY
261+# pragma weak _U_dyn_info_list_addr
262+ if (!_U_dyn_info_list_addr)
263+ return -UNW_ENOINFO;
264+#endif
265+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
266+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
267 return 0;
268 }
269
270diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/ptrace/_UPT_get_dyn_info_list_addr.c
271index cc5ed044..16671d45 100644
272--- a/src/ptrace/_UPT_get_dyn_info_list_addr.c
273+++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c
274@@ -71,6 +71,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
275
276 #else
277
278+/* XXX fix me: there is currently no way to locate the dyn-info list
279+ by a remote unwinder. On ia64, this is done via a special
280+ unwind-table entry. Perhaps something similar can be done with
281+ DWARF2 unwind info. */
282+
283 static inline int
284 get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
285 int *countp)
286diff --git a/src/sh/Ginit.c b/src/sh/Ginit.c
287index 52988a72..9fe96d2b 100644
288--- a/src/sh/Ginit.c
289+++ b/src/sh/Ginit.c
290@@ -58,13 +58,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
291
292 # endif /* UNW_LOCAL_ONLY */
293
294-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
295-
296-/* XXX fix me: there is currently no way to locate the dyn-info list
297- by a remote unwinder. On ia64, this is done via a special
298- unwind-table entry. Perhaps something similar can be done with
299- DWARF2 unwind info. */
300-
301 static void
302 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
303 {
304@@ -75,7 +68,13 @@ static int
305 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
306 void *arg)
307 {
308- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
309+#ifndef UNW_LOCAL_ONLY
310+# pragma weak _U_dyn_info_list_addr
311+ if (!_U_dyn_info_list_addr)
312+ return -UNW_ENOINFO;
313+#endif
314+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
315+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
316 return 0;
317 }
318
319diff --git a/src/tilegx/Ginit.c b/src/tilegx/Ginit.c
320index 7564a558..925e6413 100644
321--- a/src/tilegx/Ginit.c
322+++ b/src/tilegx/Ginit.c
323@@ -64,13 +64,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
324
325 # endif /* UNW_LOCAL_ONLY */
326
327-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
328-
329-/* XXX fix me: there is currently no way to locate the dyn-info list
330- by a remote unwinder. On ia64, this is done via a special
331- unwind-table entry. Perhaps something similar can be done with
332- DWARF2 unwind info. */
333-
334 static void
335 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
336 {
337@@ -81,7 +74,13 @@ static int
338 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
339 void *arg)
340 {
341- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
342+#ifndef UNW_LOCAL_ONLY
343+# pragma weak _U_dyn_info_list_addr
344+ if (!_U_dyn_info_list_addr)
345+ return -UNW_ENOINFO;
346+#endif
347+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
348+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
349 return 0;
350 }
351
352diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c
353index f6b8dc27..3cec74a2 100644
354--- a/src/x86/Ginit.c
355+++ b/src/x86/Ginit.c
356@@ -54,13 +54,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
357
358 # endif /* UNW_LOCAL_ONLY */
359
360-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
361-
362-/* XXX fix me: there is currently no way to locate the dyn-info list
363- by a remote unwinder. On ia64, this is done via a special
364- unwind-table entry. Perhaps something similar can be done with
365- DWARF2 unwind info. */
366-
367 static void
368 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
369 {
370@@ -71,7 +64,13 @@ static int
371 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
372 void *arg)
373 {
374- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
375+#ifndef UNW_LOCAL_ONLY
376+# pragma weak _U_dyn_info_list_addr
377+ if (!_U_dyn_info_list_addr)
378+ return -UNW_ENOINFO;
379+#endif
380+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
381+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
382 return 0;
383 }
384
385diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
386index b7e8e462..fe6bcc33 100644
387--- a/src/x86_64/Ginit.c
388+++ b/src/x86_64/Ginit.c
389@@ -49,13 +49,6 @@ static struct unw_addr_space local_addr_space;
390
391 unw_addr_space_t unw_local_addr_space = &local_addr_space;
392
393-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
394-
395-/* XXX fix me: there is currently no way to locate the dyn-info list
396- by a remote unwinder. On ia64, this is done via a special
397- unwind-table entry. Perhaps something similar can be done with
398- DWARF2 unwind info. */
399-
400 static void
401 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
402 {
403@@ -66,7 +59,13 @@ static int
404 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
405 void *arg)
406 {
407- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
408+#ifndef UNW_LOCAL_ONLY
409+# pragma weak _U_dyn_info_list_addr
410+ if (!_U_dyn_info_list_addr)
411+ return -UNW_ENOINFO;
412+#endif
413+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
414+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
415 return 0;
416 }
417
418--
4192.32.0
420