Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIPS/libunwind: Use -mfp64 if compiler is FPXX #68521

Merged
merged 1 commit into from
Feb 8, 2024
Merged
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
19 changes: 19 additions & 0 deletions libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
"Specify path to libc++ source.")

include(GNUInstallDirs)
include(CheckSymbolExists)

#===============================================================================
# Setup CMake Options
Expand Down Expand Up @@ -96,6 +97,20 @@ endif()
option(LIBUNWIND_HIDE_SYMBOLS
"Do not export any symbols from the static library." ${LIBUNWIND_DEFAULT_HIDE_SYMBOLS})

# If toolchain is FPXX, we switch to FP64 to save the full FPRs. See:
# https://web.archive.org/web/20180828210612/https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking
check_symbol_exists(__mips_hard_float "" __MIPSHF)
check_symbol_exists(_ABIO32 "" __MIPS_O32)
if (__MIPSHF AND __MIPS_O32)
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/mips_is_fpxx.c
"#if __mips_fpr != 0\n"
"# error\n"
"#endif\n")
try_compile(MIPS_FPABI_FPXX ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/mips_is_fpxx.c
CMAKE_FLAGS -DCMAKE_C_LINK_EXECUTABLE='echo')
endif()

#===============================================================================
# Configure System
#===============================================================================
Expand Down Expand Up @@ -179,6 +194,10 @@ if (WIN32)
add_compile_flags_if_supported(-Wno-dll-attribute-on-redeclaration)
endif()

if (MIPS_FPABI_FPXX)
add_compile_flags(-mfp64)
endif()

# Get feature flags.
# Exceptions
# Catches C++ exceptions only and tells the compiler to assume that extern C
Expand Down
Loading