Skip to content

Commit

Permalink
Update rustc example to latest sources
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Apr 11, 2024
1 parent a06d30e commit 74f6ce5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
64 changes: 36 additions & 28 deletions examples/rustc.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,33 @@
["lib", new Directory(await (async function () {
let dir = new Map();
for (let file of [
"libaddr2line-3368a2ecf632bfc6.rlib",
"libadler-16845f650eeea12c.rlib",
"liballoc-359908cdc7960fbe.rlib",
"libcfg_if-7473f3420f2605c3.rlib",
"libcompiler_builtins-71ea7cc1bc898fb7.rlib",
"libaddr2line-b8754aeb03c02354.rlib",
"libadler-05c3545f6cd12159.rlib",
"liballoc-0dab879bc41cd6bd.rlib",
"libcfg_if-c7fd2cef50341546.rlib",
"libcompiler_builtins-a99947d020d809d6.rlib",
"libcore-4b8e8a815d049db3.rlib",
"libgetopts-f44aac795000338f.rlib",
"libgimli-803608e8717daecb.rlib",
"libhashbrown-78466a7e64363027.rlib",
"liblibc-5175310f1f21926c.rlib",
"libmemchr-c435600275d2183b.rlib",
"libminiz_oxide-d34599dcae36be0e.rlib",
"libobject-95dcb95966ee8da6.rlib",
"libpanic_abort-b427edf763e95e4b.rlib",
"libpanic_unwind-bc7d0e983bae92ba.rlib",
"libproc_macro-89b7ce531133f6b1.rlib",
"librustc_demangle-a99802d1dda40ccf.rlib",
"librustc_std_workspace_alloc-f8e02d7936a431a0.rlib",
"libgetopts-bbb75529e85d129d.rlib",
"libgimli-598847d27d7a3cbf.rlib",
"libhashbrown-d2ff91fdf93cacb2.rlib",
"liblibc-dc63949c664c3fce.rlib",
"libmemchr-2d3a423be1a6cb96.rlib",
"libminiz_oxide-b109506a0ccc4c6a.rlib",
"libobject-7b48def7544c748b.rlib",
"libpanic_abort-c93441899b93b849.rlib",
"libpanic_unwind-11d9ba05b60bf694.rlib",
"libproc_macro-1a7f7840bb9983dc.rlib",
"librustc_demangle-59342a335246393d.rlib",
"librustc_std_workspace_alloc-552b185085090ff6.rlib",
"librustc_std_workspace_core-5d8a121daa7eeaa9.rlib",
"librustc_std_workspace_std-f27d08c53ac7abc6.rlib",
"libstd-7b943f62dbb7006a.rlib",
"libstd-7b943f62dbb7006a.so",
"libstd_detect-81d31c776664c1e1.rlib",
"libsysroot-34f36b5e8fe41707.rlib",
"libtest-f472878f82ea373c.rlib",
"libtest-f472878f82ea373c.so",
"libunicode_width-d55ce9c674fbd422.rlib",
"libunwind-8ca3e01a84805f9e.rlib"
"librustc_std_workspace_std-97f43841ce452f7d.rlib",
"libstd-bdedb7706a556da2.rlib",
"libstd-bdedb7706a556da2.so",
"libstd_detect-cca21eebc4281add.rlib",
"libsysroot-f654e185be3ffebd.rlib",
"libtest-f06fa3fbc201c558.rlib",
"libunicode_width-19a0dcd589fa0877.rlib",
"libunwind-747b693f90af9445.rlib",
]) {
dir.set(file, await load_external_file("/examples/wasm-rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/" + file));
}
Expand All @@ -125,8 +124,17 @@
];

let w = new WASI(args, env, fds, { debug: true });
let next_thread_id = 1;

let inst = await WebAssembly.instantiate(wasm, {
"env": { memory: new WebAssembly.Memory({ initial: 256, maximum: 16384, shared: true }) },
"wasi": {
"thread-spawn": function(start_arg) {
let thread_id = next_thread_id++;
inst.exports.wasi_thread_start(thread_id, start_arg);
return thread_id;
}
},
"wasi_snapshot_preview1": strace(w.wasiImport, ["fd_prestat_get"]),
});
term.writeln("\x1B[93mExecuting\x1B[0m");
Expand All @@ -136,8 +144,8 @@

console.log(fds);
console.log(fds[5].dir);
console.log(fds[5].dir.contents.get("hello.hello.2490b9cce2492134-cgu.0.rcgu.o").data);
document.querySelector("#downloads").innerHTML += "<br><a href='" + URL.createObjectURL(new Blob([fds[5].dir.contents.get("hello.hello.2490b9cce2492134-cgu.0.rcgu.o").data], { type: "application/elf" })) + "'>Download object</a>";
console.log(fds[5].dir.contents.get("hello.hello.65c991d23c885d45-cgu.0.rcgu.o").data);
document.querySelector("#downloads").innerHTML += "<br><a href='" + URL.createObjectURL(new Blob([fds[5].dir.contents.get("hello.hello.65c991d23c885d45-cgu.0.rcgu.o").data], { type: "application/elf" })) + "'>Download object</a>";
document.querySelector("#downloads").innerHTML += "<br><a href='" + URL.createObjectURL(new Blob([fds[5].dir.contents.get("hello.allocator_shim.rcgu.o").data], { type: "application/elf" })) + "'>Download allocator shim</a>";
})();
</script>
Expand Down
2 changes: 1 addition & 1 deletion examples/wasm-rustc
Submodule wasm-rustc updated 66 files
+2 −2 README.md
+ bin/rustc.wasm
+1 −0 lib/rustlib/components
+13 −2 lib/rustlib/etc/gdb_providers.py
+3 −0 lib/rustlib/etc/lldb_commands
+5 −0 lib/rustlib/etc/lldb_lookup.py
+44 −6 lib/rustlib/etc/lldb_providers.py
+21 −15 lib/rustlib/etc/rust_types.py
+34 −72 lib/rustlib/install.log
+25 −26 lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu
+4 −4 lib/rustlib/manifest-rustc
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-3368a2ecf632bfc6.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-b8754aeb03c02354.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-05c3545f6cd12159.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-16845f650eeea12c.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-0dab879bc41cd6bd.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-359908cdc7960fbe.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7473f3420f2605c3.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-c7fd2cef50341546.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-71ea7cc1bc898fb7.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-a99947d020d809d6.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4b8e8a815d049db3.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-bbb75529e85d129d.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-f44aac795000338f.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-598847d27d7a3cbf.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-803608e8717daecb.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-78466a7e64363027.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-d2ff91fdf93cacb2.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-5175310f1f21926c.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-dc63949c664c3fce.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-2d3a423be1a6cb96.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-c435600275d2183b.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-b109506a0ccc4c6a.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-d34599dcae36be0e.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-7b48def7544c748b.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-b427edf763e95e4b.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-c93441899b93b849.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-11d9ba05b60bf694.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-bc7d0e983bae92ba.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-1a7f7840bb9983dc.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-89b7ce531133f6b1.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-59342a335246393d.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-a99802d1dda40ccf.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-552b185085090ff6.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-f8e02d7936a431a0.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-5d8a121daa7eeaa9.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-97f43841ce452f7d.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-f27d08c53ac7abc6.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-bdedb7706a556da2.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-bdedb7706a556da2.so
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-81d31c776664c1e1.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-cca21eebc4281add.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libsysroot-34f36b5e8fe41707.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libsysroot-f654e185be3ffebd.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-f06fa3fbc201c558.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-f472878f82ea373c.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-f472878f82ea373c.so
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-19a0dcd589fa0877.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-d55ce9c674fbd422.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-747b693f90af9445.rlib
+ lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-8ca3e01a84805f9e.rlib
+0 −315 share/doc/rust/README.md
+0 −0 share/doc/rustc/COPYRIGHT
+0 −0 share/doc/rustc/LICENSE-APACHE
+0 −0 share/doc/rustc/LICENSE-MIT
+77 −0 share/doc/rustc/README.md

0 comments on commit 74f6ce5

Please sign in to comment.