[BOLT] Support files with no symbols`LastSymbol` handling in `discoverFileObjects` assumes a non-zero number ofsymbols in an object file. It's not the case for broken_dynsym.test added inD130073,
[BOLT] Support files with no symbols`LastSymbol` handling in `discoverFileObjects` assumes a non-zero number ofsymbols in an object file. It's not the case for broken_dynsym.test added inD130073, and potentially other stripped binaries.Reviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D130544
show more ...
[BOLT] Handle broken .dynsym in stripped binariesStrip tools cause a few symbols in .dynsym to have bad section index.This update safely keeps such broken symbols intact.Test Plan:```ninja che
[BOLT] Handle broken .dynsym in stripped binariesStrip tools cause a few symbols in .dynsym to have bad section index.This update safely keeps such broken symbols intact.Test Plan:```ninja check-bolt```Reviewed By: AmirDifferential Revision: https://reviews.llvm.org/D130073
[BOLT] Add function layout classThis patch adds a dedicated class to keep track of each function'slayout. It also lays the groundwork for splitting functions intomultiple fragments (as opposed to
[BOLT] Add function layout classThis patch adds a dedicated class to keep track of each function'slayout. It also lays the groundwork for splitting functions intomultiple fragments (as opposed to a strict hot/cold split).Reviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D129518
[BOLT] Support split landing padWe previously support split jump table, where some jump table entriestarget different fragments of same function. In this fix, we providesupport for another type o
[BOLT] Support split landing padWe previously support split jump table, where some jump table entriestarget different fragments of same function. In this fix, we providesupport for another type of intra-indirect transfer: landing pad.When C++ exception handling is used, compiler emits .gcc_except_tablethat describes the location of catch block (landing pad) for specificrange that potentially invokes a throw(). Normally landing pads residein the function, but with -fsplit-machine-functions, landing pads canbe moved to another fragment. The intuition is, landing pads are rarelyexecuted, so compiler can move them to .cold section.This update will mark all fragments that have landing pad to anotherfragment as non-simple, and later propagate non-simple to all relatedfragments.This update also includes one manual test case: split-landing-pad.sReviewed By: AmirDifferential Revision: https://reviews.llvm.org/D128561
[BOLT] Support multiple parents for split jump tableThere are two assumptions regarding jump table:(a) It is accessed by only one fragment, say, Parent(b) All entries target instructions in Paren
[BOLT] Support multiple parents for split jump tableThere are two assumptions regarding jump table:(a) It is accessed by only one fragment, say, Parent(b) All entries target instructions in ParentFor (a), BOLT stores jump table entries as relative offset to Parent.For (b), BOLT treats jump table entries target somewhere out of Parentas INVALID_OFFSET, including fragment of same split function.In this update, we extend (a) and (b) to include fragment of same splitfunctinon. For (a), we store jump table entries in absolute offsetinstead. In addition, jump table will store all fragments that accessit. A fragment uses this information to only create label for jump tableentries that target to that fragment.For (b), using absolute offset allows jump table entries to targetfragments of same split function, i.e., extend support for split jumptable. This can be done using relocation (fragment start/size) andfragment detection heuristics (e.g., using symbol name pattern fornon-stripped binaries).For jump table targets that can only be reached by one fragment, wemark them as local label; otherwise, they would be the secondaryfunction entry to the target fragment.Test Plan```ninja check-bolt```Reviewed By: AmirDifferential Revision: https://reviews.llvm.org/D128474
[BOLT][AArch64] Handle gold linker veneersThe gold linker veneers are written between functions without symbols,so we to handle it specially in BOLT.Vladislav Khmelevsky,Advanced Software Techn
[BOLT][AArch64] Handle gold linker veneersThe gold linker veneers are written between functions without symbols,so we to handle it specially in BOLT.Vladislav Khmelevsky,Advanced Software Technology Lab, HuaweiDifferential Revision: https://reviews.llvm.org/D129260
Revert "Rebase: [Facebook] Revert "[BOLT] Update dynamic relocations from section relocations""This reverts commit 76029cc53e838e6d86b13b0c39152f474fb09263.
Rebase: [Facebook] Revert "[BOLT] Update dynamic relocations from section relocations"Summary:This reverts commit 729d29e167a553ee1190c310b6a510db8d8731ac.Needed as a workaround for T112872562.
Rebase: [Facebook] Revert "[BOLT] Update dynamic relocations from section relocations"Summary:This reverts commit 729d29e167a553ee1190c310b6a510db8d8731ac.Needed as a workaround for T112872562.Manual rebase conflict history:https://phabricator.intern.facebook.com/D35230076https://phabricator.intern.facebook.com/D35681740Test Plan: sandcastleReviewers: #llvm-boltSubscribers: spupyrevDifferential Revision: https://phabricator.intern.facebook.com/D37098481
[BOLT][DWARF] Support mix mode DWARFAdded support for mixing monolithic DWARF5 with legacy DWARF, and monolithic legacy and DWARF5 split dwarf.Reviewed By: maksfbDifferential Revision: https://
[BOLT][DWARF] Support mix mode DWARFAdded support for mixing monolithic DWARF5 with legacy DWARF, and monolithic legacy and DWARF5 split dwarf.Reviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D128232
[BOLT] Fix getDynoStats to handle BCs with no functionsAddress fuzzer crashReviewed By: yota9Differential Revision: https://reviews.llvm.org/D120696
Revert "[BOLT][AArch64] Handle gold linker veneers"This reverts commit 425dda76e9fac93117289fd68a2abdfb1e4a0ba5.This commit is currently causing BOLT to crash in one of ourbinaries and needs a b
Revert "[BOLT][AArch64] Handle gold linker veneers"This reverts commit 425dda76e9fac93117289fd68a2abdfb1e4a0ba5.This commit is currently causing BOLT to crash in one of ourbinaries and needs a bit more checking to make sure it is safeto land.
[BOLT][AArch64] Handle gold linker veneersThe gold linker veneers are written between functions without symbols,so we to handle it specially in BOLT.Vladislav Khmelevsky,Advanced Software Technology Lab, HuaweiDifferential Revision: https://reviews.llvm.org/D128082
[BOLT][DWARF] Add support for DW_AT_call_pc/DW_AT_call_return_pcDWARF 5 added two new attributes DW_AT_call_pc and DW_AT_call_return_pc.Adding support for them.Reviewed By: maksfbDifferential
[BOLT][DWARF] Add support for DW_AT_call_pc/DW_AT_call_return_pcDWARF 5 added two new attributes DW_AT_call_pc and DW_AT_call_return_pc.Adding support for them.Reviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D128526
[BOLT][NFC] Use range-based STL wrappersReplace `std::` algorithms taking begin/end iterators with `llvm::` counterpartsaccepting ranges.Reviewed By: rafaulerDifferential Revision: https://rev
[BOLT][NFC] Use range-based STL wrappersReplace `std::` algorithms taking begin/end iterators with `llvm::` counterpartsaccepting ranges.Reviewed By: rafaulerDifferential Revision: https://reviews.llvm.org/D128154
[BOLT] Split functions with exceptions in shared objects and PIEsAdd functionality to allow splitting code with C++ exceptions in sharedlibraries and PIEs. To overcome a limitation in exception ra
[BOLT] Split functions with exceptions in shared objects and PIEsAdd functionality to allow splitting code with C++ exceptions in sharedlibraries and PIEs. To overcome a limitation in exception ranges format,for functions with fragments spanning multiple sections, add trampolinelanding pads in the same section as the corresponding throwing range.Reviewed By: AmirDifferential Revision: https://reviews.llvm.org/D127936
[BOLT] Allow function entry to be a cold fragmentAllow cold fragment to get new address.Our previous assumption is that a fragment (.cold) is only reachedthrough the main fragment of same functi
[BOLT] Allow function entry to be a cold fragmentAllow cold fragment to get new address.Our previous assumption is that a fragment (.cold) is only reachedthrough the main fragment of same function. In addition, .cold fragmentmust be reached through either (a) direct transfer, or (b) split jumptable. For (a), we perform a simple fix-up. For (b), we currently markall relevant fragments as non-simple. Therefore, there is no need toget new address for .cold fragment.This is not always the case, as function entry can be rarely executed,and is placed in .text.cold segment. Essentially we cannot tell whichthe source-level function entry is based on hot and cold segments,so we must treat each fragment a function on its own. Therfore, weremove the assertion that a function entry cannot be cold fragment.Test Plan:```ninja check-bolt```Reviewed By: AmirDifferential Revision: https://reviews.llvm.org/D128111
[BOLT] Allow function fragments to point to one jump tableResolve a crash related to split functionsDue to split function optimization, a function can be divided to two fragments, and both fragm
[BOLT] Allow function fragments to point to one jump tableResolve a crash related to split functionsDue to split function optimization, a function can be divided to two fragments, and both fragments can access same jump table. Thisviolates the assumption that a jump table can only have one parentfunction, which causes a crash during instrumentation.We want to support the case: different functions cannot access samejump tables, but different fragments of same function can!As all fragments are from same function, we point JT::Parent to onespecific fragment. Right now it is the first disassembled fragment, butwe can point it to the function's main fragment later.Functions are disassembled sequentially. Previously, at the end ofprocessing a function, JT::OffsetEntries is cleared, so other fragmentcan no longer reuse JT::OffsetEntries. To extend the support for splitfunction, we only clear JT::OffsetEntries after all functions aredisassembled.Let say A.hot and A.cold access JT of three targets {X, Y, Z}, whereX and Y are in A.hot, and Z is in A.cold. Suppose that A.hot isdisassembled first, JT::OffsetEntries = {X',Y',INVALID_OFFSET}. WhenA.cold is disassembled, it cannot reuse JT::OffsetEntries above due todifferent fragment start. A simple solution:A.hot = {X',Y',INVALID_OFFSET}A.cold = {INVALID_OFFSET, INVALID_OFFSET, INVALID_OFFSET}We update the assertion to allow different fragments of same functionto get the same JumpTable object.Potential improvements:A.hot = {X',Y',INVALID_OFFSET}A.cold = {INVALID_OFFSET, INVALID_OFFSET, Z'}The main issue is A.hot and A.cold have separate CFGs, thus jump tabletargets are still constrained within fragment bounds.Future improvements:A.hot = {X, Y, Z}A.cold = {X, Y, Z}Reviewed By: AmirDifferential Revision: https://reviews.llvm.org/D127924
[BOLT][AARCH64] Skip R_AARCH64_LD_PREL_LO19 relocationSupress failed to analyze relocations warning for R_AARCH64_LD_PREL_LO19relocation. This relocation is mostly used to get value stored in CI a
[BOLT][AARCH64] Skip R_AARCH64_LD_PREL_LO19 relocationSupress failed to analyze relocations warning for R_AARCH64_LD_PREL_LO19relocation. This relocation is mostly used to get value stored in CI andwe don't process it since we are caluclating target address using theinstruction value in evaluateMemOperandTarget().Differential Revision: https://reviews.llvm.org/D127413
[MC] De-capitalize SwitchSection. NFCAdd SwitchSection to return switchSection. The API will be removed soon.
[BOLT] Mark fragments related to split jump table as non-simpleMark fragments related to split jump table as non-simple.A function could be splitted into hot and cold fragments. A split jump tabl
[BOLT] Mark fragments related to split jump table as non-simpleMark fragments related to split jump table as non-simple.A function could be splitted into hot and cold fragments. A split jump table ischallenging for correctly reconstructing control flow graphs, so it was markedas ignored. This update marks those fragments as non-simple, allowing themto be printed and partial control flow graph construction.Test Plan:```llvm-lit -a tools/bolt/test/X86/split-func-icf.s```This test has two functions (main, main2), each has a jump table target to thesame cold portion main2.cold.1(*2). We try to print out only this cold portion.If it is ignored, it cannot be printed. If it is non-simple, it can be printed. Weverify that it can be printed.Reviewed By: AmirDifferential Revision: https://reviews.llvm.org/D127464
[BOLT]DWARF] Eagerly write out loclistsTaking advantage of us being able to re-write .debug_info to reduce memoryfootprint loclists. Writing out loc-list as they are added, similar to howwe handl
[BOLT]DWARF] Eagerly write out loclistsTaking advantage of us being able to re-write .debug_info to reduce memoryfootprint loclists. Writing out loc-list as they are added, similar to howwe handle ranges.Collected on clang-14trunk4:41.20 real, 389.50 user, 59.50 sys, 0 amem, 38412532 mmem4:30.08 real, 376.10 user, 63.75 sys, 0 amem, 38477844 mmem4:25.58 real, 373.76 user, 54.71 sys, 0 amem, 38439660 mmemdiff4:34.66 real, 392.83 user, 57.73 sys, 0 amem, 38382560 mmem4:35.96 real, 377.70 user, 58.62 sys, 0 amem, 38255840 mmem4:27.61 real, 390.18 user, 57.02 sys, 0 amem, 38223224 mmemReviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D126999
[MC] De-capitalize MCStreamer functionsFollow-up to c031378ce01b8485ba0ef486654bc9393c4ac024 .The class is mostly consistent now.
[bolt] Remove unneeded cl::ZeroOrMore for cl::opt options
Remove unneeded cl::ZeroOrMore for cl::opt optionsSimilar to 557efc9a8b68628c2c944678c6471dac30ed9e8e.This commit handles options where cl::ZeroOrMore is more than one line belowcl::opt.
[BOLT] Cache-Aware Tail DuplicationA new "cache-aware" strategy for tail duplication.Differential Revision: https://reviews.llvm.org/D123050
1234