Closed mjburghard closed 3 months ago
i think probably instead of doing this we should add new features for LTO which add these flags automatically, as well as the required feature?
@keith Something like swift.thin_lto
and swift.full_lto
? I found the feature for the unix_cc_toolchain. I may need a couple of pointers, but can look into this.
yea that's what im thinking. generally we use new features for this stuff vs checking in on the command line args. at least one reason why that's nicer is command line arguments can be negated / overwritten and we'd probably need to handle that
First draft is in https://github.com/bazelbuild/rules_swift/pull/1208
When passing
-lto=llvm-thin
or-lto=llvm-full
to swiftc, it switches from emitting object files to bitcode files. To includellvm-bc
instead ofobject
in the generated output-file-map, the featureSWIFT_FEATURE_EMIT_BC
(swift.emit_bc
) must be inferred. This PR implements this similar toSWIFT_FEATURE__WMO_IN_SWIFTCOPTS
.