Skip to content

Commit d16b7f7

Browse files
committed
Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton"
This reverts commit 7870050, reversing changes made to 2e72448.
1 parent 7870050 commit d16b7f7

File tree

142 files changed

+537
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+537
-377
lines changed

config.toml.example

-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@
377377
# but you can also optionally enable the "emscripten" backend for asm.js or
378378
# make this an empty array (but that probably won't get too far in the
379379
# bootstrap)
380-
# FIXME: remove the obsolete emscripten backend option.
381380
#codegen-backends = ["llvm"]
382381

383382
# This is the name of the directory in which codegen backends will get installed

src/bootstrap/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,6 @@ impl<'a> Builder<'a> {
970970
Some("-Wl,-rpath,@loader_path/../lib")
971971
} else if !target.contains("windows") &&
972972
!target.contains("wasm32") &&
973-
!target.contains("emscripten") &&
974973
!target.contains("fuchsia") {
975974
Some("-Wl,-rpath,$ORIGIN/../lib")
976975
} else {

src/bootstrap/test.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1047,11 +1047,10 @@ impl Step for Compiletest {
10471047
// Also provide `rust_test_helpers` for the host.
10481048
builder.ensure(native::TestHelpers { target: compiler.host });
10491049

1050-
// As well as the target, except for plain wasm32, which can't build it
1051-
if !target.contains("wasm32") || target.contains("emscripten") {
1050+
// wasm32 can't build the test helpers
1051+
if !target.contains("wasm32") {
10521052
builder.ensure(native::TestHelpers { target });
10531053
}
1054-
10551054
builder.ensure(RemoteCopyLibs { compiler, target });
10561055

10571056
let mut cmd = builder.tool_cmd(Tool::Compiletest);

src/ci/docker/asmjs/Dockerfile

+20-9
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1111
cmake \
1212
sudo \
1313
gdb \
14-
xz-utils \
15-
bzip2
14+
xz-utils
1615

1716
COPY scripts/emscripten.sh /scripts/
1817
RUN bash /scripts/emscripten.sh
@@ -21,16 +20,28 @@ COPY scripts/sccache.sh /scripts/
2120
RUN sh /scripts/sccache.sh
2221

2322
ENV PATH=$PATH:/emsdk-portable
24-
ENV PATH=$PATH:/emsdk-portable/upstream/emscripten/
25-
ENV PATH=$PATH:/emsdk-portable/node/12.9.1_64bit/bin/
26-
ENV BINARYEN_ROOT=/emsdk-portable/upstream/
23+
ENV PATH=$PATH:/emsdk-portable/clang/e1.38.15_64bit/
24+
ENV PATH=$PATH:/emsdk-portable/emscripten/1.38.15/
25+
ENV PATH=$PATH:/emsdk-portable/node/8.9.1_64bit/bin/
26+
ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.38.15/
27+
ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.38.15_64bit/binaryen/
2728
ENV EM_CONFIG=/emsdk-portable/.emscripten
2829

2930
ENV TARGETS=asmjs-unknown-emscripten
3031

31-
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
32+
ENV RUST_CONFIGURE_ARGS --enable-emscripten --disable-optimize-tests
3233

33-
# This is almost identical to the wasm32-unknown-emscripten target, so
34-
# running with assertions again is not useful
35-
ENV NO_DEBUG_ASSERTIONS=1
34+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS \
35+
src/test/ui \
36+
src/test/run-fail \
37+
src/libstd \
38+
src/liballoc \
39+
src/libcore
40+
41+
# Debug assertions in rustc are largely covered by other builders, and LLVM
42+
# assertions cause this builder to slow down by quite a large amount and don't
43+
# buy us a huge amount over other builders (not sure if we've ever seen an
44+
# asmjs-specific backend assertion trip), so disable assertions for these
45+
# tests.
3646
ENV NO_LLVM_ASSERTIONS=1
47+
ENV NO_DEBUG_ASSERTIONS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python \
10+
git \
11+
cmake \
12+
sudo \
13+
gdb \
14+
xz-utils \
15+
jq \
16+
bzip2
17+
18+
# emscripten
19+
COPY scripts/emscripten-wasm.sh /scripts/
20+
COPY wasm32-exp/node.sh /usr/local/bin/node
21+
RUN bash /scripts/emscripten-wasm.sh
22+
23+
# cache
24+
COPY scripts/sccache.sh /scripts/
25+
RUN sh /scripts/sccache.sh
26+
27+
# env
28+
ENV PATH=/wasm-install/emscripten:/wasm-install/bin:$PATH
29+
ENV EM_CONFIG=/root/.emscripten
30+
31+
ENV TARGETS=wasm32-experimental-emscripten
32+
33+
ENV RUST_CONFIGURE_ARGS --experimental-targets=WebAssembly
34+
35+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
path="$(dirname $1)"
4+
file="$(basename $1)"
5+
6+
shift
7+
8+
cd "$path"
9+
exec /node-v8.0.0-linux-x64/bin/node "$file" "$@"

src/ci/docker/disabled/wasm32/Dockerfile

+8-14
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1111
cmake \
1212
sudo \
1313
gdb \
14-
xz-utils \
15-
bzip2
14+
xz-utils
1615

16+
# emscripten
1717
COPY scripts/emscripten.sh /scripts/
1818
RUN bash /scripts/emscripten.sh
1919

2020
COPY scripts/sccache.sh /scripts/
2121
RUN sh /scripts/sccache.sh
2222

2323
ENV PATH=$PATH:/emsdk-portable
24-
ENV PATH=$PATH:/emsdk-portable/upstream/emscripten/
25-
ENV PATH=$PATH:/emsdk-portable/node/12.9.1_64bit/bin/
26-
ENV BINARYEN_ROOT=/emsdk-portable/upstream/
24+
ENV PATH=$PATH:/emsdk-portable/clang/e1.38.15_64bit/
25+
ENV PATH=$PATH:/emsdk-portable/emscripten/1.38.15/
26+
ENV PATH=$PATH:/emsdk-portable/node/8.9.1_64bit/bin/
27+
ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.38.15/
28+
ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.38.15_64bit/binaryen/
2729
ENV EM_CONFIG=/emsdk-portable/.emscripten
2830

2931
ENV TARGETS=wasm32-unknown-emscripten
30-
31-
# FIXME: Re-enable these tests once Cargo stops trying to execute wasms
32-
ENV SCRIPT python2.7 ../x.py test --target $TARGETS \
33-
--exclude src/libcore \
34-
--exclude src/liballoc \
35-
--exclude src/libproc_macro \
36-
--exclude src/libstd \
37-
--exclude src/libterm \
38-
--exclude src/libtest
32+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
set -ex
2+
3+
hide_output() {
4+
set +x
5+
on_err="
6+
echo ERROR: An error was encountered with the build.
7+
cat /tmp/build.log
8+
exit 1
9+
"
10+
trap "$on_err" ERR
11+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
12+
PING_LOOP_PID=$!
13+
$@ &> /tmp/build.log
14+
trap - ERR
15+
kill $PING_LOOP_PID
16+
rm -f /tmp/build.log
17+
set -x
18+
}
19+
20+
# Download last known good emscripten from WebAssembly waterfall
21+
BUILD=$(curl -fL https://storage.googleapis.com/wasm-llvm/builds/linux/lkgr.json | \
22+
jq '.build | tonumber')
23+
curl -sL https://storage.googleapis.com/wasm-llvm/builds/linux/$BUILD/wasm-binaries.tbz2 | \
24+
hide_output tar xvkj
25+
26+
# node 8 is required to run wasm
27+
cd /
28+
curl -sL https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
29+
tar -xJ
30+
31+
# Make emscripten use wasm-ready node and LLVM tools
32+
echo "EMSCRIPTEN_ROOT = '/wasm-install/emscripten'" >> /root/.emscripten
33+
echo "NODE_JS='/usr/local/bin/node'" >> /root/.emscripten
34+
echo "LLVM_ROOT='/wasm-install/bin'" >> /root/.emscripten
35+
echo "BINARYEN_ROOT = '/wasm-install'" >> /root/.emscripten
36+
echo "COMPILER_ENGINE = NODE_JS" >> /root/.emscripten
37+
echo "JS_ENGINES = [NODE_JS]" >> /root/.emscripten

src/ci/docker/scripts/emscripten.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@ exit 1
1717
set -x
1818
}
1919

20-
git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
20+
cd /
21+
curl -fL https://mozilla-games.s3.amazonaws.com/emscripten/releases/emsdk-portable.tar.gz | \
22+
tar -xz
23+
2124
cd /emsdk-portable
22-
hide_output ./emsdk install 1.38.46-upstream
23-
./emsdk activate 1.38.46-upstream
25+
./emsdk update
26+
hide_output ./emsdk install sdk-1.38.15-64bit
27+
./emsdk activate sdk-1.38.15-64bit
2428

2529
# Compile and cache libc
2630
source ./emsdk_env.sh
2731
echo "main(){}" > a.c
2832
HOME=/emsdk-portable/ emcc a.c
33+
HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
2934
rm -f a.*
3035

3136
# Make emsdk usable by any user

src/liballoc/tests/binary_heap.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
use std::cmp;
12
use std::collections::BinaryHeap;
23
use std::collections::binary_heap::{Drain, PeekMut};
4+
use std::panic::{self, AssertUnwindSafe};
5+
use std::sync::atomic::{AtomicUsize, Ordering};
6+
7+
use rand::{thread_rng, seq::SliceRandom};
38

49
#[test]
510
fn test_iterator() {
@@ -276,15 +281,9 @@ fn assert_covariance() {
276281
// even if the order may not be correct.
277282
//
278283
// Destructors must be called exactly once per element.
279-
// FIXME: re-enable emscripten once it can unwind again
280284
#[test]
281-
#[cfg(not(any(miri, target_os = "emscripten")))] // Miri does not support catching panics
285+
#[cfg(not(miri))] // Miri does not support catching panics
282286
fn panic_safe() {
283-
use std::cmp;
284-
use std::panic::{self, AssertUnwindSafe};
285-
use std::sync::atomic::{AtomicUsize, Ordering};
286-
use rand::{thread_rng, seq::SliceRandom};
287-
288287
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
289288

290289
#[derive(Eq, PartialEq, Ord, Clone, Debug)]

src/liballoc/tests/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ mod slice_index {
483483
}
484484

485485
#[test]
486-
#[cfg(not(target_os = "emscripten"))] // hits an OOM
486+
#[cfg(not(target_arch = "asmjs"))] // hits an OOM
487487
#[cfg(not(miri))] // Miri is too slow
488488
fn simple_big() {
489489
fn a_million_letter_x() -> String {

src/liballoc/tests/str.rs.rej

-10
This file was deleted.

src/liballoc/tests/vec.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -944,10 +944,8 @@ fn drain_filter_complex() {
944944
}
945945
}
946946

947-
// Miri does not support catching panics
948-
// FIXME: re-enable emscripten once it can unwind again
949947
#[test]
950-
#[cfg(not(any(miri, target_os = "emscripten")))]
948+
#[cfg(not(miri))] // Miri does not support catching panics
951949
fn drain_filter_consumed_panic() {
952950
use std::rc::Rc;
953951
use std::sync::Mutex;
@@ -997,9 +995,8 @@ fn drain_filter_consumed_panic() {
997995
}
998996
}
999997

1000-
// FIXME: Re-enable emscripten once it can catch panics
1001998
#[test]
1002-
#[cfg(not(any(miri, target_os = "emscripten")))] // Miri does not support catching panics
999+
#[cfg(not(miri))] // Miri does not support catching panics
10031000
fn drain_filter_unconsumed_panic() {
10041001
use std::rc::Rc;
10051002
use std::sync::Mutex;

src/libcore/ffi.rs

+38-18
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ impl fmt::Debug for c_void {
4949
/// Basic implementation of a `va_list`.
5050
// The name is WIP, using `VaListImpl` for now.
5151
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
52-
not(target_arch = "x86_64")),
52+
not(target_arch = "x86_64"), not(target_arch = "asmjs")),
5353
all(target_arch = "aarch64", target_os = "ios"),
54-
target_arch = "wasm32",
55-
target_arch = "asmjs",
5654
windows))]
5755
#[repr(transparent)]
5856
#[unstable(feature = "c_variadic",
@@ -69,10 +67,8 @@ pub struct VaListImpl<'f> {
6967
}
7068

7169
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
72-
not(target_arch = "x86_64")),
70+
not(target_arch = "x86_64"), not(target_arch = "asmjs")),
7371
all(target_arch = "aarch64", target_os = "ios"),
74-
target_arch = "wasm32",
75-
target_arch = "asmjs",
7672
windows))]
7773
#[unstable(feature = "c_variadic",
7874
reason = "the `c_variadic` feature has not been properly tested on \
@@ -141,6 +137,38 @@ pub struct VaListImpl<'f> {
141137
_marker: PhantomData<&'f mut &'f c_void>,
142138
}
143139

140+
/// asm.js ABI implementation of a `va_list`.
141+
// asm.js uses the PNaCl ABI, which specifies that a `va_list` is
142+
// an array of 4 32-bit integers, according to the old PNaCl docs at
143+
// https://web.archive.org/web/20130518054430/https://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Derived-Types
144+
// and clang does the same in `CreatePNaClABIBuiltinVaListDecl` from `lib/AST/ASTContext.cpp`
145+
#[cfg(all(target_arch = "asmjs", not(windows)))]
146+
#[repr(C)]
147+
#[unstable(feature = "c_variadic",
148+
reason = "the `c_variadic` feature has not been properly tested on \
149+
all supported platforms",
150+
issue = "44930")]
151+
#[lang = "va_list"]
152+
pub struct VaListImpl<'f> {
153+
inner: [crate::mem::MaybeUninit<i32>; 4],
154+
_marker: PhantomData<&'f mut &'f c_void>,
155+
}
156+
157+
#[cfg(all(target_arch = "asmjs", not(windows)))]
158+
#[unstable(feature = "c_variadic",
159+
reason = "the `c_variadic` feature has not been properly tested on \
160+
all supported platforms",
161+
issue = "44930")]
162+
impl<'f> fmt::Debug for VaListImpl<'f> {
163+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
164+
unsafe {
165+
write!(f, "va_list* [{:#x}, {:#x}, {:#x}, {:#x}]",
166+
self.inner[0].read(), self.inner[1].read(),
167+
self.inner[2].read(), self.inner[3].read())
168+
}
169+
}
170+
}
171+
144172
/// A wrapper for a `va_list`
145173
#[repr(transparent)]
146174
#[derive(Debug)]
@@ -150,29 +178,23 @@ pub struct VaListImpl<'f> {
150178
issue = "44930")]
151179
pub struct VaList<'a, 'f: 'a> {
152180
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
153-
not(target_arch = "x86_64")),
181+
not(target_arch = "x86_64"), not(target_arch = "asmjs")),
154182
all(target_arch = "aarch64", target_os = "ios"),
155-
target_arch = "wasm32",
156-
target_arch = "asmjs",
157183
windows))]
158184
inner: VaListImpl<'f>,
159185

