Skip to content

Arguably improper -Clto -> -flto flag mapping #1463

@dot-asm

Description

@dot-asm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions