OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

458 lines
16 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../libunwind/0001-Fix-compilation-with-fno-common.patch
  5. # Copyright (C) 2020 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From 29e17d8d2ccbca07c423e3089a6d5ae8a1c9cb6e Mon Sep 17 00:00:00 2001
  17. From: Yichao Yu <yyc1992@gmail.com>
  18. Date: Tue, 31 Mar 2020 00:43:32 -0400
  19. Subject: [PATCH] Fix compilation with -fno-common.
  20. Making all other archs consistent with IA64 which should not have this problem.
  21. Also move the FIXME to the correct place.
  22. Also add some minimum comments about this...
  23. ---
  24. src/aarch64/Ginit.c | 15 +++++++--------
  25. src/arm/Ginit.c | 15 +++++++--------
  26. src/coredump/_UPT_get_dyn_info_list_addr.c | 5 +++++
  27. src/hppa/Ginit.c | 15 +++++++--------
  28. src/ia64/Ginit.c | 1 +
  29. src/mi/Gfind_dynamic_proc_info.c | 1 +
  30. src/mips/Ginit.c | 15 +++++++--------
  31. src/ppc32/Ginit.c | 11 +++++++----
  32. src/ppc64/Ginit.c | 11 +++++++----
  33. src/ptrace/_UPT_get_dyn_info_list_addr.c | 5 +++++
  34. src/s390x/Ginit.c | 15 +++++++--------
  35. src/sh/Ginit.c | 15 +++++++--------
  36. src/tilegx/Ginit.c | 15 +++++++--------
  37. src/x86/Ginit.c | 15 +++++++--------
  38. src/x86_64/Ginit.c | 15 +++++++--------
  39. 15 files changed, 89 insertions(+), 80 deletions(-)
  40. diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c
  41. index dec235c82..35389762f 100644
  42. --- a/src/aarch64/Ginit.c
  43. +++ b/src/aarch64/Ginit.c
  44. @@ -61,13 +61,6 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
  45. # endif /* UNW_LOCAL_ONLY */
  46. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  47. -
  48. -/* XXX fix me: there is currently no way to locate the dyn-info list
  49. - by a remote unwinder. On ia64, this is done via a special
  50. - unwind-table entry. Perhaps something similar can be done with
  51. - DWARF2 unwind info. */
  52. -
  53. static void
  54. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  55. {
  56. @@ -78,7 +71,13 @@ static int
  57. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  58. void *arg)
  59. {
  60. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  61. +#ifndef UNW_LOCAL_ONLY
  62. +# pragma weak _U_dyn_info_list_addr
  63. + if (!_U_dyn_info_list_addr)
  64. + return -UNW_ENOINFO;
  65. +#endif
  66. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  67. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  68. return 0;
  69. }
  70. diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c
  71. index 2720d063a..0bac0d72d 100644
  72. --- a/src/arm/Ginit.c
  73. +++ b/src/arm/Ginit.c
  74. @@ -57,18 +57,17 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
  75. # endif /* UNW_LOCAL_ONLY */
  76. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  77. -
  78. -/* XXX fix me: there is currently no way to locate the dyn-info list
  79. - by a remote unwinder. On ia64, this is done via a special
  80. - unwind-table entry. Perhaps something similar can be done with
  81. - DWARF2 unwind info. */
  82. -
  83. static int
  84. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  85. void *arg)
  86. {
  87. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  88. +#ifndef UNW_LOCAL_ONLY
  89. +# pragma weak _U_dyn_info_list_addr
  90. + if (!_U_dyn_info_list_addr)
  91. + return -UNW_ENOINFO;
  92. +#endif
  93. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  94. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  95. return 0;
  96. }
  97. diff --git a/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/coredump/_UPT_get_dyn_info_list_addr.c
  98. index 0d1190556..739ed0569 100644
  99. --- a/src/coredump/_UPT_get_dyn_info_list_addr.c
  100. +++ b/src/coredump/_UPT_get_dyn_info_list_addr.c
  101. @@ -74,6 +74,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
  102. #else
  103. +/* XXX fix me: there is currently no way to locate the dyn-info list
  104. + by a remote unwinder. On ia64, this is done via a special
  105. + unwind-table entry. Perhaps something similar can be done with
  106. + DWARF2 unwind info. */
  107. +
  108. static inline int
  109. get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
  110. int *countp)
  111. diff --git a/src/hppa/Ginit.c b/src/hppa/Ginit.c
  112. index 461e4b93d..265455a68 100644
  113. --- a/src/hppa/Ginit.c
  114. +++ b/src/hppa/Ginit.c
  115. @@ -64,13 +64,6 @@ _Uhppa_uc_addr (ucontext_t *uc, int reg)
  116. # endif /* UNW_LOCAL_ONLY */
  117. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  118. -
  119. -/* XXX fix me: there is currently no way to locate the dyn-info list
  120. - by a remote unwinder. On ia64, this is done via a special
  121. - unwind-table entry. Perhaps something similar can be done with
  122. - DWARF2 unwind info. */
  123. -
  124. static void
  125. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  126. {
  127. @@ -81,7 +74,13 @@ static int
  128. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  129. void *arg)
  130. {
  131. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  132. +#ifndef UNW_LOCAL_ONLY
  133. +# pragma weak _U_dyn_info_list_addr
  134. + if (!_U_dyn_info_list_addr)
  135. + return -UNW_ENOINFO;
  136. +#endif
  137. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  138. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  139. return 0;
  140. }
  141. diff --git a/src/ia64/Ginit.c b/src/ia64/Ginit.c
  142. index b09a2ad57..8601bb3ca 100644
  143. --- a/src/ia64/Ginit.c
  144. +++ b/src/ia64/Ginit.c
  145. @@ -68,6 +68,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  146. if (!_U_dyn_info_list_addr)
  147. return -UNW_ENOINFO;
  148. #endif
  149. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  150. *dyn_info_list_addr = _U_dyn_info_list_addr ();
  151. return 0;
  152. }
  153. diff --git a/src/mi/Gfind_dynamic_proc_info.c b/src/mi/Gfind_dynamic_proc_info.c
  154. index 98d350128..2e7c62e5e 100644
  155. --- a/src/mi/Gfind_dynamic_proc_info.c
  156. +++ b/src/mi/Gfind_dynamic_proc_info.c
  157. @@ -49,6 +49,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
  158. return -UNW_ENOINFO;
  159. #endif
  160. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  161. list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr ();
  162. for (di = list->first; di; di = di->next)
  163. if (ip >= di->start_ip && ip < di->end_ip)
  164. diff --git a/src/mips/Ginit.c b/src/mips/Ginit.c
  165. index 3df170c75..bf7a8f5a8 100644
  166. --- a/src/mips/Ginit.c
  167. +++ b/src/mips/Ginit.c
  168. @@ -69,13 +69,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
  169. # endif /* UNW_LOCAL_ONLY */
  170. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  171. -
  172. -/* XXX fix me: there is currently no way to locate the dyn-info list
  173. - by a remote unwinder. On ia64, this is done via a special
  174. - unwind-table entry. Perhaps something similar can be done with
  175. - DWARF2 unwind info. */
  176. -
  177. static void
  178. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  179. {
  180. @@ -86,7 +79,13 @@ static int
  181. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  182. void *arg)
  183. {
  184. - *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
  185. +#ifndef UNW_LOCAL_ONLY
  186. +# pragma weak _U_dyn_info_list_addr
  187. + if (!_U_dyn_info_list_addr)
  188. + return -UNW_ENOINFO;
  189. +#endif
  190. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  191. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  192. return 0;
  193. }
  194. diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c
  195. index ba302448a..7b4545580 100644
  196. --- a/src/ppc32/Ginit.c
  197. +++ b/src/ppc32/Ginit.c
  198. @@ -91,9 +91,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
  199. # endif /* UNW_LOCAL_ONLY */
  200. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  201. -
  202. -
  203. static void
  204. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  205. {
  206. @@ -104,7 +101,13 @@ static int
  207. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  208. void *arg)
  209. {
  210. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  211. +#ifndef UNW_LOCAL_ONLY
  212. +# pragma weak _U_dyn_info_list_addr
  213. + if (!_U_dyn_info_list_addr)
  214. + return -UNW_ENOINFO;
  215. +#endif
  216. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  217. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  218. return 0;
  219. }
  220. diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c
  221. index 4c88cd6e7..7bfb395a7 100644
  222. --- a/src/ppc64/Ginit.c
  223. +++ b/src/ppc64/Ginit.c
  224. @@ -95,9 +95,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
  225. # endif /* UNW_LOCAL_ONLY */
  226. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  227. -
  228. -
  229. static void
  230. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  231. {
  232. @@ -108,7 +105,13 @@ static int
  233. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  234. void *arg)
  235. {
  236. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  237. +#ifndef UNW_LOCAL_ONLY
  238. +# pragma weak _U_dyn_info_list_addr
  239. + if (!_U_dyn_info_list_addr)
  240. + return -UNW_ENOINFO;
  241. +#endif
  242. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  243. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  244. return 0;
  245. }
  246. diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/ptrace/_UPT_get_dyn_info_list_addr.c
  247. index cc5ed0441..16671d453 100644
  248. --- a/src/ptrace/_UPT_get_dyn_info_list_addr.c
  249. +++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c
  250. @@ -71,6 +71,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
  251. #else
  252. +/* XXX fix me: there is currently no way to locate the dyn-info list
  253. + by a remote unwinder. On ia64, this is done via a special
  254. + unwind-table entry. Perhaps something similar can be done with
  255. + DWARF2 unwind info. */
  256. +
  257. static inline int
  258. get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
  259. int *countp)
  260. diff --git a/src/s390x/Ginit.c b/src/s390x/Ginit.c
  261. index f0886ac93..db01743c0 100644
  262. --- a/src/s390x/Ginit.c
  263. +++ b/src/s390x/Ginit.c
  264. @@ -50,8 +50,6 @@ static struct unw_addr_space local_addr_space;
  265. unw_addr_space_t unw_local_addr_space = &local_addr_space;
  266. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  267. -
  268. static inline void *
  269. uc_addr (ucontext_t *uc, int reg)
  270. {
  271. @@ -75,11 +73,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
  272. # endif /* UNW_LOCAL_ONLY */
  273. -/* XXX fix me: there is currently no way to locate the dyn-info list
  274. - by a remote unwinder. On ia64, this is done via a special
  275. - unwind-table entry. Perhaps something similar can be done with
  276. - DWARF2 unwind info. */
  277. -
  278. static void
  279. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  280. {
  281. @@ -90,7 +83,13 @@ static int
  282. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  283. void *arg)
  284. {
  285. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  286. +#ifndef UNW_LOCAL_ONLY
  287. +# pragma weak _U_dyn_info_list_addr
  288. + if (!_U_dyn_info_list_addr)
  289. + return -UNW_ENOINFO;
  290. +#endif
  291. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  292. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  293. return 0;
  294. }
  295. diff --git a/src/sh/Ginit.c b/src/sh/Ginit.c
  296. index 52988a721..9fe96d2bd 100644
  297. --- a/src/sh/Ginit.c
  298. +++ b/src/sh/Ginit.c
  299. @@ -58,13 +58,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
  300. # endif /* UNW_LOCAL_ONLY */
  301. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  302. -
  303. -/* XXX fix me: there is currently no way to locate the dyn-info list
  304. - by a remote unwinder. On ia64, this is done via a special
  305. - unwind-table entry. Perhaps something similar can be done with
  306. - DWARF2 unwind info. */
  307. -
  308. static void
  309. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  310. {
  311. @@ -75,7 +68,13 @@ static int
  312. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  313. void *arg)
  314. {
  315. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  316. +#ifndef UNW_LOCAL_ONLY
  317. +# pragma weak _U_dyn_info_list_addr
  318. + if (!_U_dyn_info_list_addr)
  319. + return -UNW_ENOINFO;
  320. +#endif
  321. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  322. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  323. return 0;
  324. }
  325. diff --git a/src/tilegx/Ginit.c b/src/tilegx/Ginit.c
  326. index 7564a558b..925e64132 100644
  327. --- a/src/tilegx/Ginit.c
  328. +++ b/src/tilegx/Ginit.c
  329. @@ -64,13 +64,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
  330. # endif /* UNW_LOCAL_ONLY */
  331. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  332. -
  333. -/* XXX fix me: there is currently no way to locate the dyn-info list
  334. - by a remote unwinder. On ia64, this is done via a special
  335. - unwind-table entry. Perhaps something similar can be done with
  336. - DWARF2 unwind info. */
  337. -
  338. static void
  339. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  340. {
  341. @@ -81,7 +74,13 @@ static int
  342. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  343. void *arg)
  344. {
  345. - *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
  346. +#ifndef UNW_LOCAL_ONLY
  347. +# pragma weak _U_dyn_info_list_addr
  348. + if (!_U_dyn_info_list_addr)
  349. + return -UNW_ENOINFO;
  350. +#endif
  351. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  352. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  353. return 0;
  354. }
  355. diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c
  356. index f6b8dc27d..3cec74a21 100644
  357. --- a/src/x86/Ginit.c
  358. +++ b/src/x86/Ginit.c
  359. @@ -54,13 +54,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
  360. # endif /* UNW_LOCAL_ONLY */
  361. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  362. -
  363. -/* XXX fix me: there is currently no way to locate the dyn-info list
  364. - by a remote unwinder. On ia64, this is done via a special
  365. - unwind-table entry. Perhaps something similar can be done with
  366. - DWARF2 unwind info. */
  367. -
  368. static void
  369. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  370. {
  371. @@ -71,7 +64,13 @@ static int
  372. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  373. void *arg)
  374. {
  375. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  376. +#ifndef UNW_LOCAL_ONLY
  377. +# pragma weak _U_dyn_info_list_addr
  378. + if (!_U_dyn_info_list_addr)
  379. + return -UNW_ENOINFO;
  380. +#endif
  381. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  382. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  383. return 0;
  384. }
  385. diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
  386. index a865d3385..fd8d418b1 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. unw_addr_space_t unw_local_addr_space = &local_addr_space;
  391. -HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
  392. -
  393. -/* XXX fix me: there is currently no way to locate the dyn-info list
  394. - by a remote unwinder. On ia64, this is done via a special
  395. - unwind-table entry. Perhaps something similar can be done with
  396. - DWARF2 unwind info. */
  397. -
  398. static void
  399. put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
  400. {
  401. @@ -66,7 +59,13 @@ static int
  402. get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
  403. void *arg)
  404. {
  405. - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
  406. +#ifndef UNW_LOCAL_ONLY
  407. +# pragma weak _U_dyn_info_list_addr
  408. + if (!_U_dyn_info_list_addr)
  409. + return -UNW_ENOINFO;
  410. +#endif
  411. + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
  412. + *dyn_info_list_addr = _U_dyn_info_list_addr ();
  413. return 0;
  414. }