mirror-llvm-project/bolt/unittests/Core
Jinjie Huang 82488f0e71
[BOLT] Fix pwrite assertion failure via a new safePWrite wrapper (#198569)
Background: Currently, BOLT seems to implicitly assume that the .dynsym
section is located at a low offset within the binary, calling pwrite()
directly to update it.

Issue: In scenarios where the binary has been modified by tools like
patchelf, sections like .dynsym may be moved to a high offset area. This
can lead to a violation of the Offset + Size <= Pos assertion in
pwrite(). A typical scenario is when the previous eh_frame_header update
moves the stream cursor (pos) back to a low
offset([code](https://github.com/llvm/llvm-project/blob/llvmorg-23-init/bolt/lib/Rewrite/RewriteInstance.cpp#L6387)).

Fix: This patch resolves the pwrite assertion failure via a new
safePWrite wrapper, which introduces a defensive check that verifies and
conditionally adjusts the stream position. A corresponding test case has
also been added.
2026-07-24 19:55:26 +08:00
..
BinaryContext.cpp [BOLT] Fix pwrite assertion failure via a new safePWrite wrapper (#198569) 2026-07-24 19:55:26 +08:00
ClusteredRows.cpp
CMakeLists.txt Revert "[BOLT][AArch64] Transform cmpbr ~> cmp + br when inversion not possible (#185731)" (#202309) 2026-06-08 11:24:03 +01:00
DynoStats.cpp
MCPlusBuilder.cpp Revert "[BOLT][AArch64] Transform cmpbr ~> cmp + br when inversion not possible (#185731)" (#202309) 2026-06-08 11:24:03 +01:00
MemoryMaps.cpp [BOLT] Add pre-parsed perf script support (#163785) 2026-06-04 15:20:20 +02:00