[PATCH] D11190: unwind: Fix libc++abi and libgcc build.
Logan Chien
tzuhsiang.chien at gmail.com
Tue Jul 14 17:40:11 PDT 2015
logan added inline comments.
================
Comment at: include/unwind.h:224
@@ +223,3 @@
+
+static __inline__ uintptr_t _Unwind_GetGR(struct _Unwind_Context *context,
+ int index) {
----------------
asl wrote:
> Why can't we simply make them static functions of UnwindLevel1.c for EHABI case?
They can't be //static// functions of UnwindLevel1.c because they will be called from the other source code (e.g. libc++abi calls these functions.) If they are declared as static functions in UnwindLevel1.c, then the other source code can't access these functions.
We can't declare these functions as extern and define these functions in UnwindLevel1.c either. If we do so, the source code including this header and using these functions will be compiled to object files with external symbols (undefined references) to these functions. This means that these symbols should be available to the linkers. However, libgcc does not provide these symbols. If we are building libc++abi with libgcc without libunwinder, then we will encounter the following link error:
libcxxabi/src/cxa_personality.cpp:(.text+0x3c): undefined reference to `_Unwind_SetGR'
(... and etc ...)
This is the reason why these functions must be inlined. AFAICT, both the unwind.h from gcc or clang (`lib/Header/unwind.h`) are following the same practice.
http://reviews.llvm.org/D11190
More information about the cfe-commits
mailing list