[llvm] [BOLT][binary-analysis] Fix pac-ret scanner's "major limitation" (PR #136664)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 02:15:01 PDT 2025


Gergely =?utf-8?q?Bálint?=,Gergely Balint <gergely.balint at arm.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/136664 at github.com>


================
@@ -634,10 +634,10 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
       // DW_CFA_GNU_window_save and DW_CFA_GNU_NegateRAState just use the same
       // id but mean different things. The latter is used in AArch64.
       if (Function.getBinaryContext().isAArch64()) {
-        // .cfi_negate_ra_state is only needed for tools producing binaries (so
-        // BOLT itself). Other BOLT-based tools (perf2bolt, merge-fdata,
-        // llvm-bolt-binary-analysis, etc.) can safely drop this CFI.
-        if (getToolName() == "llvm-bolt") {
+        // llvm-bolt-binary-analysis does not need this CFI, as it is not
+        // producing a binary. For all other tools, we should refuse processing
+        // the binary, until PAC support is added.
+        if (!opts::BinaryAnalysisMode) {
----------------
paschalis-mpeis wrote:

Probably better to add `HeatmapMode` here as well?

In theory one could use `llvm-heatmap` tool on any binary, possibly even after applying some other pgo/post-link tools.

https://github.com/llvm/llvm-project/pull/136664


More information about the llvm-commits mailing list