Skip to content

Commit 16c1bff

Browse files
committed
Prevent weak-node-api from being stripped when building with ferric
1 parent 39db494 commit 16c1bff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/ferric/src/cargo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ export function getTargetEnvironmentVariables({
219219
CARGO_ENCODED_RUSTFLAGS: [
220220
"-L",
221221
weakNodeApiPath,
222-
"-l",
223-
"weak-node-api",
222+
"-C",
223+
// Passing --no-as-needed to prevent weak-node-api from being optimized away
224+
"link-arg=-Wl,--push-state,--no-as-needed,-lweak-node-api,--pop-state",
224225
].join(String.fromCharCode(0x1f)),
225226
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence(
226227
toolchainBinPath,

0 commit comments

Comments
 (0)