From f53b364dd652c108ae950fb95ff50147dcd5aa67 Mon Sep 17 00:00:00 2001 From: Folkert Date: Thu, 17 Nov 2022 20:46:24 +0100 Subject: add -Zexport-executable-symbols to unstable book --- .../compiler-flags/export-executable-symbols.md | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/doc/unstable-book/src/compiler-flags/export-executable-symbols.md (limited to 'src/doc') diff --git a/src/doc/unstable-book/src/compiler-flags/export-executable-symbols.md b/src/doc/unstable-book/src/compiler-flags/export-executable-symbols.md new file mode 100644 index 00000000000..c7f10afaccc --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/export-executable-symbols.md @@ -0,0 +1,43 @@ +# `export-executable-symbols` + +The tracking issue for this feature is: [#84161](https://github.com/rust-lang/rust/issues/84161). + +------------------------ + +The `-Zexport-executable-symbols` compiler flag makes `rustc` export symbols from executables. The resulting binary is runnable, but can also be used as a dynamic library. This is useful for interoperating with programs written in other languages, in particular languages with a runtime like Java or Lua. + +For example on windows: +```rust +#[no_mangle] +fn my_function() -> usize { + return 42; +} + +fn main() { + println!("Hello, world!"); +} +``` + +A standard `cargo build` will produce a `.exe` without an export directory. When the `export-executable-symbols` flag is added + +```Bash +export RUSTFLAGS="-Zexport-executable-symbols" +cargo build +``` + +the binary has an export directory with the functions: + +```plain +The Export Tables (interpreted .edata section contents) + +... + +[Ordinal/Name Pointer] Table + [ 0] my_function + [ 1] main +``` +(the output of `objdump -x` on the binary) + +Please note that the `#[no_mangle]` attribute is required. Without it, the symbol is not exported. + +The equivalent of this flag in C and C++ compilers is the `__declspec(dllexport)` annotation or the `-rdynamic` linker flag. -- cgit 1.4.1-3-g733a5 From 70b608dad59d093ec18bd6863679b03f55c2fc9c Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Wed, 1 Mar 2023 18:30:35 -0800 Subject: Add link to component dashboard --- src/doc/rustc/src/platform-support.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/doc') diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 16057048259..e653b7f1e10 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -13,6 +13,8 @@ for targets at each tier, see the [Target Tier Policy](target-tier-policy.md). Targets are identified by their "target triple" which is the string to inform the compiler what kind of output should be produced. +Component availability is tracked [here](https://rust-lang.github.io/rustup-components-history/). + ## Tier 1 with Host Tools Tier 1 targets can be thought of as "guaranteed to work". The Rust project -- cgit 1.4.1-3-g733a5