Skip to content

Commit fd0a998

Browse files
committed
Fix EM_JS macro in the face of recent llvm change
A recent change to llvm (llvm/llvm-project#81539) means that the `used` attribute on data forces the segment to be present in the output file, even if it's not used. The usage here in `em_js.h` was assuming that the data was not incldued in the final output. This change makes the symbol non-static instead of used, which is enough to force clang to keep the data around but not the linker (which is exactly the effect we want).
1 parent 34c83d8 commit fd0a998

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

system/include/emscripten/em_js.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#define _EM_JS(ret, c_name, js_name, params, code) \
6262
_EM_BEGIN_CDECL \
6363
ret c_name params EM_IMPORT(js_name); \
64-
__attribute__((used)) static void* __em_js_ref_##c_name = (void*)&c_name; \
64+
void* __em_js_ref_##c_name = (void*)&c_name; \
6565
EMSCRIPTEN_KEEPALIVE \
6666
__attribute__((section("em_js"), aligned(1))) char __em_js__##js_name[] = \
6767
#params "<::>" code; \

0 commit comments

Comments
 (0)