160186
#[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc",
161-
target_arch = "x86_64"),
187+
target_arch = "x86_64", target_arch = "asmjs"),
162188
any(not(target_arch = "aarch64"), not(target_os = "ios")),
163-
not(target_arch = "wasm32"),
164-
not(target_arch = "asmjs"),
165189
not(windows)))]
166190
inner: &'a mut VaListImpl<'f>,
167191

168192
_marker: PhantomData<&'a mut VaListImpl<'f>>,
169193
}
170194

171195
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
172-
not(target_arch = "x86_64")),
196+
not(target_arch = "x86_64"), not(target_arch = "asmjs")),
173197
all(target_arch = "aarch64", target_os = "ios"),
174-
target_arch = "wasm32",
175-
target_arch = "asmjs",
176198
windows))]
177199
#[unstable(feature = "c_variadic",
178200
reason = "the `c_variadic` feature has not been properly tested on \
@@ -190,10 +212,8 @@ impl<'f> VaListImpl<'f> {
190212
}
191213

192214
#[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc",
193-
target_arch = "x86_64"),
215+
target_arch = "x86_64", target_arch = "asmjs"),
194216
any(not(target_arch = "aarch64"), not(target_os = "ios")),
195-
not(target_arch = "wasm32"),
196-
not(target_arch = "asmjs"),
197217
not(windows)))]
198218
#[unstable(feature = "c_variadic",
199219
reason = "the `c_variadic` feature has not been properly tested on \

0 commit comments

Comments
 (0)