about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs
AgeCommit message (Collapse)AuthorLines
2023-11-08targets: move target specs to spec/targetsDavid Wood-55/+0
Signed-off-by: David Wood <david@davidtw.co>
2023-11-08target: move base specs to spec/baseDavid Wood-2/+2
Signed-off-by: David Wood <david@davidtw.co>
2022-12-06Stop passing -export-dynamic to wasm-ld.Dan Gohman-7/+0
-export-dynamic was a temporary hack added in the early days of the Rust wasm32 target when Rust didn't have a way to specify wasm exports in the source code. This flag causes all global symbols, and some compiler-internal symbols, to be exported, which is often more than needed. Rust now does have a way to specify exports in the source code: `#[export_name = "..."]`. So as the original comment suggests, -export-dynamic can now be removed, allowing users to have smaller binaries and better encapsulation in their wasm32-unknown-unknown modules. It's possible that this change will require existing wasm32-unknown-unknown users will to add explicit `#[export_name = "..."]` directives to exporrt the symbols that their programs depend on having exported.
2022-10-06rustc_target: Refactor internal linker flavorsVadim Petrochenkov-5/+3
In accordance with the design from https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595
2022-06-25rustc_target: Some more tests and fixes for linker argumentsVadim Petrochenkov-9/+12
2022-06-25rustc_target: Add convenience functions for adding linker argumentsVadim Petrochenkov-19/+19
They ensure that lld and non-lld linker flavors get the same set of arguments
2022-04-03Replace every `String` in Target(Options) with `Cow<'static, str>`Loïc BRANSTETT-9/+9
2022-02-16Update data layout for wasm32 targetsNikita Popov-1/+1
New address spaces were added in https://reviews.llvm.org/D111154.
2021-08-16Update wasm data layoutNikita Popov-1/+1
2021-04-08rustc: Add a new `wasm` ABIAlex Crichton-0/+12
This commit implements the idea of a new ABI for the WebAssembly target, one called `"wasm"`. This ABI is entirely of my own invention and has no current precedent, but I think that the addition of this ABI might help solve a number of issues with the WebAssembly targets. When `wasm32-unknown-unknown` was first added to Rust I naively "implemented an abi" for the target. I then went to write `wasm-bindgen` which accidentally relied on details of this ABI. Turns out the ABI definition didn't match C, which is causing issues for C/Rust interop. Currently the compiler has a "wasm32 bindgen compat" ABI which is the original implementation I added, and it's purely there for, well, `wasm-bindgen`. Another issue with the WebAssembly target is that it's not clear to me when and if the default C ABI will change to account for WebAssembly's multi-value feature (a feature that allows functions to return multiple values). Even if this does happen, though, it seems like the C ABI will be guided based on the performance of WebAssembly code and will likely not match even what the current wasm-bindgen-compat ABI is today. This leaves a hole in Rust's expressivity in binding WebAssembly where given a particular import type, Rust may not be able to import that signature with an updated C ABI for multi-value. To fix these issues I had the idea of a new ABI for WebAssembly, one called `wasm`. The definition of this ABI is "what you write maps straight to wasm". The goal here is that whatever you write down in the parameter list or in the return values goes straight into the function's signature in the WebAssembly file. This special ABI is for intentionally matching the ABI of an imported function from the environment or exporting a function with the right signature. With the addition of a new ABI, this enables rustc to: * Eventually remove the "wasm-bindgen compat hack". Once this ABI is stable wasm-bindgen can switch to using it everywhere. Afterwards the wasm32-unknown-unknown target can have its default ABI updated to match C. * Expose the ability to precisely match an ABI signature for a WebAssembly function, regardless of what the C ABI that clang chooses turns out to be. * Continue to evolve the definition of the default C ABI to match what clang does on all targets, since the purpose of that ABI will be explicitly matching C rather than generating particular function imports/exports. Naturally this is implemented as an unstable feature initially, but it would be nice for this to get stabilized (if it works) in the near-ish future to remove the wasm32-unknown-unknown incompatibility with the C ABI. Doing this, however, requires the feature to be on stable because wasm-bindgen works with stable Rust.
2021-04-05Rollup merge of #80525 - devsnek:wasm64, r=nagisaDylan DPC-2/+2
wasm64 support There is still some upstream llvm work needed before this can land.
2021-04-04wasm64Gus Caplan-2/+2
2021-03-28rustc_target: Avoid unwraps when adding linker flagsVadim Petrochenkov-2/+2
2021-01-21Don't link with --export-dynamic on wasm32-wasiDan Gohman-5/+12
Remove --export-dynamic from the link arguments on the wasm32-wasi target, as it emits spurious exports and increases code size. Leave it in place for wasm32-unknown-unknown and wasm32-unknown-emscripten. Even though it isn't a great solution there, users are likely depending on its behavior there.
2020-11-08rustc_target: Rename some target options to avoid tautologyVadim Petrochenkov-1/+1
`target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount`
2020-11-07rustc_target: Move `linker_flavor` from `Target` to `TargetOptions`Vadim Petrochenkov-1/+1
2020-11-07rustc_target: Move `target_vendor` from `Target` to `TargetOptions`Vadim Petrochenkov-1/+0
2020-11-07rustc_target: Move `target_env` from `Target` to `TargetOptions`Vadim Petrochenkov-1/+0
2020-11-07rustc_target: Move `target_os` from `Target` to `TargetOptions`Vadim Petrochenkov-1/+1
2020-11-07rustc_target: Move `target_endian` from `Target` to `TargetOptions`Vadim Petrochenkov-1/+0
2020-11-07rustc_target: Move `target_c_int_width` from `Target` to `TargetOptions`Vadim Petrochenkov-1/+0
2020-11-05Fix automatic_links warningsGuillaume Gomez-1/+1
2020-10-15Use integer literals for builtin target_pointer_width fieldsest31-1/+1
Also change target_pointer_width to pointer_width. Preparation for a subsequent type change of target_pointer_width to an integer together with a rename to pointer_width. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/rustc_target/src/spec/ -type f -exec sed -i -e 's/target_pointer_width: "\(.*\)"\..*,/pointer_width: \1,/g' {} \;
2020-10-05rustc_target: Refactor away `TargetResult`Vadim Petrochenkov-3/+3
Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary.
2020-08-30mv compiler to compiler/mark-0/+46