From: Rosen Penev Date: Sat, 29 Aug 2020 03:17:38 +0000 (-0700) Subject: libcxxabi: add X-Git-Tag: v21.02.0-rc1~1706 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=3f9bd9e8ee609b82a709fc62d42187211dd9804f;p=openwrt%2Fstaging%2Fchunkeey.git libcxxabi: add This will be used for libcxx. libcxxabi is needed as libsupc++ is not good enough for libcxx. It uses GCC specific stuff which causes failed compilation for some packages. There are also runtime issues, most notably with cxxopts where the program just crashes. Reference: https://github.com/gerbera/gerbera/issues/795 Added patch to fix ARM compilation. Signed-off-by: Rosen Penev --- diff --git a/package/libs/libcxxabi/Makefile b/package/libs/libcxxabi/Makefile new file mode 100644 index 0000000000..90547561b2 --- /dev/null +++ b/package/libs/libcxxabi/Makefile @@ -0,0 +1,71 @@ + +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libcxxabi +PKG_VERSION:=10.0.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz +PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION) +PKG_HASH:=e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).src + +PKG_MAINTAINER:=Rosen Penev +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.txt + +PKG_BUILD_PARALLEL:=1 +CMAKE_BINARY_SUBDIR:=build + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/libcxxabi + SECTION:=libs + CATEGORY:=Libraries + TITLE:=LLVM lib++abi + URL:=https://libcxxabi.llvm.org/ + DEPENDS:=+libpthread + BUILDONLY:=1 +endef + +define Package/libcxxabi/description + libc++abi is a new implementation of low level support for a standard C++ library. +endef + +CMAKE_OPTIONS += \ + -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \ + -DLIBCXXABI_ENABLE_PEDANTIC=OFF \ + -DLIBCXXABI_ENABLE_PIC=ON \ + -DLIBCXXABI_ENABLE_WERROR=OFF \ + -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \ + -DLIBCXXABI_USE_COMPILER_RT=OFF \ + -DLIBCXXABI_ENABLE_THREADS=ON \ + -DLIBCXXABI_HAS_PTHREAD_API=ON \ + -DLIBCXXABI_INCLUDE_TESTS=OFF \ + -DLIBCXXABI_LIBDIR_SUFFIX="" \ + -DLIBCXXABI_INSTALL_LIBRARY=ON \ + -DLIBCXXABI_ENABLE_SHARED=OFF \ + -DLIBCXXABI_LIBCXX_SRC_DIR=$(BUILD_DIR)/libcxx-$(PKG_VERSION).src \ + -DLIBCXXABI_LIBCXX_INCLUDES=$(BUILD_DIR)/libcxx-$(PKG_VERSION).src/include + +TARGET_CXXFLAGS += -flto +TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed + +define Build/Prepare + $(MAKE) -C $(TOPDIR)/package/libs/libcxx prepare + $(call Build/Prepare/Default) +endef + +define Build/InstallDev + $(call Build/InstallDev/cmake,$(1)) + $(INSTALL_DIR) $(1)/usr/include/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/include/ +endef + +$(eval $(call BuildPackage,libcxxabi)) diff --git a/package/libs/libcxxabi/patches/010-arm.patch b/package/libs/libcxxabi/patches/010-arm.patch new file mode 100644 index 0000000000..b14609dc62 --- /dev/null +++ b/package/libs/libcxxabi/patches/010-arm.patch @@ -0,0 +1,27 @@ +--- a/src/cxa_exception.h ++++ b/src/cxa_exception.h +@@ -27,6 +27,13 @@ _LIBCXXABI_HIDDEN uint64_t __getExceptio + _LIBCXXABI_HIDDEN void __setExceptionClass ( _Unwind_Exception*, uint64_t); + _LIBCXXABI_HIDDEN bool __isOurExceptionClass(const _Unwind_Exception*); + ++#if defined(__arm__) && defined(__GNUC__) ++// missing values from _Unwind_Reason_Code enum ++#define _URC_FATAL_PHASE2_ERROR ((_Unwind_Reason_Code)2) ++#define _URC_FATAL_PHASE1_ERROR ((_Unwind_Reason_Code)3) ++#define _URC_NORMAL_STOP ((_Unwind_Reason_Code)4) ++#endif ++ + struct _LIBCXXABI_HIDDEN __cxa_exception { + #if defined(__LP64__) || defined(_WIN64) || defined(_LIBCXXABI_ARM_EHABI) + // Now _Unwind_Exception is marked with __attribute__((aligned)), +--- a/src/cxa_personality.cpp ++++ b/src/cxa_personality.cpp +@@ -1108,7 +1108,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) {