mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-02 16:00:30 +00:00
third_party: Add libunwind (#1053)
Added libunwind from LLVM 17.0.6. The library includes functions required for C++ exception handling.
This commit is contained in:
parent
91de6f1f5d
commit
b09096691a
29 changed files with 17372 additions and 0 deletions
50
third_party/libunwind/Unwind-EHABI.h
vendored
Normal file
50
third_party/libunwind/Unwind-EHABI.h
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __UNWIND_EHABI_H__
|
||||
#define __UNWIND_EHABI_H__
|
||||
|
||||
#include "third_party/libunwind/include/__libunwind_config.h"
|
||||
|
||||
#if defined(_LIBUNWIND_ARM_EHABI)
|
||||
|
||||
#include "libc/isystem/stdint.h"
|
||||
#include "third_party/libunwind/include/unwind.h"
|
||||
|
||||
// Unable to unwind in the ARM index table (section 5 EHABI).
|
||||
#define UNW_EXIDX_CANTUNWIND 0x1
|
||||
|
||||
static inline uint32_t signExtendPrel31(uint32_t data) {
|
||||
return data | ((data & 0x40000000u) << 1);
|
||||
}
|
||||
|
||||
static inline uint32_t readPrel31(const uint32_t *data) {
|
||||
return (((uint32_t)(uintptr_t)data) + signExtendPrel31(*data));
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr0(
|
||||
_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
|
||||
|
||||
extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr1(
|
||||
_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
|
||||
|
||||
extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr2(
|
||||
_Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // defined(_LIBUNWIND_ARM_EHABI)
|
||||
|
||||
#endif // __UNWIND_EHABI_H__
|
Loading…
Add table
Add a link
Reference in a new issue