2022-06-10 20:26:10 +00:00
|
|
|
From c250eb29047c4341cdc1d13f3706eb6991cf0f9b Mon Sep 17 00:00:00 2001
|
2022-06-09 17:57:34 +00:00
|
|
|
From: Hood Chatham <roberthoodchatham@gmail.com>
|
|
|
|
Date: Thu, 6 Jan 2022 09:40:39 -0800
|
2022-06-10 20:26:10 +00:00
|
|
|
Subject: [PATCH 4/4] Disable whole-archive when linking rust
|
2022-06-09 17:57:34 +00:00
|
|
|
|
|
|
|
Rust .rlib archives contain an extra metadata file called lib.rmeta.
|
|
|
|
Emscripten sets `--whole-archive` by default if LINKABLE is set.
|
|
|
|
But with `--whole-archive` the linker crashes with an error due to
|
|
|
|
the extra files. This disables the problematic `--whole-archive`
|
|
|
|
setting when we are linking rust.
|
|
|
|
|
|
|
|
See emscripten issue:
|
|
|
|
https://github.com/emscripten-core/emscripten/issues/17109
|
|
|
|
---
|
|
|
|
tools/building.py | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/tools/building.py b/tools/building.py
|
2022-06-10 20:26:10 +00:00
|
|
|
index 24ddaa13f..cb015e18f 100644
|
2022-06-09 17:57:34 +00:00
|
|
|
--- a/tools/building.py
|
|
|
|
+++ b/tools/building.py
|
2022-06-10 20:26:10 +00:00
|
|
|
@@ -360,7 +360,7 @@ def link_lld(args, target, external_symbols=None):
|
2022-06-09 17:57:34 +00:00
|
|
|
|
|
|
|
# Emscripten currently expects linkable output (SIDE_MODULE/MAIN_MODULE) to
|
|
|
|
# include all archive contents.
|
|
|
|
- if settings.LINKABLE:
|
|
|
|
+ if settings.LINKABLE and not any(arg.endswith(".rlib") for arg in args):
|
|
|
|
args.insert(0, '--whole-archive')
|
|
|
|
args.append('--no-whole-archive')
|
|
|
|
|
|
|
|
--
|
|
|
|
2.25.1
|
|
|
|
|