[llvm] [BOLT] Fix EH data encoding checks in relocateEHFrameSection (PR #196777)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 9 22:08:08 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: YongKang Zhu (yozhu)

<details>
<summary>Changes</summary>

Previously committed in 7ab26d7c3a16 (#<!-- -->195691) and later reverted
in bc654b438ffe (#<!-- -->196672) due to failures extended bolt-tests.

The problem was that the mask should be `0x70` instead of `0xf0`,
so to allow `DW_EH_PE_indirect` to pass through.

---
Full diff: https://github.com/llvm/llvm-project/pull/196777.diff


1 Files Affected:

- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+4-7) 


``````````diff
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 43d4421e06928..9d70c87a7a8f5 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -2162,13 +2162,10 @@ void RewriteInstance::relocateEHFrameSection() {
       return;
 
     // Only fix references that are relative to other locations.
-    if (!(DwarfType & dwarf::DW_EH_PE_pcrel) &&
-        !(DwarfType & dwarf::DW_EH_PE_textrel) &&
-        !(DwarfType & dwarf::DW_EH_PE_funcrel) &&
-        !(DwarfType & dwarf::DW_EH_PE_datarel))
-      return;
-
-    if (!(DwarfType & dwarf::DW_EH_PE_sdata4))
+    if ((DwarfType & 0x70) != dwarf::DW_EH_PE_pcrel &&
+        (DwarfType & 0x70) != dwarf::DW_EH_PE_textrel &&
+        (DwarfType & 0x70) != dwarf::DW_EH_PE_funcrel &&
+        (DwarfType & 0x70) != dwarf::DW_EH_PE_datarel)
       return;
 
     uint32_t RelType;

``````````

</details>


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


More information about the llvm-commits mailing list