Skip to content

Commit 4e008ab

Browse files
kateinoigakukunAnka
authored andcommitted
[wasm][stdlib] Fix return-address strategy selection
__GNUC__ can be defined on Wasm targets as well, so we need to check __wasm__ first.
1 parent 208627c commit 4e008ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/public/runtime/Exclusivity.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
#include <memory>
3838

3939
// Pick a return-address strategy
40-
#if __GNUC__
40+
#if defined(__wasm__)
41+
// Wasm can't access call frame for security purposes
42+
#define get_return_address() ((void*) 0)
43+
#elif __GNUC__
4144
#define get_return_address() __builtin_return_address(0)
4245
#elif _MSC_VER
4346
#include <intrin.h>
4447
#define get_return_address() _ReturnAddress()
45-
#elif defined(__wasm__)
46-
// Wasm can't access call frame for security purposes
47-
#define get_return_address() ((void*) 0)
4848
#else
4949
#error missing implementation for get_return_address
5050
#define get_return_address() ((void*) 0)

0 commit comments

Comments
 (0)