You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of #2822 "Start reusing rustc's format_args parser", we invoke cargo to produce object files to be linked into GCC. We currently don't specify any compilation flags and linker to use, so it's easy to run into mismatches between what GCC is configured for (for example, specific linker), and what cargo uses by default (for example, system cc for linking).
Next problem: the GCC $(LINKER) defaults to $(CXX), and doesn't just point to an executable, but may have "wrapper" executables prepended (ccache, for example), and also contain flags.
For a simple --config target.x86_64-unknown-linux-gnu.linker=\"'$(LINKER)'\", and LINKER = $(CXX), and CXX = ccache g++ [flags], we then get:
error: linker `[...]/build-gcc/gcc/ccache g++ [flags] ` not found
oh, that's really sad... any chance there's another make variable you haven't thought about which is just the linker binary and not the full invocation? it seems this is the offending line in my generated Makefile, which seems wrong (why not add it to LINKER_FLAGS?) but maybe I'm not thinking of something.
# Link with -no-pie since we compile the compiler with -fno-PIE.LINKER += $(NO_PIE_FLAG)
It looks like target.<triple>.rustflags and link-args could be used to pass arguments to the linker. We could split $(LINKER) into an executable and argument list if need be.
As of #2822 "Start reusing rustc's format_args parser", we invoke
cargo
to produce object files to be linked into GCC. We currently don't specify any compilation flags and linker to use, so it's easy to run into mismatches between what GCC isconfigure
d for (for example, specific linker), and whatcargo
uses by default (for example, systemcc
for linking).For example, the linker may be specified: https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker -- but do we need the Rust target triple for that (see #2898)? Trying to use a
cfg()
expressions à la--config "target.'cfg(all())'.linker=[...]"
only produces:(Maybe I've misunderstood how that is to be used.)
The text was updated successfully, but these errors were encountered: