BUCKannotatedBUCKsource29 lines · 1.2 KB · raw
1rust_binary(
2    name = "hotdemo",
3    srcs = glob(["src/**/*.rs"]),
4    crate_root = "src/main.rs",
5    edition = "2024",
6    # The "fat" build flags research/subsecond-patch-build.md §1 documents `dx`
7    # adding for Thin/Fat builds, on this target only (not the toolchain):
8    # save-temps keeps the per-codegen-unit .rcgu.o objects a patch build
9    # relinks from; link-dead-code stops the linker from dropping symbols a
10    # future patch might jump to; debug-assertions=yes is what makes
11    # `subsecond::call` non-inert (subsecond/src/lib.rs:250-254 - the whole
12    # crate is a no-op in release/opt-level-3-without-this).
13    rustc_flags = [
14        "-Csave-temps=true",
15        "-Clink-dead-code",
16        "-Cdebug-assertions=yes",
17    ],
18    # Exports `main` as the ASLR reference point (`subsecond::aslr_reference`
19    # dlsyms it back out at runtime) - the one blanket export dx's fat link
20    # adds on Linux (link.rs:993-996), not a general --export-dynamic.
21    linker_flags = [
22        "-Wl,--export-dynamic-symbol,main",
23    ],
24    deps = [
25        "//third-party/rust:serde_json",
26        "//third-party/rust:subsecond",
27        "//third-party/rust:subsecond-types",
28    ],
29)