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

YongKang Zhu via llvm-commits llvm-commits at lists.llvm.org
Sat May 9 22:07:31 PDT 2026


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

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.

>From 3c3d32e03e000ad9dc25d09f5210ecfffa102cdc Mon Sep 17 00:00:00 2001
From: YongKang Zhu <yongzhu at fb.com>
Date: Sat, 9 May 2026 21:46:52 -0700
Subject: [PATCH] [BOLT] Fix EH data encoding checks in relocateEHFrameSection

---
 bolt/lib/Rewrite/RewriteInstance.cpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

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;



More information about the llvm-commits mailing list