[llvm] [BOLT][docs] Document commands to identify BOLT-ed binaries (PR #171458)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 08:38:14 PST 2025


https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/171458

>From 321c3cef31508b06276b9fd0524724d89200e57f Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 15:39:22 +0000
Subject: [PATCH 1/2] [BOLT][docs] Add commands to identify BOLT-ed binaries

These have been useful to me in the past and I don't see
any docs referencing the `bolt_info` note either.

There is a test checking that it is emitted, so I assume
it's something we are ok with people looking for.
---
 bolt/README.md | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/bolt/README.md b/bolt/README.md
index 55f742c5019f5..3544f58e0d580 100644
--- a/bolt/README.md
+++ b/bolt/README.md
@@ -202,6 +202,27 @@ $ merge-fdata *.fdata > combined.fdata
 Use `combined.fdata` for **Step 3** above to generate a universally optimized
 binary.
 
+## Identifying a Binary Modified By BOLT
+
+A binary that has been modified by BOLT will include a `bolt_info` note and may
+have extra sections with `bolt` in their name.
+
+You can use `readelf` to find these:
+```
+$ llvm-readelf -S <your-binary> | grep bolt
+  [11] .bolt.org.eh_frame PROGBITS <...>
+<...>
+  [39] .note.bolt_info   NOTE <...>
+```
+The note can be displayed with:
+```
+$ llvm-readelf -n <your-binary>
+<...>
+Displaying notes found in: .note.bolt_info
+  <...>
+    Version: BOLT revision: <...>
+```
+
 ## License
 
 BOLT is licensed under the [Apache License v2.0 with LLVM Exceptions](./LICENSE.TXT).

>From b188da1ef04a163ef073c4f71ccfc8c8ef3fc698 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 9 Dec 2025 15:45:55 +0000
Subject: [PATCH 2/2] Use readelf only. Anyone who knows what llvm-readelf is
 can figure that out themselves.

---
 bolt/README.md | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/bolt/README.md b/bolt/README.md
index 3544f58e0d580..2e35cf8a8a986 100644
--- a/bolt/README.md
+++ b/bolt/README.md
@@ -209,18 +209,17 @@ have extra sections with `bolt` in their name.
 
 You can use `readelf` to find these:
 ```
-$ llvm-readelf -S <your-binary> | grep bolt
+$ readelf -S <your-binary> | grep bolt
   [11] .bolt.org.eh_frame PROGBITS <...>
 <...>
   [39] .note.bolt_info   NOTE <...>
 ```
 The note can be displayed with:
 ```
-$ llvm-readelf -n <your-binary>
-<...>
-Displaying notes found in: .note.bolt_info
+$ readelf -p .note.bolt_info <your-binary>
+String dump of section '.note.bolt_info':
   <...>
-    Version: BOLT revision: <...>
+  [    10]  BOLT revision: <...>
 ```
 
 ## License



More information about the llvm-commits mailing list