Automatically link wutstdc++ when C++ is used

This commit is contained in:
fincs 2019-01-24 22:59:02 +01:00 committed by fincs
parent 3e179891e9
commit 0b920cf9b9
3 changed files with 20 additions and 5 deletions

View File

@ -1,11 +1,11 @@
void __init_wut_malloc();
void __init_wut_newlib();
void __init_wut_stdcpp();
extern void __init_wut_stdcpp() __attribute__((weak));
void __init_wut_devoptab();
void __fini_wut_malloc();
void __fini_wut_newlib();
void __fini_wut_stdcpp();
extern void __fini_wut_stdcpp() __attribute__((weak));
void __fini_wut_devoptab();
void __attribute__((weak))
@ -13,7 +13,9 @@ __init_wut()
{
__init_wut_malloc();
__init_wut_newlib();
//__init_wut_stdcpp();
if (__init_wut_stdcpp) {
__init_wut_stdcpp();
}
__init_wut_devoptab();
}
@ -21,7 +23,9 @@ void __attribute__((weak))
__fini_wut()
{
__fini_wut_devoptab();
//__fini_wut_stdcpp();
if (__fini_wut_stdcpp) {
__fini_wut_stdcpp();
}
__fini_wut_newlib();
__fini_wut_malloc();
}

View File

@ -1,5 +1,16 @@
#include "wut_gthread.h"
__asm__ __volatile__(
"\t.section\t.text.__wrap___gxx_personality_v0,\"ax\",@progbits\n"
"\t.align\t2\n"
"\t.globl\t__wrap___gxx_personality_v0\n"
"\t.type\t__wrap___gxx_personality_v0, @function\n"
"__wrap___gxx_personality_v0:\n"
"\t.cfi_startproc\n"
"\tb\t__real___gxx_personality_v0\n"
"\t.cfi_endproc"
);
extern "C" void
__init_wut_stdcpp()
{

View File

@ -1,4 +1,4 @@
%rename link old_link
*link:
%(old_link) -T %:getenv(DEVKITPRO /wut/share/wut.ld) --gc-sections --emit-relocs -z nocopyreloc %(wut_entry)
%(old_link) -T %:getenv(DEVKITPRO /wut/share/wut.ld) --gc-sections --emit-relocs -z nocopyreloc -wrap __gxx_personality_v0 %(wut_entry)