[libcxx-commits] [PATCH] D59921: [libunwind] Export the unw_* symbols as weak symbols
Petr Hosek via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 28 00:47:13 PDT 2019
phosek created this revision.
phosek added reviewers: jroelofs, ldionne, EricWF, echristo.
Herald added subscribers: libcxx-commits, jdoerfert, christof.
phosek added a reviewer: mcgrathr.
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.
Furthermore, 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 consider 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 47258 bytes
Desc: not available
More information about the libcxx-commits