Skip to content

Commit fdb899b

Browse files
committed
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
1 parent 8f349be commit fdb899b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

compiler/rustc_target/src/spec/crt_objects.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,13 @@ pub(super) fn post_mingw() -> CrtObjects {
108108
}
109109

110110
pub(super) fn pre_wasi_fallback() -> CrtObjects {
111+
// Use crt1-command.o instead of crt1.o to enable support for new-style
112+
// commands. See https://reviews.llvm.org/D81689 for more info.
111113
new(&[
112-
(LinkOutputKind::DynamicNoPicExe, &["crt1.o"]),
113-
(LinkOutputKind::DynamicPicExe, &["crt1.o"]),
114-
(LinkOutputKind::StaticNoPicExe, &["crt1.o"]),
115-
(LinkOutputKind::StaticPicExe, &["crt1.o"]),
114+
(LinkOutputKind::DynamicNoPicExe, &["crt1-command.o"]),
115+
(LinkOutputKind::DynamicPicExe, &["crt1-command.o"]),
116+
(LinkOutputKind::StaticNoPicExe, &["crt1-command.o"]),
117+
(LinkOutputKind::StaticPicExe, &["crt1-command.o"]),
116118
(LinkOutputKind::WasiReactorExe, &["crt1-reactor.o"]),
117119
])
118120
}

src/bootstrap/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn copy_self_contained_objects(
210210
panic!("Target {:?} does not have a \"wasi-root\" key", target.triple)
211211
})
212212
.join("lib/wasm32-wasi");
213-
for &obj in &["crt1.o", "crt1-reactor.o"] {
213+
for &obj in &["crt1-command.o", "crt1-reactor.o"] {
214214
copy_and_stamp(
215215
builder,
216216
&libdir_self_contained,

0 commit comments

Comments
 (0)