tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[PATCH] Align libexecinfo unwind.h types to the same clang/gcc header
Update the types and function prototypes used in libexecinfo's unwind.h
to match the more commonly used variants found in clang and gcc. This
fixes compatibility problems with C++ programs where type mismatches
are errors, and upstreams assume the more common prototypes. This is
needed to fix compiler-rt and libc++abi builds while not causing any
issues with libexecinfo or other components of src.
This should not cause ABI breakage.
More specifically:
- make _Unwind_Ptr a uintptr_t rather than a real pointer
- ensure that _Unwind_Word is always word length
- switch _Unwind_Reason_Code and _Unwind_Action to enums
- switch _Unwind_GetIP(), _Unwind_GetIPInfo() and _Unwind_SetIP()
to use _Unwind_Word instead of _Unwind_Ptr
- switch _Unwind_GetLanguageSpecificData() return void * instead of
_Unwind_Ptr
- switch _Unwind_SetGR() to use _Unwind_Word, therefore making it
consistent with _Unwind_GetGR()
---
lib/libexecinfo/unwind.h | 52 +++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/lib/libexecinfo/unwind.h b/lib/libexecinfo/unwind.h
index 044ecdff29b4..dc99cd38f194 100644
--- a/lib/libexecinfo/unwind.h
+++ b/lib/libexecinfo/unwind.h
@@ -34,26 +34,28 @@
__BEGIN_DECLS
struct _Unwind_Context;
struct _Unwind_Exception;
-typedef int _Unwind_Reason_Code;
-typedef int _Unwind_Action;
-typedef void *_Unwind_Ptr;
-typedef long _Unwind_Word;
-
-#define _UA_SEARCH_PHASE 0x01
-#define _UA_CLEANUP_PHASE 0x02
-#define _UA_HANDLER_FRAME 0x04
-#define _UA_FORCE_UNWIND 0x08
-#define _UA_END_OF_STACK 0x10
-
-#define _URC_NO_REASON 0
-#define _URC_FOREIGN_EXCEPTION_CAUGHT 1
-#define _URC_FATAL_PHASE2_ERROR 2
-#define _URC_FATAL_PHASE1_ERROR 3
-#define _URC_NORMAL_STOP 4
-#define _URC_END_OF_STACK 5
-#define _URC_HANDLER_FOUND 6
-#define _URC_INSTALL_CONTEXT 7
-#define _URC_CONTINUE_UNWIND 8
+typedef uintptr_t _Unwind_Ptr;
+typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
+typedef enum {
+ _URC_NO_REASON = 0,
+ _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+ _URC_FATAL_PHASE2_ERROR = 2,
+ _URC_FATAL_PHASE1_ERROR = 3,
+ _URC_NORMAL_STOP = 4,
+ _URC_END_OF_STACK = 5,
+ _URC_HANDLER_FOUND = 6,
+ _URC_INSTALL_CONTEXT = 7,
+ _URC_CONTINUE_UNWIND = 8,
+ _URC_MAXTYPE = 0x7fffffff
+} _Unwind_Reason_Code;
+typedef enum {
+ _UA_SEARCH_PHASE = 0x01,
+ _UA_CLEANUP_PHASE = 0x02,
+ _UA_HANDLER_FRAME = 0x04,
+ _UA_FORCE_UNWIND = 0x08,
+ _UA_END_OF_STACK = 0x10,
+ _UA_MAXTYPE = 0x7fffffff
+} _Unwind_Action;
struct _Unwind_Exception {
uint64_t exception_class;
@@ -80,9 +82,9 @@ _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *,
_Unwind_Word _Unwind_GetCFA(struct _Unwind_Context *);
_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *);
_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *, int);
-_Unwind_Ptr _Unwind_GetIP(struct _Unwind_Context *);
-_Unwind_Ptr _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
-_Unwind_Ptr _Unwind_GetLanguageSpecificData(
+_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *);
+_Unwind_Word _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
+void *_Unwind_GetLanguageSpecificData(
struct _Unwind_Context *);
_Unwind_Ptr _Unwind_GetRegionStart(struct _Unwind_Context *);
_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
@@ -90,7 +92,7 @@ _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *);
void _Unwind_Resume(struct _Unwind_Exception *);
_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *);
void _Unwind_SetGR(struct _Unwind_Context *, int,
- _Unwind_Ptr);
-void _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Ptr);
+ _Unwind_Word);
+void _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Word);
__END_DECLS
#endif /* _UNWIND_H_ */
--
2.24.1
Home |
Main Index |
Thread Index |
Old Index