Skip to content

[libunwind] Add Unwind-wasm.c to CMakeLists.txt #67770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 2, 2023

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Sep 29, 2023

This was missing when the file was added in 058222b.

Also reordered some headers to make LLVM CI and clang-format happy.

This was missing when the file was added.
@aheejin aheejin requested a review from ldionne September 29, 2023 06:47
@aheejin aheejin requested a review from a team as a code owner September 29, 2023 06:47
@llvmbot
Copy link
Member

llvmbot commented Sep 29, 2023

@llvm/pr-subscribers-libunwind

Changes

This was missing when the file was added.


Full diff: https://github.com/llvm/llvm-project/pull/67770.diff

2 Files Affected:

  • (modified) libunwind/src/CMakeLists.txt (+1)
  • (modified) libunwind/src/Unwind-wasm.c (+2-1)
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 452d988c3726b5e..abb019b88ebabd7 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -16,6 +16,7 @@ set(LIBUNWIND_C_SOURCES
     UnwindLevel1.c
     UnwindLevel1-gcc-ext.c
     Unwind-sjlj.c
+    Unwind-wasm.c
     )
 set_source_files_properties(${LIBUNWIND_C_SOURCES}
                             PROPERTIES
diff --git a/libunwind/src/Unwind-wasm.c b/libunwind/src/Unwind-wasm.c
index 35f2f9aeab08048..47c79b0d14d37b7 100644
--- a/libunwind/src/Unwind-wasm.c
+++ b/libunwind/src/Unwind-wasm.c
@@ -10,12 +10,13 @@
 //
 //===----------------------------------------------------------------------===//
 
+#ifdef __USING_WASM_EXCEPTIONS__
+
 #include "config.h"
 #include "unwind.h"
 #include <stdbool.h>
 #include <threads.h>
 
-#ifdef __USING_WASM_EXCEPTIONS__
 
 _Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
                                             uint64_t exceptionClass,

@github-actions
Copy link

github-actions bot commented Sep 29, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

@MaskRay
Copy link
Member

MaskRay commented Sep 29, 2023

This was missing when the file was added.

Please reference the commit 058222b

@aheejin
Copy link
Member Author

aheejin commented Sep 29, 2023

This was missing when the file was added.

Please reference the commit 058222b

Done.

aheejin added a commit to aheejin/emscripten that referenced this pull request Sep 29, 2023
Even though we don't use `CMakeLists.txt`, `Unwind-wasm.c` needs to be
included in the file to be a part of libunwind. Reflecting changes of
llvm/llvm-project#67770.
aheejin added a commit to aheejin/emscripten that referenced this pull request Oct 1, 2023
Even though we don't use `CMakeLists.txt`, `Unwind-wasm.c` needs to be
included in the file to be a part of libunwind. Reflecting changes of
llvm/llvm-project#67770.

The order of headers and inserted newlines are to satisfy LLVM CI and
clang-format.
- `stdbool.h` should be before `config.h` because otherwise `bool` is
  not defined. But there should be a newline between them because
  otherwise clang-format will reorder them alphabetically
- We need at least one header outside of `#ifdef
  __USING_WASM_EXCEPTIONS__` because LLVM CI complains there should be
  at least one declaration within a compilation unit, and `stdbool.h`
  doesn't have any, so we need another header outside
- `threads.h` doesn't exist in other platforms. (It's in musl) So it
  needs to be in `#ifdef __USING_WASM_EXCEPTIONS__`
@aheejin
Copy link
Member Author

aheejin commented Oct 2, 2023

Will merge this; the remaining CI failures don't seem to related.

@aheejin aheejin merged commit 8ebd226 into llvm:main Oct 2, 2023
@aheejin aheejin deleted the unwind_cmake branch October 2, 2023 20:47
aheejin added a commit to aheejin/emscripten that referenced this pull request Mar 25, 2024
Most of the changes seem irrelevant to us given that we only use
`Uniwnd-wasm.cpp`. Changes related to Wasm are what I submitted upstream
for adding the file to `CMakeLists.txt` and fixing some guards:
llvm/llvm-project#67770
llvm/llvm-project#73196
llvm/llvm-project#78230
aheejin added a commit to emscripten-core/emscripten that referenced this pull request Mar 26, 2024
Most of the changes seem irrelevant to us given that we only use
`Uniwnd-wasm.cpp`. Changes related to Wasm are what I submitted upstream
for adding the file to `CMakeLists.txt` and fixing some guards:
llvm/llvm-project#67770
llvm/llvm-project#73196
llvm/llvm-project#78230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants