File tree Expand file tree Collapse file tree 4 files changed +47
-38
lines changed Expand file tree Collapse file tree 4 files changed +47
-38
lines changed Original file line number Diff line number Diff line change 180180#endif
181181#define _LIBUNWIND_HIGHEST_DWARF_REGISTER \
182182 _LIBUNWIND_HIGHEST_DWARF_REGISTER_LOONGARCH
183+ #elif defined(__wasm__ )
183184# else
184185# error "Unsupported architecture."
185186# endif
Original file line number Diff line number Diff line change 11# Get sources
22
3- set (LIBUNWIND_CXX_SOURCES
4- libunwind.cpp
5- Unwind-EHABI.cpp
6- Unwind-seh.cpp
7- )
3+ if ("${CMAKE_SYSTEM_PROCESSOR} " STREQUAL "wasm32" OR
4+ "${CMAKE_SYSTEM_PROCESSOR} " STREQUAL "wasm64" )
5+ set (LIBUNWIND_C_SOURCES
6+ Unwind-wasm.c
7+ )
8+ else ()
9+ set (LIBUNWIND_CXX_SOURCES
10+ libunwind.cpp
11+ Unwind-EHABI.cpp
12+ Unwind-seh.cpp
13+ )
14+
15+ if (${CMAKE_SYSTEM_NAME} MATCHES "AIX" )
16+ list (APPEND LIBUNWIND_CXX_SOURCES
17+ Unwind_AIXExtras.cpp
18+ )
19+ endif ()
820
9- if ( ${CMAKE_SYSTEM_NAME} MATCHES "AIX" )
10- list ( APPEND LIBUNWIND_CXX_SOURCES
11- Unwind_AIXExtras.cpp
12- )
13- endif ( )
21+ set (LIBUNWIND_C_SOURCES
22+ UnwindLevel1.c
23+ UnwindLevel1-gcc- ext .c
24+ Unwind-sjlj.c
25+ )
1426
15- set (LIBUNWIND_C_SOURCES
16- UnwindLevel1.c
17- UnwindLevel1-gcc-ext .c
18- Unwind-sjlj.c
19- Unwind-wasm.c
20- )
21- set_source_files_properties (${LIBUNWIND_C_SOURCES}
22- PROPERTIES
23- COMPILE_FLAGS "-std=c99" )
27+ set (LIBUNWIND_ASM_SOURCES
28+ UnwindRegistersRestore.S
29+ UnwindRegistersSave.S
30+ )
2431
25- set (LIBUNWIND_ASM_SOURCES
26- UnwindRegistersRestore.S
27- UnwindRegistersSave.S
28- )
32+ set_source_files_properties ( ${LIBUNWIND_C_SOURCES}
33+ PROPERTIES
34+ COMPILE_FLAGS "-std=c99" )
35+ endif ( )
2936
3037set (LIBUNWIND_HEADERS
3138 AddressSpace.hpp
Original file line number Diff line number Diff line change 1010//
1111//===----------------------------------------------------------------------===//
1212
13+ #if __STDC_VERSION__ < 202311L
1314#include <stdbool.h>
14-
15+ #endif
1516#include "config.h"
16-
17- #ifdef __USING_WASM_EXCEPTIONS__
18-
1917#include "unwind.h"
20- #include <threads.h>
2118
2219_Unwind_Reason_Code __gxx_personality_wasm0 (int version , _Unwind_Action actions ,
2320 uint64_t exceptionClass ,
@@ -35,7 +32,12 @@ struct _Unwind_LandingPadContext {
3532
3633// Communication channel between compiler-generated user code and personality
3734// function
38- thread_local struct _Unwind_LandingPadContext __wasm_lpad_context ;
35+ #if __STDC_VERSION__ >= 202311L
36+ thread_local
37+ #else
38+ _Thread_local
39+ #endif
40+ struct _Unwind_LandingPadContext __wasm_lpad_context ;
3941
4042/// Calls to this function is in landing pads in compiler-generated user code.
4143/// In other EH schemes, stack unwinding is done by libunwind library, which
@@ -119,5 +121,3 @@ _LIBUNWIND_EXPORT uintptr_t
119121_Unwind_GetRegionStart (struct _Unwind_Context * context ) {
120122 return 0 ;
121123}
122-
123- #endif // defined(__USING_WASM_EXCEPTIONS__)
Original file line number Diff line number Diff line change 6666 #define _LIBUNWIND_EXPORT
6767 #define _LIBUNWIND_HIDDEN
6868#else
69- #if !defined(__ELF__) && !defined(__MACH__) && !defined(_AIX)
70- #define _LIBUNWIND_EXPORT __declspec (dllexport)
71- #define _LIBUNWIND_HIDDEN
72- #else
73- #define _LIBUNWIND_EXPORT __attribute__ ((visibility(" default" )))
74- #define _LIBUNWIND_HIDDEN __attribute__ ((visibility(" hidden" )))
75- #endif
69+ #if !defined(__ELF__) && !defined(__MACH__) && !defined(_AIX) && \
70+ !defined (__wasm__)
71+ #define _LIBUNWIND_EXPORT __declspec (dllexport)
72+ #define _LIBUNWIND_HIDDEN
73+ #else
74+ #define _LIBUNWIND_EXPORT __attribute__ ((visibility(" default" )))
75+ #define _LIBUNWIND_HIDDEN __attribute__ ((visibility(" hidden" )))
76+ #endif
7677#endif
7778
7879#define STR (a ) #a
You can’t perform that action at this time.
0 commit comments