Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 1 | From 00d18b21dcb9723c4f13889a39a760a654782370 Mon Sep 17 00:00:00 2001 |
| 2 | From: Yichao Yu <yyc1992@gmail.com> |
| 3 | Date: Tue, 31 Mar 2020 00:43:32 -0400 |
| 4 | Subject: [PATCH] Fix compilation with -fno-common. |
| 5 | |
| 6 | Making all other archs consistent with IA64 which should not have this problem. |
| 7 | Also move the FIXME to the correct place. |
| 8 | |
| 9 | Also add some minimum comments about this... |
| 10 | |
| 11 | Upstream-Status: Backport [https://github.com/libunwind/libunwind/pull/166] |
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 13 | --- |
| 14 | src/aarch64/Ginit.c | 15 +++++++-------- |
| 15 | src/arm/Ginit.c | 15 +++++++-------- |
| 16 | src/coredump/_UPT_get_dyn_info_list_addr.c | 5 +++++ |
| 17 | src/hppa/Ginit.c | 15 +++++++-------- |
| 18 | src/ia64/Ginit.c | 1 + |
| 19 | src/mi/Gfind_dynamic_proc_info.c | 1 + |
| 20 | src/mips/Ginit.c | 15 +++++++-------- |
| 21 | src/ppc32/Ginit.c | 11 +++++++---- |
| 22 | src/ppc64/Ginit.c | 11 +++++++---- |
| 23 | src/ptrace/_UPT_get_dyn_info_list_addr.c | 5 +++++ |
| 24 | src/s390x/Ginit.c | 15 +++++++-------- |
| 25 | src/sh/Ginit.c | 15 +++++++-------- |
| 26 | src/tilegx/Ginit.c | 15 +++++++-------- |
| 27 | src/x86/Ginit.c | 15 +++++++-------- |
| 28 | src/x86_64/Ginit.c | 15 +++++++-------- |
| 29 | 15 files changed, 89 insertions(+), 80 deletions(-) |
| 30 | |
| 31 | diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c |
| 32 | index dec235c..3538976 100644 |
| 33 | --- a/src/aarch64/Ginit.c |
| 34 | +++ b/src/aarch64/Ginit.c |
| 35 | @@ -61,13 +61,6 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg) |
| 36 | |
| 37 | # endif /* UNW_LOCAL_ONLY */ |
| 38 | |
| 39 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 40 | - |
| 41 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 42 | - by a remote unwinder. On ia64, this is done via a special |
| 43 | - unwind-table entry. Perhaps something similar can be done with |
| 44 | - DWARF2 unwind info. */ |
| 45 | - |
| 46 | static void |
| 47 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 48 | { |
| 49 | @@ -78,7 +71,13 @@ static int |
| 50 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 51 | void *arg) |
| 52 | { |
| 53 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 54 | +#ifndef UNW_LOCAL_ONLY |
| 55 | +# pragma weak _U_dyn_info_list_addr |
| 56 | + if (!_U_dyn_info_list_addr) |
| 57 | + return -UNW_ENOINFO; |
| 58 | +#endif |
| 59 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 60 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c |
| 65 | index 2720d06..0bac0d7 100644 |
| 66 | --- a/src/arm/Ginit.c |
| 67 | +++ b/src/arm/Ginit.c |
| 68 | @@ -57,18 +57,17 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg) |
| 69 | |
| 70 | # endif /* UNW_LOCAL_ONLY */ |
| 71 | |
| 72 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 73 | - |
| 74 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 75 | - by a remote unwinder. On ia64, this is done via a special |
| 76 | - unwind-table entry. Perhaps something similar can be done with |
| 77 | - DWARF2 unwind info. */ |
| 78 | - |
| 79 | static int |
| 80 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 81 | void *arg) |
| 82 | { |
| 83 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 84 | +#ifndef UNW_LOCAL_ONLY |
| 85 | +# pragma weak _U_dyn_info_list_addr |
| 86 | + if (!_U_dyn_info_list_addr) |
| 87 | + return -UNW_ENOINFO; |
| 88 | +#endif |
| 89 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 90 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | diff --git a/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/coredump/_UPT_get_dyn_info_list_addr.c |
| 95 | index 0d11905..739ed05 100644 |
| 96 | --- a/src/coredump/_UPT_get_dyn_info_list_addr.c |
| 97 | +++ b/src/coredump/_UPT_get_dyn_info_list_addr.c |
| 98 | @@ -74,6 +74,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, |
| 99 | |
| 100 | #else |
| 101 | |
| 102 | +/* XXX fix me: there is currently no way to locate the dyn-info list |
| 103 | + by a remote unwinder. On ia64, this is done via a special |
| 104 | + unwind-table entry. Perhaps something similar can be done with |
| 105 | + DWARF2 unwind info. */ |
| 106 | + |
| 107 | static inline int |
| 108 | get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, |
| 109 | int *countp) |
| 110 | diff --git a/src/hppa/Ginit.c b/src/hppa/Ginit.c |
| 111 | index 461e4b9..265455a 100644 |
| 112 | --- a/src/hppa/Ginit.c |
| 113 | +++ b/src/hppa/Ginit.c |
| 114 | @@ -64,13 +64,6 @@ _Uhppa_uc_addr (ucontext_t *uc, int reg) |
| 115 | |
| 116 | # endif /* UNW_LOCAL_ONLY */ |
| 117 | |
| 118 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 119 | - |
| 120 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 121 | - by a remote unwinder. On ia64, this is done via a special |
| 122 | - unwind-table entry. Perhaps something similar can be done with |
| 123 | - DWARF2 unwind info. */ |
| 124 | - |
| 125 | static void |
| 126 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 127 | { |
| 128 | @@ -81,7 +74,13 @@ static int |
| 129 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 130 | void *arg) |
| 131 | { |
| 132 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 133 | +#ifndef UNW_LOCAL_ONLY |
| 134 | +# pragma weak _U_dyn_info_list_addr |
| 135 | + if (!_U_dyn_info_list_addr) |
| 136 | + return -UNW_ENOINFO; |
| 137 | +#endif |
| 138 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 139 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 140 | return 0; |
| 141 | } |
| 142 | |
| 143 | diff --git a/src/ia64/Ginit.c b/src/ia64/Ginit.c |
| 144 | index b09a2ad..8601bb3 100644 |
| 145 | --- a/src/ia64/Ginit.c |
| 146 | +++ b/src/ia64/Ginit.c |
| 147 | @@ -68,6 +68,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 148 | if (!_U_dyn_info_list_addr) |
| 149 | return -UNW_ENOINFO; |
| 150 | #endif |
| 151 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 152 | *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 153 | return 0; |
| 154 | } |
| 155 | diff --git a/src/mi/Gfind_dynamic_proc_info.c b/src/mi/Gfind_dynamic_proc_info.c |
| 156 | index 98d3501..2e7c62e 100644 |
| 157 | --- a/src/mi/Gfind_dynamic_proc_info.c |
| 158 | +++ b/src/mi/Gfind_dynamic_proc_info.c |
| 159 | @@ -49,6 +49,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, |
| 160 | return -UNW_ENOINFO; |
| 161 | #endif |
| 162 | |
| 163 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 164 | list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr (); |
| 165 | for (di = list->first; di; di = di->next) |
| 166 | if (ip >= di->start_ip && ip < di->end_ip) |
| 167 | diff --git a/src/mips/Ginit.c b/src/mips/Ginit.c |
| 168 | index 3df170c..bf7a8f5 100644 |
| 169 | --- a/src/mips/Ginit.c |
| 170 | +++ b/src/mips/Ginit.c |
| 171 | @@ -69,13 +69,6 @@ tdep_uc_addr (ucontext_t *uc, int reg) |
| 172 | |
| 173 | # endif /* UNW_LOCAL_ONLY */ |
| 174 | |
| 175 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 176 | - |
| 177 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 178 | - by a remote unwinder. On ia64, this is done via a special |
| 179 | - unwind-table entry. Perhaps something similar can be done with |
| 180 | - DWARF2 unwind info. */ |
| 181 | - |
| 182 | static void |
| 183 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 184 | { |
| 185 | @@ -86,7 +79,13 @@ static int |
| 186 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 187 | void *arg) |
| 188 | { |
| 189 | - *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list; |
| 190 | +#ifndef UNW_LOCAL_ONLY |
| 191 | +# pragma weak _U_dyn_info_list_addr |
| 192 | + if (!_U_dyn_info_list_addr) |
| 193 | + return -UNW_ENOINFO; |
| 194 | +#endif |
| 195 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 196 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 197 | return 0; |
| 198 | } |
| 199 | |
| 200 | diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c |
| 201 | index c5312d9..f8d6886 100644 |
| 202 | --- a/src/ppc32/Ginit.c |
| 203 | +++ b/src/ppc32/Ginit.c |
| 204 | @@ -91,9 +91,6 @@ tdep_uc_addr (ucontext_t *uc, int reg) |
| 205 | |
| 206 | # endif /* UNW_LOCAL_ONLY */ |
| 207 | |
| 208 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 209 | - |
| 210 | - |
| 211 | static void |
| 212 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 213 | { |
| 214 | @@ -104,7 +101,13 @@ static int |
| 215 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 216 | void *arg) |
| 217 | { |
| 218 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 219 | +#ifndef UNW_LOCAL_ONLY |
| 220 | +# pragma weak _U_dyn_info_list_addr |
| 221 | + if (!_U_dyn_info_list_addr) |
| 222 | + return -UNW_ENOINFO; |
| 223 | +#endif |
| 224 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 225 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 226 | return 0; |
| 227 | } |
| 228 | |
| 229 | diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c |
| 230 | index 4c88cd6..7bfb395 100644 |
| 231 | --- a/src/ppc64/Ginit.c |
| 232 | +++ b/src/ppc64/Ginit.c |
| 233 | @@ -95,9 +95,6 @@ tdep_uc_addr (ucontext_t *uc, int reg) |
| 234 | |
| 235 | # endif /* UNW_LOCAL_ONLY */ |
| 236 | |
| 237 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 238 | - |
| 239 | - |
| 240 | static void |
| 241 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 242 | { |
| 243 | @@ -108,7 +105,13 @@ static int |
| 244 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 245 | void *arg) |
| 246 | { |
| 247 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 248 | +#ifndef UNW_LOCAL_ONLY |
| 249 | +# pragma weak _U_dyn_info_list_addr |
| 250 | + if (!_U_dyn_info_list_addr) |
| 251 | + return -UNW_ENOINFO; |
| 252 | +#endif |
| 253 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 254 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 255 | return 0; |
| 256 | } |
| 257 | |
| 258 | diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/ptrace/_UPT_get_dyn_info_list_addr.c |
| 259 | index cc5ed04..16671d4 100644 |
| 260 | --- a/src/ptrace/_UPT_get_dyn_info_list_addr.c |
| 261 | +++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c |
| 262 | @@ -71,6 +71,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, |
| 263 | |
| 264 | #else |
| 265 | |
| 266 | +/* XXX fix me: there is currently no way to locate the dyn-info list |
| 267 | + by a remote unwinder. On ia64, this is done via a special |
| 268 | + unwind-table entry. Perhaps something similar can be done with |
| 269 | + DWARF2 unwind info. */ |
| 270 | + |
| 271 | static inline int |
| 272 | get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, |
| 273 | int *countp) |
| 274 | diff --git a/src/s390x/Ginit.c b/src/s390x/Ginit.c |
| 275 | index f0886ac..db01743 100644 |
| 276 | --- a/src/s390x/Ginit.c |
| 277 | +++ b/src/s390x/Ginit.c |
| 278 | @@ -50,8 +50,6 @@ static struct unw_addr_space local_addr_space; |
| 279 | |
| 280 | unw_addr_space_t unw_local_addr_space = &local_addr_space; |
| 281 | |
| 282 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 283 | - |
| 284 | static inline void * |
| 285 | uc_addr (ucontext_t *uc, int reg) |
| 286 | { |
| 287 | @@ -75,11 +73,6 @@ tdep_uc_addr (ucontext_t *uc, int reg) |
| 288 | |
| 289 | # endif /* UNW_LOCAL_ONLY */ |
| 290 | |
| 291 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 292 | - by a remote unwinder. On ia64, this is done via a special |
| 293 | - unwind-table entry. Perhaps something similar can be done with |
| 294 | - DWARF2 unwind info. */ |
| 295 | - |
| 296 | static void |
| 297 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 298 | { |
| 299 | @@ -90,7 +83,13 @@ static int |
| 300 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 301 | void *arg) |
| 302 | { |
| 303 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 304 | +#ifndef UNW_LOCAL_ONLY |
| 305 | +# pragma weak _U_dyn_info_list_addr |
| 306 | + if (!_U_dyn_info_list_addr) |
| 307 | + return -UNW_ENOINFO; |
| 308 | +#endif |
| 309 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 310 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 311 | return 0; |
| 312 | } |
| 313 | |
| 314 | diff --git a/src/sh/Ginit.c b/src/sh/Ginit.c |
| 315 | index 52988a7..9fe96d2 100644 |
| 316 | --- a/src/sh/Ginit.c |
| 317 | +++ b/src/sh/Ginit.c |
| 318 | @@ -58,13 +58,6 @@ tdep_uc_addr (ucontext_t *uc, int reg) |
| 319 | |
| 320 | # endif /* UNW_LOCAL_ONLY */ |
| 321 | |
| 322 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 323 | - |
| 324 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 325 | - by a remote unwinder. On ia64, this is done via a special |
| 326 | - unwind-table entry. Perhaps something similar can be done with |
| 327 | - DWARF2 unwind info. */ |
| 328 | - |
| 329 | static void |
| 330 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 331 | { |
| 332 | @@ -75,7 +68,13 @@ static int |
| 333 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 334 | void *arg) |
| 335 | { |
| 336 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 337 | +#ifndef UNW_LOCAL_ONLY |
| 338 | +# pragma weak _U_dyn_info_list_addr |
| 339 | + if (!_U_dyn_info_list_addr) |
| 340 | + return -UNW_ENOINFO; |
| 341 | +#endif |
| 342 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 343 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 344 | return 0; |
| 345 | } |
| 346 | |
| 347 | diff --git a/src/tilegx/Ginit.c b/src/tilegx/Ginit.c |
| 348 | index 7564a55..925e641 100644 |
| 349 | --- a/src/tilegx/Ginit.c |
| 350 | +++ b/src/tilegx/Ginit.c |
| 351 | @@ -64,13 +64,6 @@ tdep_uc_addr (ucontext_t *uc, int reg) |
| 352 | |
| 353 | # endif /* UNW_LOCAL_ONLY */ |
| 354 | |
| 355 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 356 | - |
| 357 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 358 | - by a remote unwinder. On ia64, this is done via a special |
| 359 | - unwind-table entry. Perhaps something similar can be done with |
| 360 | - DWARF2 unwind info. */ |
| 361 | - |
| 362 | static void |
| 363 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 364 | { |
| 365 | @@ -81,7 +74,13 @@ static int |
| 366 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 367 | void *arg) |
| 368 | { |
| 369 | - *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list; |
| 370 | +#ifndef UNW_LOCAL_ONLY |
| 371 | +# pragma weak _U_dyn_info_list_addr |
| 372 | + if (!_U_dyn_info_list_addr) |
| 373 | + return -UNW_ENOINFO; |
| 374 | +#endif |
| 375 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 376 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 377 | return 0; |
| 378 | } |
| 379 | |
| 380 | diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c |
| 381 | index f6b8dc2..3cec74a 100644 |
| 382 | --- a/src/x86/Ginit.c |
| 383 | +++ b/src/x86/Ginit.c |
| 384 | @@ -54,13 +54,6 @@ tdep_uc_addr (ucontext_t *uc, int reg) |
| 385 | |
| 386 | # endif /* UNW_LOCAL_ONLY */ |
| 387 | |
| 388 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 389 | - |
| 390 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 391 | - by a remote unwinder. On ia64, this is done via a special |
| 392 | - unwind-table entry. Perhaps something similar can be done with |
| 393 | - DWARF2 unwind info. */ |
| 394 | - |
| 395 | static void |
| 396 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 397 | { |
| 398 | @@ -71,7 +64,13 @@ static int |
| 399 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 400 | void *arg) |
| 401 | { |
| 402 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 403 | +#ifndef UNW_LOCAL_ONLY |
| 404 | +# pragma weak _U_dyn_info_list_addr |
| 405 | + if (!_U_dyn_info_list_addr) |
| 406 | + return -UNW_ENOINFO; |
| 407 | +#endif |
| 408 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 409 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 410 | return 0; |
| 411 | } |
| 412 | |
| 413 | diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c |
| 414 | index 6161da6..5c4e426 100644 |
| 415 | --- a/src/x86_64/Ginit.c |
| 416 | +++ b/src/x86_64/Ginit.c |
| 417 | @@ -49,13 +49,6 @@ static struct unw_addr_space local_addr_space; |
| 418 | |
| 419 | unw_addr_space_t unw_local_addr_space = &local_addr_space; |
| 420 | |
| 421 | -HIDDEN unw_dyn_info_list_t _U_dyn_info_list; |
| 422 | - |
| 423 | -/* XXX fix me: there is currently no way to locate the dyn-info list |
| 424 | - by a remote unwinder. On ia64, this is done via a special |
| 425 | - unwind-table entry. Perhaps something similar can be done with |
| 426 | - DWARF2 unwind info. */ |
| 427 | - |
| 428 | static void |
| 429 | put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) |
| 430 | { |
| 431 | @@ -66,7 +59,13 @@ static int |
| 432 | get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, |
| 433 | void *arg) |
| 434 | { |
| 435 | - *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; |
| 436 | +#ifndef UNW_LOCAL_ONLY |
| 437 | +# pragma weak _U_dyn_info_list_addr |
| 438 | + if (!_U_dyn_info_list_addr) |
| 439 | + return -UNW_ENOINFO; |
| 440 | +#endif |
| 441 | + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. |
| 442 | + *dyn_info_list_addr = _U_dyn_info_list_addr (); |
| 443 | return 0; |
| 444 | } |
| 445 | |
| 446 | -- |
| 447 | 2.28.0 |
| 448 | |