Skip to content

Commit

Permalink
Rollup merge of rust-lang#82924 - sunfishcode:wasi-command, r=alexcri…
Browse files Browse the repository at this point in the history
…chton

WASI: Switch to crt1-command.o to enable support for new-style commands

This switches Rust's WASI target to use crt1-command.o instead of
crt1.o, which enables support for new-style commands. By default,
new-style commands work the same way as old-style commands, so nothing
immediately changes here, but this will be needed by later changes to
enable support for typed arguments.

See here for more information on new-style commands:
 - WebAssembly/wasi-libc#203
 - https://reviews.llvm.org/D81689

r? ``@alexcrichton``
  • Loading branch information
Dylan-DPC committed Mar 9, 2021
2 parents 077dff5 + fdb899b commit 7c3f684
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions compiler/rustc_target/src/spec/crt_objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ pub(super) fn post_mingw() -> CrtObjects {
}

pub(super) fn pre_wasi_fallback() -> CrtObjects {
// Use crt1-command.o instead of crt1.o to enable support for new-style
// commands. See https://reviews.llvm.org/D81689 for more info.
new(&[
(LinkOutputKind::DynamicNoPicExe, &["crt1.o"]),
(LinkOutputKind::DynamicPicExe, &["crt1.o"]),
(LinkOutputKind::StaticNoPicExe, &["crt1.o"]),
(LinkOutputKind::StaticPicExe, &["crt1.o"]),
(LinkOutputKind::DynamicNoPicExe, &["crt1-command.o"]),
(LinkOutputKind::DynamicPicExe, &["crt1-command.o"]),
(LinkOutputKind::StaticNoPicExe, &["crt1-command.o"]),
(LinkOutputKind::StaticPicExe, &["crt1-command.o"]),
(LinkOutputKind::WasiReactorExe, &["crt1-reactor.o"]),
])
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ fn copy_self_contained_objects(
panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
})
.join("lib/wasm32-wasi");
for &obj in &["crt1.o", "crt1-reactor.o"] {
for &obj in &["crt1-command.o", "crt1-reactor.o"] {
copy_and_stamp(
builder,
&libdir_self_contained,
Expand Down

0 comments on commit 7c3f684

Please sign in to comment.