rust-lang/rustc_codegen_gcc

Cannot pass CG_RUSTFLAGS when building sysroot

darcagn opened this issue · 3 comments

I've successfully gotten libc/std building targetting SuperH (SH4/Dreamcast). I need to build sysroot with -matomic-model=soft-imask for it to work properly.

I can insert rustflags.push_str(" -Cllvm-args=-matomic-model=soft-imask"); at this line:

Or insert context.add_command_line_option("-matomic-model=soft-imask"); at this line:

And I seem to get the desired effect. But I'd prefer not to patch things if I can do it without.

If I do CG_RUSTFLAGS=-Cllvm-args=-matomic-model=soft-imask y.sh build it does not seem to honor it when building the sysroot. To test this I can put gibberish flags like -blahblah and get no error when the same would give me errors when building a normal project with y.sh cargo build. Am I doing something wrong here or is this something not supported yet?

Normally we do use CG_RUSTFLAGS as you can see here. This function is called to build the command line which will be used for all commands, so if it's not setting variables correctly, maybe the code is wrong.

In this case, the environment is first set to the empty one here, so that condition is never true.

Fixed by #493.