[libunwind] [libunwind] Fix EH frame handling on illumos. (PR #176988)
Joshua Carp via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 21 19:03:44 PST 2026
================
@@ -424,7 +424,13 @@ static bool checkAddrInSegment(const Elf_Phdr *phdr, size_t image_base,
static bool checkForUnwindInfoSegment(const Elf_Phdr *phdr, size_t image_base,
dl_iterate_cb_data *cbdata) {
#if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX)
+#if defined(PT_SUNW_EH_FRAME) && defined(PT_SUNW_UNWIND)
+ // illumos/Solaris use PT_SUNW_EH_FRAME and PT_SUNW_UNWIND instead of PT_GNU_EH_FRAME.
+ // FreeBSD defines PT_SUNW_UNWIND but not PT_SUNW_EH_FRAME, so check for both.
----------------
jmcarp wrote:
Sorry if I'm misunderstanding, but I think PT_SUNW_EH_FRAME and PT_SUNW_UNWIND refer to different values. From the illumos source:
```
PT_SUNW_UNWIND and PT_SUNW_EH_FRAME perform the same function,
providing access to the .eh_frame_hdr section of the object.
PT_SUNW_UNWIND is the original value, while PT_SUNW_EH_FRAME is
required by the amd64 psABI. The Solaris link-editor (ld) tags output
objects with PT_SUNW_UNWIND, but the Solaris runtime linker (ld.so.1)
will accept and use either value.
#define PT_SUNW_UNWIND 0x6464e550
#define PT_SUNW_EH_FRAME 0x6474e550
#define PT_GNU_EH_FRAME PT_SUNW_EH_FRAME
```
So I think we need to check both values on illumos, and the cmake change wouldn't be enough. I updated the patch to fix the comment. Let me know if I'm missing something.
https://github.com/llvm/llvm-project/pull/176988
More information about the cfe-commits
mailing list