rust/src/librustc
Alex Crichton 7df6f4161c rustc: Add a #[wasm_custom_section] attribute
This commit is an implementation of adding custom sections to wasm artifacts in
rustc. The intention here is to expose the ability of the wasm binary format to
contain custom sections with arbitrary user-defined data. Currently neither our
version of LLVM nor LLD supports this so the implementation is currently custom
to rustc itself.

The implementation here is to attach a `#[wasm_custom_section = "foo"]`
attribute to any `const` which has a type like `[u8; N]`. Other types of
constants aren't supported yet but may be added one day! This should hopefully
be enough to get off the ground with *some* custom section support.

The current semantics are that any constant tagged with `#[wasm_custom_section]`
section will be *appended* to the corresponding section in the final output wasm
artifact (and this affects dependencies linked in as well, not just the final
crate). This means that whatever is interpreting the contents must be able to
interpret binary-concatenated sections (or each constant needs to be in its own
custom section).

To test this change the existing `run-make` test suite was moved to a
`run-make-fulldeps` folder and a new `run-make` test suite was added which
applies to all targets by default. This test suite currently only has one test
which only runs for the wasm target (using a node.js script to use `WebAssembly`
in JS to parse the wasm output).
2018-03-22 13:16:38 -07:00
..
benches Stabilize slice patterns without .. 2018-03-20 02:27:40 +03:00
cfg rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree. 2017-09-01 23:27:48 +03:00
dep_graph rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
hir rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
ich Now it compiles 2018-03-21 23:11:27 +01:00
infer work around fallout from these changes in rustc 2018-03-21 05:40:59 -04:00
lint Make coerce_never lint an error 2018-03-14 12:44:51 +08:00
middle rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
mir Auto merge of #49200 - oli-obk:extern_static_metadata, r=michaelwoerister 2018-03-21 01:06:16 +00:00
session AST/HIR: Clarify what the optional name in extern crate items mean 2018-03-17 22:12:21 +03:00
traits work around fallout from these changes in rustc 2018-03-21 05:40:59 -04:00
ty rustc: Add a #[wasm_custom_section] attribute 2018-03-22 13:16:38 -07:00
util work around fallout from these changes in rustc 2018-03-21 05:40:59 -04:00
build.rs rustc: Add some build scripts for librustc crates 2017-07-22 22:04:13 -07:00
Cargo.toml Do not run the default panic hook inside procedural macros. Fixes #47812 2018-02-20 19:16:49 +01:00
diagnostics.rs also fix the Fixed code 2018-03-21 19:23:29 -04:00
lib.rs work around fallout from these changes in rustc 2018-03-21 05:40:59 -04:00
macros.rs extend stable hasher to support CanonicalTy 2018-03-16 12:49:37 -04:00
README.md Change links to readmes 2018-02-25 15:24:14 -06:00

For more information about how rustc works, see the rustc guide.