-
-
Notifications
You must be signed in to change notification settings - Fork 54
linker failure when using ASAN in a project with inventory on macOS #90
Copy link
Copy link
Open
Description
Address sanitizer instrumentation causes linker failures on macos, when building a project with ASAN if inventory is used.
Note: So far I have only tested this on macOS, so I'm not sure if this affects other platforms too or not.
Error:
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "/Users/jschwender/Dev/servo/target/aarch64-apple-darwin/debug/deps/rustcZlEnU0/symbols.o" "-Wl,-rpath,<sysroot>/lib/rustlib/aarch64-apple-darwin/lib" "-lrustc-nightly_rt.asan" "<12 object files omitted>" "/Users/jschwender/Dev/servo/target/aarch64-apple-darwin/debug/deps/{libpanic_unwind-e2cbe8a37bf8031d,libinventory-eb75aedd0a5e10b3,libstd-a905e430b68cd1eb,libobject-063f8701cb9da335,libmemchr-af83b2092bd01733,libaddr2line-6a77301e61ece6e7,libgimli-9c44d6d37bcaf012,libcfg_if-525f1fc3152666cb,librustc_demangle-5003910a324fd2b2,libstd_detect-6374965ea5a4209f,libhashbrown-bd83babaeedf7ad2,librustc_std_workspace_alloc-7605b59b0554276b,libminiz_oxide-dfa5f37a9f9b6cd5,libadler2-338aea64e3e9747a,libunwind-6c9639723d1b68fe,liblibc-1caab95a0d8c0c5a,librustc_std_workspace_core-9006be5192f25403,liballoc-f895105505615930,libcore-70bc5bc7d3a78b09,libcompiler_builtins-a822e9e3e666f863}.rlib" "-lSystem" "-lc" "-lm" "-arch" "arm64" "-mmacosx-version-min=11.0.0" "-L" "<sysroot>/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/jschwender/Dev/servo/target/aarch64-apple-darwin/debug/deps/inventory_asan_reproducer-435ea13176d07177" "-Wl,-dead_strip" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: ld: initializer pointer has no target in '/Users/jschwender/Dev/servo/target/aarch64-apple-darwin/debug/deps/inventory_asan_reproducer-435ea13176d07177.1olrms82pacaq7h911owi7jfn.0vwfdr0.rcgu.o'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Minimum reproducer
main.rs:
struct Plugin(&'static str);
inventory::collect!(Plugin);
inventory::submit! {
Plugin("hello")
}
fn main() {
for plugin in inventory::iter::<Plugin> {
std::hint::black_box(plugin.0);
}
}Cargo.toml
[package]
name = "inventory-asan-reproducer"
version = "0.1.0"
edition = "2024"
[dependencies]
inventory = "0.3.24"build command:
RUSTFLAGS="-Zsanitizer=address -C force-frame-pointers=yes" \
cargo +nightly build -Zbuild-std --target aarch64-apple-darwinReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels