diff options
author | Petr Hosek <phosek@chromium.org> | 2019-04-03 21:50:03 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-04-03 21:50:03 +0000 |
commit | e369a989fc37248f4aa05ab2d184270ac27b22e1 (patch) | |
tree | 79e13110c87b7abb3c6f072c20a3c1b56e5e2b36 /libunwind/src/Unwind-sjlj.c | |
parent | 306809f292c9dd26e1a901b139f65976cdd5a4b2 (diff) | |
download | bcm5719-llvm-e369a989fc37248f4aa05ab2d184270ac27b22e1.tar.gz bcm5719-llvm-e369a989fc37248f4aa05ab2d184270ac27b22e1.zip |
[libunwind] Export the unw_* symbols as weak symbols
libunwind defines the _Unwind_* ABI used by libc++abi. This ABI is a
stable quasi-standard common between multiple implementations such as
LLVM and GNU. The _U* symbol name space is also safely within the symbol
name space that standard C & C++ reserve for the implementation.
Futhermore, libunwind also defines several unw_* symbols, and references
these from the _Unwind_* entry points so the standard/reserved part of
the ABI is dependent on the unw_* part of the ABI. This is not OK for a
C or C++ implementation. The unw_* symbols are reserved for C and extern
"C" used by application code.
This change renames each unw_* function to __unw* and adds a weak alias
unw_* to keep the public <libunwind.h> ABI unchanged for backwards
compatibility. Every reference to unw_* in the implementation has been
changed to use __unw* so that if other unw_* definitions are in force
because nothing uses <libunwind.h> in a particular program, no _Unwind*
code path depends on any unw_* symbol. Furthemore, __unw_* symbols are
hidden, which saves PLT overhead in the shared library case.
In the future, we should cconsider untangling the unw_* API/ABI from the
_Unwind_* API/ABI. The internal API backing the _Unwind_* ABI
implementation should not rely on any nonstandard symbols not in the
implementation-reserved name space. This would then allow separating the
_Unwind_* API/ABI from unw_* entirely, but that's a more substantial
change that's going to require more significant refactoring.
Differential Revision: https://reviews.llvm.org/D59921
llvm-svn: 357640
Diffstat (limited to 'libunwind/src/Unwind-sjlj.c')
-rw-r--r-- | libunwind/src/Unwind-sjlj.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libunwind/src/Unwind-sjlj.c b/libunwind/src/Unwind-sjlj.c index 22041618631..b8bb7c83bdf 100644 --- a/libunwind/src/Unwind-sjlj.c +++ b/libunwind/src/Unwind-sjlj.c @@ -177,9 +177,10 @@ unwind_phase2(struct _Unwind_Exception *exception_object) { // check for no more frames if (c == NULL) { - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " - "bottom => _URC_END_OF_STACK", - (void *)exception_object); + _LIBUNWIND_TRACE_UNWINDING( + "unwind_phase2(ex_ojb=%p): __unw_step() reached " + "bottom => _URC_END_OF_STACK", + (void *)exception_object); return _URC_END_OF_STACK; } @@ -215,7 +216,7 @@ unwind_phase2(struct _Unwind_Exception *exception_object) { // we may get control back if landing pad calls _Unwind_Resume() __Unwind_SjLj_SetTopOfFunctionStack(c); __builtin_longjmp(c->jbuf, 1); - // unw_resume() only returns if there was an error + // __unw_resume() only returns if there was an error return _URC_FATAL_PHASE2_ERROR; default: // something went wrong @@ -242,9 +243,10 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object, // get next frame (skip over first which is _Unwind_RaiseException) if (c == NULL) { - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " - "bottom => _URC_END_OF_STACK", - (void *)exception_object); + _LIBUNWIND_TRACE_UNWINDING( + "unwind_phase2(ex_ojb=%p): __unw_step() reached " + "bottom => _URC_END_OF_STACK", + (void *)exception_object); return _URC_END_OF_STACK; } |