Skip to content

Commit 9148b29

Browse files
committed
work around a bug where clang reports a template function as unused
1 parent 6e33c11 commit 9148b29

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

libunwind/src/DwarfParser.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ namespace {
322322
// This helper function handles setting the manually signed personality on
323323
// CIE_Info without attempt to authenticate and/or re-sign
324324
template <typename CIE_Info, typename T>
325-
void set_cie_info_personality(CIE_Info *info, T signed_personality) {
325+
[[maybe_unused]] void set_cie_info_personality(CIE_Info *info,
326+
T signed_personality) {
326327
static_assert(sizeof(info->personality) == sizeof(signed_personality),
327328
"Signed personality is the wrong size");
328329
memmove((void *)&info->personality, (void *)&signed_personality,

libunwind/src/libunwind.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
129129
// First, get the FDE for the old location and then update it.
130130
co->getInfo(&info);
131131

132+
pint_t sp = (pint_t)co->getReg(UNW_REG_SP);
133+
132134
#if __has_feature(ptrauth_calls)
133135
// It is only valid to set the IP within the current function.
134136
// This is important for ptrauth, otherwise the IP cannot be correctly
@@ -137,8 +139,6 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
137139
(unw_word_t)ptrauth_strip((void *)value, ptrauth_key_return_address);
138140
assert(stripped_value >= info.start_ip && stripped_value <= info.end_ip);
139141

140-
pint_t sp = (pint_t)co->getReg(UNW_REG_SP);
141-
142142
{
143143
// PC should have been signed with the sp, so we verify that
144144
// roundtripping does not fail.
@@ -162,7 +162,7 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
162162
// this should actually be - info.gp. LLVM doesn't currently support
163163
// any such platforms and Clang doesn't export a macro for them.
164164
if (info.gp)
165-
co->setReg(UNW_REG_SP, co->getReg(UNW_REG_SP) + info.gp);
165+
co->setReg(UNW_REG_SP, sp + info.gp);
166166
co->setReg(UNW_REG_IP, value);
167167
co->setInfoBasedOnIPRegister(false);
168168
} else {

0 commit comments

Comments
 (0)