Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/coreclr/nativeaot/Runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ else()
include_directories($ENV{EMSCRIPTEN/system/lib/libcxxabi/include})
endif()

# Disable building _Unwind_XXX style APIs of libunwind, since we don't use them.
add_definitions(-D_LIBUNWIND_DISABLE_ZERO_COST_APIS=1)

# Compile unwinding only for the current compilation target architecture
add_definitions(-D_LIBUNWIND_IS_NATIVE_ONLY)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ UnixNativeCodeManager::UnixNativeCodeManager(TADDR moduleBase,
m_pClasslibFunctions(pClasslibFunctions), m_nClasslibFunctions(nClasslibFunctions)
{
// Cache the location of unwind sections
libunwind::LocalAddressSpace::sThisAddressSpace.findUnwindSections(
UnwindHelpers::FindUnwindSections(
(uintptr_t)pvManagedCodeStartRange, m_UnwindInfoSections);
}

Expand Down
48 changes: 48 additions & 0 deletions src/coreclr/nativeaot/Runtime/unix/UnwindHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,49 @@ using libunwind::UnwindInfoSections;

LocalAddressSpace _addressSpace;

// Debug logging hooks referenced by libunwind's config.h when NDEBUG is not
// defined. These were previously in libunwind.cpp which is no longer compiled.
#ifndef NDEBUG
#include <stdlib.h>

extern "C" {

_LIBUNWIND_HIDDEN
bool logAPIs() {
static bool checked = false;
static bool log = false;
if (!checked) {
log = (getenv("LIBUNWIND_PRINT_APIS") != NULL);
checked = true;
}
return log;
}

_LIBUNWIND_HIDDEN
bool logUnwinding() {
static bool checked = false;
static bool log = false;
if (!checked) {
log = (getenv("LIBUNWIND_PRINT_UNWINDING") != NULL);
checked = true;
}
return log;
}

_LIBUNWIND_HIDDEN
bool logDWARF() {
static bool checked = false;
static bool log = false;
if (!checked) {
log = (getenv("LIBUNWIND_PRINT_DWARF") != NULL);
checked = true;
}
return log;
}

} // extern "C"
#endif // NDEBUG

#ifdef TARGET_AMD64

// Shim that implements methods required by libunwind over REGDISPLAY
Expand Down Expand Up @@ -1396,6 +1439,11 @@ bool UnwindHelpers::GetUnwindProcInfo(PCODE pc, UnwindInfoSections &uwInfoSectio
return true;
}

bool UnwindHelpers::FindUnwindSections(uintptr_t pc, UnwindInfoSections &sections)
{
return _addressSpace.findUnwindSections(pc, sections);
}

#if defined(TARGET_APPLE)
// Apple considers _dyld_find_unwind_sections to be private API that cannot be used
// by apps submitted to App Store and TestFlight, both for iOS-like and macOS platforms.
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/nativeaot/Runtime/unix/UnwindHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ class UnwindHelpers
public:
static bool StepFrame(REGDISPLAY *regs, unw_word_t start_ip, uint32_t format, unw_word_t unwind_info);
static bool GetUnwindProcInfo(PCODE ip, libunwind::UnwindInfoSections &uwInfoSections, unw_proc_info_t *procInfo);
static bool FindUnwindSections(uintptr_t pc, libunwind::UnwindInfoSections &sections);
};
1 change: 0 additions & 1 deletion src/native/external/llvm-libunwind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ endif()

set (LLVM_LIBUNWIND_SOURCES_BASE
src/Unwind-EHABI.cpp
src/libunwind.cpp
)

set(LLVM_LIBUNWIND_ASM_SOURCES_BASE
Expand Down
2 changes: 0 additions & 2 deletions src/native/external/llvm-libunwind/.clang-format

This file was deleted.

Loading
Loading