mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 02:54:00 +00:00
Use correct pipeline for LTO at O0
Unlike the pre-link piplines, the LTO pipelines do support O0, and using them is required to avoid leaving behind undefined references for the linker.
This commit is contained in:
parent
be01f42f73
commit
074bbc6b87
@ -1004,7 +1004,10 @@ LLVMRustOptimizeWithNewPassManager(
|
||||
#endif
|
||||
bool NeedThinLTOBufferPasses = UseThinLTOBuffers;
|
||||
if (!NoPrepopulatePasses) {
|
||||
if (OptLevel == OptimizationLevel::O0) {
|
||||
// The pre-link pipelines don't support O0 and require using budilO0DefaultPipeline() instead.
|
||||
// At the same time, the LTO pipelines do support O0 and using them is required.
|
||||
bool IsLTO = OptStage == LLVMRustOptStage::ThinLTO || OptStage == LLVMRustOptStage::FatLTO;
|
||||
if (OptLevel == OptimizationLevel::O0 && !IsLTO) {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
for (const auto &C : PipelineStartEPCallbacks)
|
||||
PB.registerPipelineStartEPCallback(C);
|
||||
|
Loading…
Reference in New Issue
Block a user