2022-06-10 15:13:36 +00:00
|
|
|
From b4140512b840263ca2f44f0b639e67b0928db601 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
|
|
|
|
Subject: [PATCH 7/8] Disable whole-archive when linking rust
|
|
|
|
|
|
|
|
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 15:13:36 +00:00
|
|
|
index c69f9ec56..5de0b50ce 100644
|
2022-06-09 17:57:34 +00:00
|
|
|
--- a/tools/building.py
|
|
|
|
+++ b/tools/building.py
|
2022-06-10 15:13:36 +00:00
|
|
|
@@ -372,7 +372,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
|
|
|
|
|