<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55005>55005</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
BOLT fails to instrument clang on AArch64 host
</td>
</tr>
<tr>
<th>Labels</th>
<td>
BOLT
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nathanchance
</td>
</tr>
</table>
<pre>
I am not sure if this issue is a bug or more of a "not expected to work yet" issue, as I recall seeing somewhere that BOLT instrumentation was only supported for x86_64 but I did not get an immediate error and I see `AArch64` throughout `bolt/` so I figured I would report it and let someone close it if it is a known issue.
On an AArch64 host (the one I tested on uses an Ampere Altra Q80-30), `llvm-bolt` fails to instrument `clang`. My reproduction steps at cfb8169059c807ed5fbfb66b3ed558b7b6eb2833:
```
$ cmake \
-B build/stage1 \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-q \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_PROJECTS="clang;bolt" \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_USE_LINKER=/usr/bin/ld.lld \
-S llvm
$ ninja -C build/stage1 clang llvm-bolt
$ build/stage1/bin/llvm-bolt \
--instrument \
--instrumentation-file=$PWD/build/clang.fdata \
-o build/stage1/bin/clang.inst \
build/stage1/bin/clang-15
BOLT-INFO: Target architecture: aarch64
BOLT-INFO: BOLT version: cfb8169059c807ed5fbfb66b3ed558b7b6eb2833
BOLT-INFO: first alloc address is 0x200000
BOLT-INFO: creating new program header table at address 0x5000000, offset 0x4e00000
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-INFO: disabling -align-macro-fusion on non-x86 platform
=======================================
BOLT is unable to proceed because it couldn't properly understand this function.
If you are running the most recent version of BOLT, you may want to report this and paste this dump.
Please check that there is no sensitive contents being shared in this dump.
Offending function: __do_global_dtors_aux/1
Function contents (
0000: 3F2303D5 FD7BBEA9 FD030091 F30B00F9 |?#...{..........|
0010: B3CF0190 60824739 80000035 DDFFFF97 |....`.G9...5....|
0020: 20008052 60820739 F30B40F9 FD7BC2A8 | ..R`..9..@..{..|
0030: BF2303D5 C0035FD6 1F2003D5 1F2003D5 |.#...._.. ... ..|
)
Binary Function "__do_global_dtors_aux/1" {
Number : 7
State : disassembled
Address : 0x13cc550
Size : 0x38
MaxSize : 0x40
Offset : 0x11bc550
Section : .text
Orc Section : .local.text.__do_global_dtors_aux/1
LSDA : 0x0
IsSimple : 1
IsMultiEntry: 0
IsSplit : 0
BB Count : 0
}
.LBB06:
00000000: hint #25
00000004: stp x29, x30, [sp, #-0x20]!
00000008: mov x29, sp
0000000c: str x19, [sp, #0x10]
00000010: adrp x19, "completed.0/1"
00000014: ldrb w0, [x19, :lo12:"completed.0/1"]
00000018: cbnz w0, .Ltmp4 # Offset: 24
0000001c: bl "deregister_tm_clones/1" # Offset: 28
00000020: mov w0, #0x1
00000024: strb w0, [x19, :lo12:"completed.0/1"]
.Ltmp4:
00000028: ldr x19, [sp, #0x10]
0000002c: ldp x29, x30, [sp], #0x20
00000030: hint #29
00000034: ret x30 # Offset: 52
DWARF CFI Instructions:
<empty>
End of Function "__do_global_dtors_aux/1"
ERROR: unable to fill CFI.
=======================================
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFV91z4jgS_2ucFxUu-QvwAw8Y8BS3JGRJ9mb2iZJtGTwjS5wtT8j-9dct20CA7O7VPayLOLa7-9ef6pYSlb1PloSVRCpN6qbipMiJ3hc1Keq6gbeaMJI0O6IqUiogqxw-WK6L_Px44KnmGdGKvKnqB3nnGkitqOXOCKvJklQ8ZUKQmvNC7kitSv6254Ck90yTaL16JYWsddWUXGqmCyXJG8gpKd7BoMNBVaghB_3H8XA79MEaDahZk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