diff options
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r-- | lld/ELF/Writer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 3ba1cdb..4907705 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -9,6 +9,7 @@ #include "Writer.h" #include "AArch64ErrataFix.h" #include "ARMErrataFix.h" +#include "BPSectionOrderer.h" #include "CallGraphSort.h" #include "Config.h" #include "InputFiles.h" @@ -1080,8 +1081,18 @@ static void maybeShuffle(Ctx &ctx, // that don't appear in the order file. static DenseMap<const InputSectionBase *, int> buildSectionOrder(Ctx &ctx) { DenseMap<const InputSectionBase *, int> sectionOrder; - if (!ctx.arg.callGraphProfile.empty()) + if (ctx.arg.bpStartupFunctionSort || ctx.arg.bpFunctionOrderForCompression || + ctx.arg.bpDataOrderForCompression) { + TimeTraceScope timeScope("Balanced Partitioning Section Orderer"); + sectionOrder = runBalancedPartitioning( + ctx, ctx.arg.bpStartupFunctionSort ? ctx.arg.irpgoProfilePath : "", + ctx.arg.bpFunctionOrderForCompression, + ctx.arg.bpDataOrderForCompression, + ctx.arg.bpCompressionSortStartupFunctions, + ctx.arg.bpVerboseSectionOrderer); + } else if (!ctx.arg.callGraphProfile.empty()) { sectionOrder = computeCallGraphProfileOrder(ctx); + } if (ctx.arg.symbolOrderingFile.empty()) return sectionOrder; |