Skip to content

Commit 23647e6

Browse files
Auto merge of #149868 - alexcrichton:wasm-no-allow-undefined, r=<try>
rustc: Stop passing `--allow-undefined` on wasm targets try-job: dist-x86_64-linux try-job: dist-various-*
2 parents f520900 + cfd52bb commit 23647e6

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

compiler/rustc_target/src/spec/base/wasm.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ pub(crate) fn options() -> TargetOptions {
2828
// stack overflow will be guaranteed to trap as it underflows instead of
2929
// corrupting static data.
3030
concat!($prefix, "--stack-first"),
31-
// FIXME we probably shouldn't pass this but instead pass an explicit list
32-
// of symbols we'll allow to be undefined. We don't currently have a
33-
// mechanism of knowing, however, which symbols are intended to be imported
34-
// from the environment and which are intended to be imported from other
35-
// objects linked elsewhere. This is a coarse approximation but is sure to
36-
// hide some bugs and frustrate someone at some point, so we should ideally
37-
// work towards a world where we can explicitly list symbols that are
38-
// supposed to be imported and have all other symbols generate errors if
39-
// they remain undefined.
40-
concat!($prefix, "--allow-undefined"),
4131
// LLD only implements C++-like demangling, which doesn't match our own
4232
// mangling scheme. Tell LLD to not demangle anything and leave it up to
4333
// us to demangle these symbols later. Currently rustc does not perform

tests/run-make/wasm-stringify-ints-small/foo.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#![crate_type = "cdylib"]
22

3+
#[link(wasm_import_module = "the-world")]
34
extern "C" {
45
fn observe(ptr: *const u8, len: usize);
56
}
67

78
macro_rules! s {
89
( $( $f:ident -> $t:ty );* $(;)* ) => {
910
$(
11+
#[link(wasm_import_module = "the-world")]
1012
extern "C" {
1113
fn $f() -> $t;
1214
}

tests/run-make/wasm-unexpected-features/foo.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ unsafe extern "Rust" {
1414
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
1515
}
1616

17+
#[rustc_std_internal_symbol]
18+
pub unsafe fn __rdl_alloc_error_handler(_size: usize, _align: usize) -> ! {
19+
loop {}
20+
}
21+
1722
#[used]
1823
static mut BUF: [u8; 1024] = [0; 1024];
1924

tests/ui/linking/executable-no-mangle-strip.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ run-pass
22
//@ ignore-windows-gnu: only statics marked with used can be GC-ed on windows-gnu
3+
//@ ignore-wasm: wasm, for better or worse, exports all #[no_mangle]
34

45
// Regression test for <https://github.com/rust-lang/rust/issues/139744>.
56
// Functions in the binary marked with no_mangle should be GC-ed if they

0 commit comments

Comments
 (0)