Kconfig files, binfmt/libelf, libs/libc/machin, libs/libxx: Correct libcxx exception handling by introducing the generic config(CXX_EXCEPTION and CXX_LIBSUPCXX)

This commit is contained in:
Xiang Xiao 2019-01-26 11:23:31 -06:00 committed by Gregory Nutt
parent 095e28d45e
commit 38ffb98f1b
8 changed files with 19 additions and 34 deletions

View file

@ -211,8 +211,8 @@ config ARMV7M_OABI_TOOLCHAIN
config ARMV7M_TARGET2_PREL
bool "R_ARM_TARGET2 is PC relative"
default n if !UCLIBCXX_EXCEPTION
default y if UCLIBCXX_EXCEPTION
default n if !CXX_EXCEPTION
default y if CXX_EXCEPTION
depends on ELF
---help---
Perform a PC relative relocation for relocation type R_ARM_TARGET2

View file

@ -42,7 +42,7 @@ config ELF_DUMPBUFFER
config ELF_EXIDX_SECTNAME
string "ELF Section Name for Exception Index"
default ".ARM.exidx"
depends on UCLIBCXX_EXCEPTION
depends on CXX_EXCEPTION
---help---
Set the name string for the exception index section on the ELF modules to
be loaded by the ELF binary loader.

View file

@ -244,7 +244,7 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
int elf_load(FAR struct elf_loadinfo_s *loadinfo)
{
size_t heapsize;
#ifdef CONFIG_UCLIBCXX_EXCEPTION
#ifdef CONFIG_CXX_EXCEPTION
int exidx;
#endif
int ret;
@ -330,7 +330,7 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
}
#endif
#ifdef CONFIG_UCLIBCXX_EXCEPTION
#ifdef CONFIG_CXX_EXCEPTION
exidx = elf_findsection(loadinfo, CONFIG_ELF_EXIDX_SECTNAME);
if (exidx < 0)
{

View file

@ -46,14 +46,6 @@
#include <arch/elf.h>
#include <nuttx/elf.h>
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef CONFIG_UCLIBCXX_EXCEPTION
extern void init_unwind_exidx(Elf32_Addr start, Elf32_Addr end);
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -472,13 +464,3 @@ int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
berr("ERROR: RELA relocation not supported\n");
return -ENOSYS;
}
#ifdef CONFIG_UCLIBCXX_EXCEPTION
int up_init_exidx(Elf32_Addr address, Elf32_Word size)
{
init_unwind_exidx(address, size);
return OK;
}
#endif

View file

@ -30,6 +30,12 @@ config CXX_NEWLONG
C++ library routines because the NuttX size_t might not have
the same underlying type as your toolchain's size_t.
config CXX_EXCEPTION
bool
config CXX_LIBSUPCXX
bool
comment "LLVM C++ Library (libcxx)"
config LIBCXX
@ -45,14 +51,12 @@ if LIBCXX
config LIBCXX_EXCEPTION
bool "Enable Exception Suppport"
default y
config LIBCXX_IOSTREAM_BUFSIZE
int "IO Stream Buffer Size"
default 32
select CXX_EXCEPTION
config LIBCXX_HAVE_LIBSUPCXX
bool "Have libsupc++ (required)"
default y
select CXX_LIBSUPCXX
---help---
Select if your toolchain provides libsupc++. This option is required
at present because the built-in libsupc++ support is incomplete.
@ -74,6 +78,7 @@ if UCLIBCXX
config UCLIBCXX_EXCEPTION
bool "Enable Exception Suppport"
default y
select CXX_EXCEPTION
config UCLIBCXX_IOSTREAM_BUFSIZE
int "IO Stream Buffer Size"
@ -82,6 +87,7 @@ config UCLIBCXX_IOSTREAM_BUFSIZE
config UCLIBCXX_HAVE_LIBSUPCXX
bool "Have libsupc++ (required)"
default y
select CXX_LIBSUPCXX
---help---
Select if your toolchain provides libsupc++. This option is required
at present because the built-in libsupc++ support is incomplete.

View file

@ -47,7 +47,7 @@ ASRCS =
CSRCS =
CXXSRCS = libxx_cxapurevirtual.cxx libxx_eabi_atexit.cxx libxx_cxa_atexit.cxx
ifneq (,$(findstring y,$(CONFIG_UCLIBCXX_EXCEPTION) $(CONFIG_LIBCXX_EXCEPTION)))
ifeq ($(CONFIG_CXX_EXCEPTION),y)
CXXSRCS += libxx__gnu_unwind_find_exidx.cxx
endif
@ -58,10 +58,6 @@ ifeq (,$(findstring y,$(CONFIG_UCLIBCXX) $(CONFIG_LIBCXX)))
CXXSRCS += libxx_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx
CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx
CXXSRCS += libxx_stdthrow.cxx
else
ifeq (,$(findstring y,$(CONFIG_UCLIBCXX_EXCEPTION) $(CONFIG_LIBCXX_EXCEPTION)))
CXXSRCS += libxx_stdthrow.cxx
endif
endif
# uClibc++ doesn't need this file

View file

@ -37,6 +37,7 @@
// Included Files
//***************************************************************************
#include <nuttx/elf.h>
#include "libxx__gnu_unwind_find_exidx.hxx"
//***************************************************************************
@ -84,10 +85,11 @@
extern "C"
{
void init_unwind_exidx(Elf32_Addr start, Elf32_Word size)
int up_init_exidx(Elf32_Addr start, Elf32_Word size)
{
__exidx_start_elf = (__EIT_entry *) start;
__exidx_end_elf = __exidx_start_elf + size;
return 0;
}
_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, int *nrecp)

View file

@ -42,7 +42,6 @@ extern "C"
// Included Files
//***************************************************************************
#include <elf32.h>
#include <unwind.h>
//***************************************************************************