Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 5f0c79f

Browse files
committed
builtins: avoid duplicating unwind declarations
Use unwind.h to get the declarations for unwinding interfaces. This header is already provided by clang and gcc, so this adds no additional dependencies for building the builtins library. It avoids the duplication which may drift over time though. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225990 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ebd1d5b commit 5f0c79f

File tree

3 files changed

+12
-44
lines changed

3 files changed

+12
-44
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ pythonize_bool(COMPILER_RT_DEBUG)
203203
#================================
204204
# Setup Compiler Flags
205205
#================================
206+
include(CheckIncludeFile)
207+
check_include_file(unwind.h HAVE_UNWIND_H)
208+
206209
include(config-ix)
207210

208211
if(MSVC)

lib/builtins/CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ set(GENERIC_SOURCES
7979
floatuntidf.c
8080
floatuntisf.c
8181
floatuntixf.c
82-
gcc_personality_v0.c
8382
int_util.c
8483
lshrdi3.c
8584
lshrti3.c
@@ -137,6 +136,12 @@ set(GENERIC_SOURCES
137136
umodsi3.c
138137
umodti3.c)
139138

139+
if (HAVE_UNWIND_H)
140+
set(GENERIC_SOURCES
141+
${GENERIC_SOURCES}
142+
gcc_personality_v0.c)
143+
endif ()
144+
140145
set(x86_64_SOURCES
141146
x86_64/floatdidf.c
142147
x86_64/floatdisf.c

lib/builtins/gcc_personality_v0.c

+3-43
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,7 @@
1111

1212
#include "int_lib.h"
1313

14-
/*
15-
* _Unwind_* stuff based on C++ ABI public documentation
16-
* http://refspecs.freestandards.org/abi-eh-1.21.html
17-
*/
18-
19-
typedef enum {
20-
_URC_NO_REASON = 0,
21-
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
22-
_URC_FATAL_PHASE2_ERROR = 2,
23-
_URC_FATAL_PHASE1_ERROR = 3,
24-
_URC_NORMAL_STOP = 4,
25-
_URC_END_OF_STACK = 5,
26-
_URC_HANDLER_FOUND = 6,
27-
_URC_INSTALL_CONTEXT = 7,
28-
_URC_CONTINUE_UNWIND = 8
29-
} _Unwind_Reason_Code;
30-
31-
typedef enum {
32-
_UA_SEARCH_PHASE = 1,
33-
_UA_CLEANUP_PHASE = 2,
34-
_UA_HANDLER_FRAME = 4,
35-
_UA_FORCE_UNWIND = 8,
36-
_UA_END_OF_STACK = 16
37-
} _Unwind_Action;
38-
39-
typedef struct _Unwind_Context* _Unwind_Context_t;
40-
41-
struct _Unwind_Exception {
42-
uint64_t exception_class;
43-
void (*exception_cleanup)(_Unwind_Reason_Code reason,
44-
struct _Unwind_Exception* exc);
45-
uintptr_t private_1;
46-
uintptr_t private_2;
47-
};
48-
49-
COMPILER_RT_ABI const uint8_t* _Unwind_GetLanguageSpecificData(_Unwind_Context_t c);
50-
COMPILER_RT_ABI void _Unwind_SetGR(_Unwind_Context_t c, int i, uintptr_t n);
51-
COMPILER_RT_ABI void _Unwind_SetIP(_Unwind_Context_t, uintptr_t new_value);
52-
COMPILER_RT_ABI uintptr_t _Unwind_GetIP(_Unwind_Context_t context);
53-
COMPILER_RT_ABI uintptr_t _Unwind_GetRegionStart(_Unwind_Context_t context);
54-
14+
#include <unwind.h>
5515

5616
/*
5717
* Pointer encodings documented at:
@@ -185,12 +145,12 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding)
185145
COMPILER_RT_ABI _Unwind_Reason_Code
186146
__gcc_personality_sj0(int version, _Unwind_Action actions,
187147
uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject,
188-
_Unwind_Context_t context)
148+
struct _Unwind_Context *context)
189149
#else
190150
COMPILER_RT_ABI _Unwind_Reason_Code
191151
__gcc_personality_v0(int version, _Unwind_Action actions,
192152
uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject,
193-
_Unwind_Context_t context)
153+
struct _Unwind_Context *context)
194154
#endif
195155
{
196156
/* Since C does not have catch clauses, there is nothing to do during */

0 commit comments

Comments
 (0)