-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Description
Compiling a short Rust snippet exporting a function with spaces produces linker syntax error in VERSION script on stable Rust 1.86 or ; expected, but got with on the latest nightly.
I tried this code:
#[unsafe(export_name = "name with spaces")]
pub fn name() {}Here is the repro: https://github.com/berestovskyy/linker-bug
I expected to see this happen: cargo build succeeds.
Instead, this happened: cargo build fails with linker error:
Compiling linker-bug v0.1.0 (/home/a/tmp/linker-bug)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-Wl,--version-script=/tmp/rustcTzaYvJ/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcTzaYvJ/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcTzaYvJ/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,-znostart-stop-gc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/a/tmp/linker-bug/target/x86_64-unknown-linux-gnu/debug/deps/liblinker_bug.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: /tmp/rustcTzaYvJ/list:3: ; expected, but got with
>>> name with spaces;
>>> ^
collect2: error: ld returned 1 exit status
Meta
rustc --version --verbose:
rustc 1.89.0-nightly (60dabef95 2025-05-19)
binary: rustc
commit-hash: 60dabef95a3de3ec974dcb50926e4bfe743f078f
commit-date: 2025-05-19
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.