Skip to content

Commit 1c17665

Browse files
authored
Fix libc-wasi build failure when using clang (bytecodealliance#1950)
Resolves bytecodealliance#1949
1 parent fd487fb commit 1c17665

File tree

1 file changed

+11
-1
lines changed
  • core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src

1 file changed

+11
-1
lines changed

core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,17 @@
108108
#endif
109109

110110
#if !defined(BH_PLATFORM_LINUX_SGX)
111-
#if defined(__GNUC_PREREQ)
111+
/* Clang's __GNUC_PREREQ macro has a different meaning than GCC one,
112+
so we have to handle this case specially */
113+
#if defined(__clang__)
114+
/* Clang provides stdatomic.h since 3.6.0
115+
See https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html */
116+
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 6)
117+
#define CONFIG_HAS_STD_ATOMIC 1
118+
#else
119+
#define CONFIG_HAS_STD_ATOMIC 0
120+
#endif
121+
#elif defined(__GNUC_PREREQ)
112122
/* Even though older versions of GCC support C11, atomics were
113123
not implemented until 4.9. See
114124
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016 */

0 commit comments

Comments
 (0)