From 6d39b248a46aabd584772929c850391899ae286b Mon Sep 17 00:00:00 2001 From: yinshengkai Date: Fri, 23 Aug 2024 18:21:29 +0800 Subject: [PATCH] libcxxabi: fix compilation warnings Signed-off-by: yinshengkai --- ...ild-warnings-generated-by-CMake-comp.patch | 41 +++++++++++++++++++ ...002-libcxxabi-fix-compilation-errors.patch | 33 +++++++++++++++ libs/libxx/libcxxabi.defs | 2 + 3 files changed, 76 insertions(+) create mode 100644 libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch create mode 100644 libs/libxx/0002-libcxxabi-fix-compilation-errors.patch diff --git a/libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch b/libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch new file mode 100644 index 0000000000..679dd8dbfe --- /dev/null +++ b/libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch @@ -0,0 +1,41 @@ +From df7ad61eb3ce52ebf864f30ec3ad1a6ccea74730 Mon Sep 17 00:00:00 2001 +From: cuiziwei +Date: Thu, 23 May 2024 11:11:30 +0800 +libcxxabi:Fix build warnings generated by CMake + compilation. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +VELAPLATFO-32782 + +nuttx/libs/libxx/libcxxabi/src/cxa_personality.cpp: In function ‘void __cxxabiv1::__cxa_call_unexpected(void*)’: +nuttx/libs/libxx/libcxxabi/src/cxa_personality.cpp:1250:46: warning: ‘ttypeIndex’ may be used uninitialized [-Wmaybe-uninitialized] + 1250 | if (!exception_spec_can_catch(ttypeIndex, classInfo, ttypeEncoding, + | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1251 | excpType, adjustedPtr, + | ~~~~~~~~~~~~~~~~~~~~~~ + 1252 | unwind_exception, base)) + +Change-Id: Ic114508ecdad7cc84e7ad997a9379e50b2efd2a5 +Signed-off-by: cuiziwei +--- + src/cxa_personality.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git libcxxabi/src/cxa_personality.cpp libcxxabi/src/cxa_personality.cpp +index b28c58d..5b58037 100644 +--- libcxxabi/src/cxa_personality.cpp ++++ libcxxabi/src/cxa_personality.cpp +@@ -1174,7 +1174,7 @@ __cxa_call_unexpected(void* arg) + std::unexpected_handler u_handler; + std::terminate_handler t_handler; + __cxa_exception* old_exception_header = 0; +- int64_t ttypeIndex; ++ int64_t ttypeIndex = 0; + const uint8_t* lsda; + uintptr_t base = 0; + +-- +2.34.1 + diff --git a/libs/libxx/0002-libcxxabi-fix-compilation-errors.patch b/libs/libxx/0002-libcxxabi-fix-compilation-errors.patch new file mode 100644 index 0000000000..383541331e --- /dev/null +++ b/libs/libxx/0002-libcxxabi-fix-compilation-errors.patch @@ -0,0 +1,33 @@ +From b84bcf890c949d248ade97a5e1fbcf2a8e3efcd7 Mon Sep 17 00:00:00 2001 +From: yinshengkai +Date: Fri, 5 Jul 2024 16:59:49 +0800 +libcxxabi: fix compilation errors + +error: invalid conversion from 'int' to '_Unwind_State' [-fpermissive] + 1073 | state &= ~_US_FORCE_UNWIND; + | ~~~~~~^~~~~~~~~~~~~~~~~~~~ + | | + | int + +Change-Id: I47827d58438f248e2171d20a44cc29ed8b259fc5 +Signed-off-by: yinshengkai +--- + src/cxa_personality.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git libcxxabi/src/cxa_personality.cpp libcxxabi/src/cxa_personality.cpp +index 5b58037..3e1fd83 100644 +--- libcxxabi/src/cxa_personality.cpp ++++ libcxxabi/src/cxa_personality.cpp +@@ -1070,7 +1070,7 @@ __gxx_personality_v0(_Unwind_State state, + + // Check the undocumented force unwinding behavior + bool is_force_unwinding = state & _US_FORCE_UNWIND; +- state &= ~_US_FORCE_UNWIND; ++ state = (_Unwind_State)(state & ~_US_FORCE_UNWIND); + + scan_results results; + switch (state) { +-- +2.34.1 + diff --git a/libs/libxx/libcxxabi.defs b/libs/libxx/libcxxabi.defs index 40f95afc72..63d780a936 100644 --- a/libs/libxx/libcxxabi.defs +++ b/libs/libxx/libcxxabi.defs @@ -28,6 +28,8 @@ libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz: libcxxabi: libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz $(Q) tar -xf libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz $(Q) mv libcxxabi-$(LIBCXXABI_VERSION).src libcxxabi + $(Q) patch -p0 < 0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch + $(Q) patch -p0 < 0002-libcxxabi-fix-compilation-errors.patch $(Q) touch $@ endif