2021-08-19 11:11:50 +02:00
|
|
|
############################################################################
|
|
|
|
# libs/libxx/libcxxabi.defs
|
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
2023-01-22 23:08:00 +01:00
|
|
|
LIBCXXABI_VERSION=$(patsubst "%",%,$(CONFIG_LIBCXXABI_VERSION))
|
2021-08-19 11:11:50 +02:00
|
|
|
|
2024-03-08 05:45:04 +01:00
|
|
|
# Download and unpack tarball if no git repo found
|
|
|
|
ifeq ($(wildcard libcxxabi/.git),)
|
2021-08-30 05:48:56 +02:00
|
|
|
libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz:
|
2023-03-07 17:17:54 +01:00
|
|
|
$(call DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXXABI_VERSION),libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz)
|
2021-08-19 11:11:50 +02:00
|
|
|
|
2021-08-30 05:48:56 +02:00
|
|
|
libcxxabi: libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
|
|
|
|
$(Q) tar -xf libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
|
|
|
|
$(Q) mv libcxxabi-$(LIBCXXABI_VERSION).src libcxxabi
|
2024-08-23 12:21:29 +02:00
|
|
|
$(Q) patch -p0 < 0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch
|
|
|
|
$(Q) patch -p0 < 0002-libcxxabi-fix-compilation-errors.patch
|
2021-08-19 11:11:50 +02:00
|
|
|
$(Q) touch $@
|
2024-03-08 05:45:04 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
$(TOPDIR)/include/libcxxabi: libcxxabi
|
|
|
|
$(Q) $(DIRLINK) $(CURDIR)/libcxxabi/include $(TOPDIR)/include/libcxxabi
|
|
|
|
$(Q) cp $(CURDIR)/__config_site $(TOPDIR)/include/libcxxabi/__config_site
|
|
|
|
|
|
|
|
context:: $(TOPDIR)/include/libcxxabi
|
2021-08-19 11:11:50 +02:00
|
|
|
|
|
|
|
distclean::
|
2024-03-08 05:45:04 +01:00
|
|
|
$(Q) $(DIRUNLINK) $(TOPDIR)/include/libcxxabi
|
|
|
|
ifeq ($(wildcard libcxxabi/.git),)
|
|
|
|
$(Q) $(DELFILE) libcxxabi-$(LIBCXX_VERSION).src.tar.xz
|
2021-08-19 11:11:50 +02:00
|
|
|
$(call DELDIR, libcxxabi)
|
2022-08-27 18:21:40 +02:00
|
|
|
endif
|
2021-08-19 11:11:50 +02:00
|
|
|
|
2021-08-30 06:09:08 +02:00
|
|
|
ifeq ($(CONFIG_LIBCXXABI), y)
|
2022-11-01 14:47:53 +01:00
|
|
|
CXXFLAGS += ${DEFINE_PREFIX}LIBCXX_BUILDING_LIBCXXABI
|
2021-08-30 06:09:08 +02:00
|
|
|
CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/include
|
2024-05-28 14:18:18 +02:00
|
|
|
|
|
|
|
# Disable dynamic type checking when enabling libcxxabi
|
|
|
|
# It results in a recursive call:
|
|
|
|
# cxxabiv1::__dynamic_case -> is_equal -> __ubsan::checkDynamic -> cxxabiv1::__dynamic_case
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_SIM_UBSAN)${CONFIG_MM_UBSAN},)
|
|
|
|
CXXFLAGS += -fno-sanitize=vptr
|
|
|
|
endif
|
2021-08-30 06:09:08 +02:00
|
|
|
endif
|
|
|
|
|
2021-08-19 11:11:50 +02:00
|
|
|
# C++ABI files
|
|
|
|
CPPSRCS += cxa_aux_runtime.cpp cxa_default_handlers.cpp cxa_demangle.cpp cxa_exception_storage.cpp
|
|
|
|
CPPSRCS += cxa_guard.cpp cxa_handlers.cpp cxa_thread_atexit.cpp cxa_vector.cpp cxa_virtual.cpp
|
|
|
|
# C++ STL files
|
|
|
|
CPPSRCS += stdlib_exception.cpp stdlib_new_delete.cpp stdlib_stdexcept.cpp stdlib_typeinfo.cpp
|
|
|
|
# Internal files
|
|
|
|
CPPSRCS += abort_message.cpp fallback_malloc.cpp private_typeinfo.cpp
|
|
|
|
|
2024-07-05 09:25:54 +02:00
|
|
|
# Always compile libcxxabi with exception
|
2021-08-19 11:11:50 +02:00
|
|
|
CPPSRCS += cxa_exception.cpp cxa_personality.cpp
|
2024-07-05 09:25:54 +02:00
|
|
|
CXXFLAGS += -fexceptions
|
|
|
|
|
|
|
|
# Fix compilation error on ARM32:
|
|
|
|
# libcxxabi/src/cxa_personality.cpp:594:22: error: '_URC_FATAL_PHASE1_ERROR' was not declared in this scope
|
|
|
|
# 594 | results.reason = _URC_FATAL_PHASE1_ERROR;
|
|
|
|
ifeq ($(CONFIG_ARCH_ARM),y)
|
|
|
|
CXXFLAGS += -D_URC_FATAL_PHASE2_ERROR=_URC_FAILURE -D_URC_FATAL_PHASE1_ERROR=_URC_FAILURE
|
2021-08-19 11:11:50 +02:00
|
|
|
endif
|
|
|
|
|
2021-08-31 19:47:13 +02:00
|
|
|
# RTTI is required for building the libcxxabi library
|
|
|
|
CXXFLAGS += -frtti
|
|
|
|
|
2021-08-19 11:11:50 +02:00
|
|
|
DEPPATH += --dep-path libcxxabi/src
|
|
|
|
VPATH += libcxxabi/src
|