From 7abb703a829f59e12fcaaa5c832c6e27aed0587c Mon Sep 17 00:00:00 2001 From: jca Date: Mon, 3 Nov 2025 18:33:06 +0000 Subject: [PATCH] Backout previous, the reintroduced code leads to a missing symbol regress: cc -Wl,--export-dynamic -o t_backtrace t_backtrace.o atf-c.o -lexecinfo ld: error: undefined reference: operator new(unsigned long) >>> referenced by /usr/lib/libexecinfo.so.4.0 (disallowed by --no-allow-shlib-undefined) ok tb@ --- gnu/llvm/libunwind/src/AddressSpace.hpp | 57 ------------------------- gnu/llvm/libunwind/src/UnwindCursor.hpp | 11 +---- gnu/llvm/libunwind/src/assembly.h | 2 +- 3 files changed, 2 insertions(+), 68 deletions(-) diff --git a/gnu/llvm/libunwind/src/AddressSpace.hpp b/gnu/llvm/libunwind/src/AddressSpace.hpp index 12ca6351337..5551c7d4bef 100644 --- a/gnu/llvm/libunwind/src/AddressSpace.hpp +++ b/gnu/llvm/libunwind/src/AddressSpace.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include "libunwind.h" #include "config.h" @@ -153,62 +152,6 @@ struct UnwindInfoSections { #endif }; -class UnwindInfoSectionsCache { -public: - - struct CacheItem { - CacheItem(UnwindInfoSections &uis, uintptr_t pc) - : m_uis(uis), m_pc(pc) { - } - CacheItem(uintptr_t pc) - : m_pc(pc) { - } - - UnwindInfoSections m_uis; - uintptr_t m_pc; - - RB_ENTRY(CacheItem) entry; - }; - - typedef uintptr_t CacheItemKey; - - int CacheCmp(struct CacheItem *c1, struct CacheItem *c2) { - return (c1->m_pc < c2->m_pc ? -1 : c1->m_pc > c2->m_pc); - } - - UnwindInfoSectionsCache() { - m_head = RB_INITIALIZER(&head); - } - - bool getUnwindInfoSectionsForPC(CacheItemKey key, UnwindInfoSections &uis) { - UnwindInfoSections *result = nullptr; - if (m_prev_req_item && m_prev_req_item->m_pc == key) - result = &m_prev_req_item->m_uis; - else { - struct CacheItem find(key), *res; - res = RB_FIND(CacheTree, &m_head, &find); - if (res) { - m_prev_req_item = res; - result = &res->m_uis; - } - } - if (result) { - uis = *result; - return true; - } - return false; - } - - void setUnwindInfoSectionsForPC(CacheItemKey key, UnwindInfoSections &uis) { - CacheItem *p_item(new CacheItem(uis, key)); - RB_INSERT(CacheTree, &m_head, p_item); - } - -private: - CacheItem *m_prev_req_item = nullptr; - RB_HEAD(CacheTree, CacheItem) m_head; - RB_GENERATE(CacheTree, CacheItem, entry, CacheCmp); -}; /// LocalAddressSpace is used as a template parameter to UnwindCursor when /// unwinding a thread in the same process. The wrappers compile away, diff --git a/gnu/llvm/libunwind/src/UnwindCursor.hpp b/gnu/llvm/libunwind/src/UnwindCursor.hpp index 6f6165fdd2b..06e65419735 100644 --- a/gnu/llvm/libunwind/src/UnwindCursor.hpp +++ b/gnu/llvm/libunwind/src/UnwindCursor.hpp @@ -90,8 +90,6 @@ extern "C" _Unwind_Reason_Code __libunwind_seh_personality( namespace libunwind { -static thread_local UnwindInfoSectionsCache uwis_cache; - #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) /// Cache of recently found FDEs. template @@ -2602,14 +2600,7 @@ void UnwindCursor::setInfoBasedOnIPRegister(bool isReturnAddress) { // Ask address space object to find unwind sections for this pc. UnwindInfoSections sects; - bool have_sects = false; - if (uwis_cache.getUnwindInfoSectionsForPC(pc, sects)) - have_sects = true; - else if (_addressSpace.findUnwindSections(pc, sects)) { - uwis_cache.setUnwindInfoSectionsForPC(pc, sects); - have_sects = true; - } - if (have_sects) { + if (_addressSpace.findUnwindSections(pc, sects)) { #if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) // If there is a compact unwind encoding table, look there first. if (sects.compact_unwind_section != 0) { diff --git a/gnu/llvm/libunwind/src/assembly.h b/gnu/llvm/libunwind/src/assembly.h index f0fcd006f20..f8e83e138ef 100644 --- a/gnu/llvm/libunwind/src/assembly.h +++ b/gnu/llvm/libunwind/src/assembly.h @@ -15,7 +15,7 @@ #ifndef UNWIND_ASSEMBLY_H #define UNWIND_ASSEMBLY_H -#if defined(__CET__) +#if defined(__linux__) && defined(__CET__) #include #define _LIBUNWIND_CET_ENDBR _CET_ENDBR #else