<div dir="ltr"><div><div><div>Hi Saleem,<br><br>Similar change has been committed and reverted (see r219629 and r226818.)<br><br></div>This change WILL BREAK the libc++abi + libgcc build. With this change, the libc++abi shared library will come with undefined references to _Unwind_{Get,Set}{IP,GR}, which are not available in libgcc.<br><br></div>AFAICT, these functions are not a part of public interface of ARM EHABI. The only documented public interface is _Unwind_VRS_Get/_Unwind_VRS_Set. Even though, most existing implementations, including the unwind.h shipped with gcc and clang, define these inline functions. But none of them will lead to an external reference to _Unwind_{Get,Set}{IP,GR}.<br><br></div><div>Would you mind to revert this change? Or, is there any other situation, which requires this change, that I haven't considered? Thanks.<br><br></div><div>Sincerely,<br></div><div>Logan<br></div><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 12, 2015 at 12:25 PM, Saleem Abdulrasool <span dir="ltr"><<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: compnerd<br>
Date: Wed Feb 11 22:25:03 2015<br>
New Revision: 228903<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=228903&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=228903&view=rev</a><br>
Log:<br>
unwind: move exported APIs out of header<br>
<br>
Ideally, we would do something like inline __declspec(dllexport) to ensure that<br>
the symbol was inlined within libunwind as well as emitted into the final DSO.<br>
This simply moves the definition out of the header to ensure that the *public*<br>
interfaces are defined and exported into the final DSO.<br>
<br>
This change also has "gratuitous" code movement so that the EHABI and generic<br>
implementations are co-located making it easier to find them.<br>
<br>
The movement from the header has one minor change introduced into the code:<br>
additional tracing to mirror the behaviour of the non-EHABI interfaces.<br>
<br>
Modified:<br>
libcxxabi/trunk/include/unwind.h<br>
libcxxabi/trunk/src/Unwind/UnwindLevel1.c<br>
<br>
Modified: libcxxabi/trunk/include/unwind.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/unwind.h?rev=228903&r1=228902&r2=228903&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/unwind.h?rev=228903&r1=228902&r2=228903&view=diff</a><br>
==============================================================================<br>
--- libcxxabi/trunk/include/unwind.h (original)<br>
+++ libcxxabi/trunk/include/unwind.h Wed Feb 11 22:25:03 2015<br>
@@ -202,37 +202,13 @@ extern _Unwind_VRS_Result<br>
_Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,<br>
uint32_t discriminator,<br>
_Unwind_VRS_DataRepresentation representation);<br>
+#endif<br>
<br>
-static inline uintptr_t _Unwind_GetGR(struct _Unwind_Context* context,<br>
- int index) {<br>
- uintptr_t value = 0;<br>
- _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);<br>
- return value;<br>
-}<br>
-<br>
-static inline void _Unwind_SetGR(struct _Unwind_Context* context, int index,<br>
- uintptr_t new_value) {<br>
- _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index,<br>
- _UVRSD_UINT32, &new_value);<br>
-}<br>
-<br>
-static inline uintptr_t _Unwind_GetIP(struct _Unwind_Context* context) {<br>
- // remove the thumb-bit before returning<br>
- return (_Unwind_GetGR(context, 15) & (~(uintptr_t)0x1));<br>
-}<br>
-<br>
-static inline void _Unwind_SetIP(struct _Unwind_Context* context,<br>
- uintptr_t new_value) {<br>
- uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1);<br>
- _Unwind_SetGR(context, 15, new_value | thumb_bit);<br>
-}<br>
-#else<br>
extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index);<br>
extern void _Unwind_SetGR(struct _Unwind_Context *context, int index,<br>
uintptr_t new_value);<br>
extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context);<br>
extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value);<br>
-#endif<br>
<br>
extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);<br>
extern uintptr_t<br>
<br>
Modified: libcxxabi/trunk/src/Unwind/UnwindLevel1.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindLevel1.c?rev=228903&r1=228902&r2=228903&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindLevel1.c?rev=228903&r1=228902&r2=228903&view=diff</a><br>
==============================================================================<br>
--- libcxxabi/trunk/src/Unwind/UnwindLevel1.c (original)<br>
+++ libcxxabi/trunk/src/Unwind/UnwindLevel1.c Wed Feb 11 22:25:03 2015<br>
@@ -422,10 +422,73 @@ _Unwind_GetLanguageSpecificData(struct _<br>
}<br>
<br>
<br>
+/// Called by personality handler during phase 2 to find the start of the<br>
+/// function.<br>
+_LIBUNWIND_EXPORT uintptr_t<br>
+_Unwind_GetRegionStart(struct _Unwind_Context *context) {<br>
+ unw_cursor_t *cursor = (unw_cursor_t *)context;<br>
+ unw_proc_info_t frameInfo;<br>
+ uintptr_t result = 0;<br>
+ if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)<br>
+ result = (uintptr_t)frameInfo.start_ip;<br>
+ _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%" PRIxPTR "\n",<br>
+ (void *)context, result);<br>
+ return result;<br>
+}<br>
+<br>
+<br>
+/// Called by personality handler during phase 2 if a foreign exception<br>
+// is caught.<br>
+_LIBUNWIND_EXPORT void<br>
+_Unwind_DeleteException(_Unwind_Exception *exception_object) {<br>
+ _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n",<br>
+ (void *)exception_object);<br>
+ if (exception_object->exception_cleanup != NULL)<br>
+ (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,<br>
+ exception_object);<br>
+}<br>
+<br>
+#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS && !LIBCXXABI_ARM_EHABI<br>
+<br>
+#if LIBCXXABI_ARM_EHABI<br>
+<br>
+_LIBUNWIND_EXPORT uintptr_t<br>
+_Unwind_GetGR(struct _Unwind_Context *context, int index) {<br>
+ uintptr_t value = 0;<br>
+ _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);<br>
+ _LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d) => 0x%" PRIx64 "\n",<br>
+ (void *)context, index, (uint64_t)value);<br>
+ return value;<br>
+}<br>
+<br>
+_LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index,<br>
+ uintptr_t value) {<br>
+ _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0"PRIx64")\n",<br>
+ (void *)context, index, (uint64_t)value);<br>
+ _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);<br>
+}<br>
+<br>
+_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {<br>
+ // remove the thumb-bit before returning<br>
+ uintptr_t value = _Unwind_GetGR(context, 15) & (~(uintptr_t)0x1);<br>
+ _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIx64 "\n",<br>
+ (void *)context, (uint64_t)value);<br>
+ return value;<br>
+}<br>
+<br>
+_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,<br>
+ uintptr_t value) {<br>
+ _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0" PRIx64 ")\n",<br>
+ (void *)context, (uint64_t)value);<br>
+ uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1);<br>
+ _Unwind_SetGR(context, 15, value | thumb_bit);<br>
+}<br>
+<br>
+#else<br>
<br>
/// Called by personality handler during phase 2 to get register values.<br>
-_LIBUNWIND_EXPORT uintptr_t _Unwind_GetGR(struct _Unwind_Context *context,<br>
- int index) {<br>
+_LIBUNWIND_EXPORT uintptr_t<br>
+_Unwind_GetGR(struct _Unwind_Context *context, int index) {<br>
unw_cursor_t *cursor = (unw_cursor_t *)context;<br>
unw_word_t result;<br>
unw_get_reg(cursor, index, &result);<br>
@@ -434,20 +497,16 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetG<br>
return (uintptr_t)result;<br>
}<br>
<br>
-<br>
-<br>
/// Called by personality handler during phase 2 to alter register values.<br>
_LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index,<br>
- uintptr_t new_value) {<br>
+ uintptr_t value) {<br>
_LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0" PRIx64<br>
")\n",<br>
- (void *)context, index, (uint64_t)new_value);<br>
+ (void *)context, index, (uint64_t)value);<br>
unw_cursor_t *cursor = (unw_cursor_t *)context;<br>
- unw_set_reg(cursor, index, new_value);<br>
+ unw_set_reg(cursor, index, value);<br>
}<br>
<br>
-<br>
-<br>
/// Called by personality handler during phase 2 to get instruction pointer.<br>
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {<br>
unw_cursor_t *cursor = (unw_cursor_t *)context;<br>
@@ -458,44 +517,16 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetI<br>
return (uintptr_t)result;<br>
}<br>
<br>
-<br>
-<br>
/// Called by personality handler during phase 2 to alter instruction pointer,<br>
/// such as setting where the landing pad is, so _Unwind_Resume() will<br>
/// start executing in the landing pad.<br>
_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,<br>
- uintptr_t new_value) {<br>
+ uintptr_t value) {<br>
_LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0" PRIx64 ")\n",<br>
- (void *)context, (uint64_t)new_value);<br>
+ (void *)context, (uint64_t)value);<br>
unw_cursor_t *cursor = (unw_cursor_t *)context;<br>
- unw_set_reg(cursor, UNW_REG_IP, new_value);<br>
+ unw_set_reg(cursor, UNW_REG_IP, value);<br>
}<br>
<br>
+#endif<br>
<br>
-/// Called by personality handler during phase 2 to find the start of the<br>
-/// function.<br>
-_LIBUNWIND_EXPORT uintptr_t<br>
-_Unwind_GetRegionStart(struct _Unwind_Context *context) {<br>
- unw_cursor_t *cursor = (unw_cursor_t *)context;<br>
- unw_proc_info_t frameInfo;<br>
- uintptr_t result = 0;<br>
- if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)<br>
- result = (uintptr_t)frameInfo.start_ip;<br>
- _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%" PRIxPTR "\n",<br>
- (void *)context, result);<br>
- return result;<br>
-}<br>
-<br>
-<br>
-/// Called by personality handler during phase 2 if a foreign exception<br>
-// is caught.<br>
-_LIBUNWIND_EXPORT void<br>
-_Unwind_DeleteException(_Unwind_Exception *exception_object) {<br>
- _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n",<br>
- (void *)exception_object);<br>
- if (exception_object->exception_cleanup != NULL)<br>
- (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,<br>
- exception_object);<br>
-}<br>
-<br>
-#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS && !LIBCXXABI_ARM_EHABI<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>