mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
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:
parent
095e28d45e
commit
38ffb98f1b
8 changed files with 19 additions and 34 deletions
|
@ -211,8 +211,8 @@ config ARMV7M_OABI_TOOLCHAIN
|
||||||
|
|
||||||
config ARMV7M_TARGET2_PREL
|
config ARMV7M_TARGET2_PREL
|
||||||
bool "R_ARM_TARGET2 is PC relative"
|
bool "R_ARM_TARGET2 is PC relative"
|
||||||
default n if !UCLIBCXX_EXCEPTION
|
default n if !CXX_EXCEPTION
|
||||||
default y if UCLIBCXX_EXCEPTION
|
default y if CXX_EXCEPTION
|
||||||
depends on ELF
|
depends on ELF
|
||||||
---help---
|
---help---
|
||||||
Perform a PC relative relocation for relocation type R_ARM_TARGET2
|
Perform a PC relative relocation for relocation type R_ARM_TARGET2
|
||||||
|
|
|
@ -42,7 +42,7 @@ config ELF_DUMPBUFFER
|
||||||
config ELF_EXIDX_SECTNAME
|
config ELF_EXIDX_SECTNAME
|
||||||
string "ELF Section Name for Exception Index"
|
string "ELF Section Name for Exception Index"
|
||||||
default ".ARM.exidx"
|
default ".ARM.exidx"
|
||||||
depends on UCLIBCXX_EXCEPTION
|
depends on CXX_EXCEPTION
|
||||||
---help---
|
---help---
|
||||||
Set the name string for the exception index section on the ELF modules to
|
Set the name string for the exception index section on the ELF modules to
|
||||||
be loaded by the ELF binary loader.
|
be loaded by the ELF binary loader.
|
||||||
|
|
|
@ -244,7 +244,7 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
|
||||||
int elf_load(FAR struct elf_loadinfo_s *loadinfo)
|
int elf_load(FAR struct elf_loadinfo_s *loadinfo)
|
||||||
{
|
{
|
||||||
size_t heapsize;
|
size_t heapsize;
|
||||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
#ifdef CONFIG_CXX_EXCEPTION
|
||||||
int exidx;
|
int exidx;
|
||||||
#endif
|
#endif
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -330,7 +330,7 @@ int elf_load(FAR struct elf_loadinfo_s *loadinfo)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
#ifdef CONFIG_CXX_EXCEPTION
|
||||||
exidx = elf_findsection(loadinfo, CONFIG_ELF_EXIDX_SECTNAME);
|
exidx = elf_findsection(loadinfo, CONFIG_ELF_EXIDX_SECTNAME);
|
||||||
if (exidx < 0)
|
if (exidx < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,14 +46,6 @@
|
||||||
#include <arch/elf.h>
|
#include <arch/elf.h>
|
||||||
#include <nuttx/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
|
* 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");
|
berr("ERROR: RELA relocation not supported\n");
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UCLIBCXX_EXCEPTION
|
|
||||||
int up_init_exidx(Elf32_Addr address, Elf32_Word size)
|
|
||||||
{
|
|
||||||
init_unwind_exidx(address, size);
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,12 @@ config CXX_NEWLONG
|
||||||
C++ library routines because the NuttX size_t might not have
|
C++ library routines because the NuttX size_t might not have
|
||||||
the same underlying type as your toolchain's size_t.
|
the same underlying type as your toolchain's size_t.
|
||||||
|
|
||||||
|
config CXX_EXCEPTION
|
||||||
|
bool
|
||||||
|
|
||||||
|
config CXX_LIBSUPCXX
|
||||||
|
bool
|
||||||
|
|
||||||
comment "LLVM C++ Library (libcxx)"
|
comment "LLVM C++ Library (libcxx)"
|
||||||
|
|
||||||
config LIBCXX
|
config LIBCXX
|
||||||
|
@ -45,14 +51,12 @@ if LIBCXX
|
||||||
config LIBCXX_EXCEPTION
|
config LIBCXX_EXCEPTION
|
||||||
bool "Enable Exception Suppport"
|
bool "Enable Exception Suppport"
|
||||||
default y
|
default y
|
||||||
|
select CXX_EXCEPTION
|
||||||
config LIBCXX_IOSTREAM_BUFSIZE
|
|
||||||
int "IO Stream Buffer Size"
|
|
||||||
default 32
|
|
||||||
|
|
||||||
config LIBCXX_HAVE_LIBSUPCXX
|
config LIBCXX_HAVE_LIBSUPCXX
|
||||||
bool "Have libsupc++ (required)"
|
bool "Have libsupc++ (required)"
|
||||||
default y
|
default y
|
||||||
|
select CXX_LIBSUPCXX
|
||||||
---help---
|
---help---
|
||||||
Select if your toolchain provides libsupc++. This option is required
|
Select if your toolchain provides libsupc++. This option is required
|
||||||
at present because the built-in libsupc++ support is incomplete.
|
at present because the built-in libsupc++ support is incomplete.
|
||||||
|
@ -74,6 +78,7 @@ if UCLIBCXX
|
||||||
config UCLIBCXX_EXCEPTION
|
config UCLIBCXX_EXCEPTION
|
||||||
bool "Enable Exception Suppport"
|
bool "Enable Exception Suppport"
|
||||||
default y
|
default y
|
||||||
|
select CXX_EXCEPTION
|
||||||
|
|
||||||
config UCLIBCXX_IOSTREAM_BUFSIZE
|
config UCLIBCXX_IOSTREAM_BUFSIZE
|
||||||
int "IO Stream Buffer Size"
|
int "IO Stream Buffer Size"
|
||||||
|
@ -82,6 +87,7 @@ config UCLIBCXX_IOSTREAM_BUFSIZE
|
||||||
config UCLIBCXX_HAVE_LIBSUPCXX
|
config UCLIBCXX_HAVE_LIBSUPCXX
|
||||||
bool "Have libsupc++ (required)"
|
bool "Have libsupc++ (required)"
|
||||||
default y
|
default y
|
||||||
|
select CXX_LIBSUPCXX
|
||||||
---help---
|
---help---
|
||||||
Select if your toolchain provides libsupc++. This option is required
|
Select if your toolchain provides libsupc++. This option is required
|
||||||
at present because the built-in libsupc++ support is incomplete.
|
at present because the built-in libsupc++ support is incomplete.
|
||||||
|
|
|
@ -47,7 +47,7 @@ ASRCS =
|
||||||
CSRCS =
|
CSRCS =
|
||||||
|
|
||||||
CXXSRCS = libxx_cxapurevirtual.cxx libxx_eabi_atexit.cxx libxx_cxa_atexit.cxx
|
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
|
CXXSRCS += libxx__gnu_unwind_find_exidx.cxx
|
||||||
endif
|
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_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx
|
||||||
CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx
|
CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx
|
||||||
CXXSRCS += libxx_stdthrow.cxx
|
CXXSRCS += libxx_stdthrow.cxx
|
||||||
else
|
|
||||||
ifeq (,$(findstring y,$(CONFIG_UCLIBCXX_EXCEPTION) $(CONFIG_LIBCXX_EXCEPTION)))
|
|
||||||
CXXSRCS += libxx_stdthrow.cxx
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# uClibc++ doesn't need this file
|
# uClibc++ doesn't need this file
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
// Included Files
|
// Included Files
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
|
||||||
|
#include <nuttx/elf.h>
|
||||||
#include "libxx__gnu_unwind_find_exidx.hxx"
|
#include "libxx__gnu_unwind_find_exidx.hxx"
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -84,10 +85,11 @@
|
||||||
|
|
||||||
extern "C"
|
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_start_elf = (__EIT_entry *) start;
|
||||||
__exidx_end_elf = __exidx_start_elf + size;
|
__exidx_end_elf = __exidx_start_elf + size;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, int *nrecp)
|
_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, int *nrecp)
|
||||||
|
|
|
@ -42,7 +42,6 @@ extern "C"
|
||||||
// Included Files
|
// Included Files
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
|
||||||
#include <elf32.h>
|
|
||||||
#include <unwind.h>
|
#include <unwind.h>
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue