Open
Description
openedon Sep 19, 2024
Hi.
I was testing cross-language LTO with rustc_codegen_gcc (using GCC as the linker) and I needed to add a leading dash to the flags in this code in order to make cross-language LTO working, so that it looks like this:
self.link_args(&[
&format!("-plugin-opt=-{opt_level}"),
&format!("-plugin-opt=-mcpu={}", self.target_cpu),
]);
Otherwise, GCC will error out with:
lto1: fatal error: open O3 failed: No such file or directory
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
It would be nice to have the code working for both GCC and clang.
How would you support both?
Interestingly, clang
seems to support a leading dash in the case of -plugin-opt=-mcpu=x86-64
, but not -plugin-opt=-O3
.
Thanks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment