|
1 | | -# On Linux, if we don't link to gcc_eh, we get can get this error when loading the loadable extension: |
2 | | -# undefined symbol: _Unwind_Resume |
3 | | -# This adds around 29KB to the loadable extension. |
4 | | -# It may also be an option to just define _Unwind_Resume, but it causes crashes on errors on e.g. iOS, so rather avoid it. |
5 | 1 |
|
6 | | -[target.x86_64-unknown-linux-gnu] |
7 | | -rustflags = [ |
8 | | - "-C", "link-arg=-lgcc_eh", |
9 | | -] |
| 2 | +# Previously we added this to rustflags for all linux builds: |
| 3 | +# "-C", "link-arg=-lgcc_eh" |
| 4 | +# It was to fix this error when loading the loadable extension: |
| 5 | +# undefined symbol: _Unwind_Resume |
| 6 | +# Now, we instead build using: |
| 7 | +# -Z build-std=panic_abort,core,alloc |
| 8 | +# This fixes the same issue. We still keep -lgcc_eh, |
| 9 | +# to support manual builds without -Z build-std. |
| 10 | + |
| 11 | +# Without -Z build-std, with -lgcc_eh: |
| 12 | +# 241KB, loading works |
| 13 | +# Without -Z build-std, without -lgcc_eh: |
| 14 | +# 207KB, undefined symbol: _Unwind_Resume |
| 15 | +# With -Z build-std, without -lgcc_eh: |
| 16 | +# 173K, loading works |
| 17 | +# With -Z build-std, with -lgcc_eh: |
| 18 | +# 173K, loading works |
| 19 | +# Conclusion: -lgcc_eh has no effect when using -Z build-std. |
10 | 20 |
|
11 | | -[target.i686-linux-unknown-linux-gnu] |
| 21 | +[target.x86_64-unknown-linux-gnu] |
12 | 22 | rustflags = [ |
13 | 23 | "-C", "link-arg=-lgcc_eh", |
14 | 24 | ] |
15 | 25 |
|
16 | | -[target.aarch64-linux-unknown-linux-gnu] |
| 26 | +[target.i686-unknown-linux-gnu] |
17 | 27 | rustflags = [ |
18 | 28 | "-C", "link-arg=-lgcc_eh", |
19 | 29 | ] |
20 | 30 |
|
21 | 31 | [target.aarch64-unknown-linux-gnu] |
| 32 | +linker = "aarch64-linux-gnu-gcc" |
22 | 33 | rustflags = [ |
23 | 34 | "-C", "link-arg=-lgcc_eh", |
24 | 35 | ] |
|
0 commit comments