-
Notifications
You must be signed in to change notification settings - Fork 524
Description
cc-rs appears to parse RUSTFLAGS and map -Clto rustc codegen option to clang's -flto=full. It should be noted that on the rustc side the -Clto is required to be complemented with -Cembed-bitcode. This [incidentally] means that rustc's preferred object format is one with embedded bitcode. But on the clang side -flto makes the compiler emit raw bitcode, a non-object file. One can argue that it would be more appropriate to match the rustc's preferred format. But before one rushes to map -Cembed-bitcode to -fembed-bitcode, one should recognize that -flto overrides -fembed-bitcode. In the sense that clang -flto -fembed-bitcode will still generate raw bitcode. So that if one aims to match the formats, one would have to map -Cembed-bitcode alone and let -Clto go unmapped. Alternatively one can wonder if -Cembed-bitcode will be implied with -Clto in the future and become optional. If there is a possibility, then one can make a case for mapping -Clto to -fembed-bitcode instead of -flto.