Merge pull request #625 from joostn/jn_cpp1

Improved C++ support, support C++ exceptions
This commit is contained in:
Ruslan V. Uss 2018-05-18 20:00:42 +05:00 committed by GitHub
commit 10f361c8ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View file

@ -4,22 +4,22 @@
#include <stdio.h>
#include <stdlib.h>
void *operator new(size_t size)
void * __attribute__((weak)) operator new(size_t size)
{
return malloc(size);
}
void *operator new[](size_t size)
void * __attribute__((weak)) operator new[](size_t size)
{
return malloc(size);
}
void operator delete(void * ptr)
void __attribute__((weak)) operator delete(void * ptr)
{
free(ptr);
}
void operator delete[](void * ptr)
void __attribute__((weak)) operator delete[](void * ptr)
{
free(ptr);
}

View file

@ -113,7 +113,11 @@ SECTIONS
*libc.a:*bzero.o(.literal .text .literal.* .text.*)
*libc.a:*lock.o(.literal .text .literal.* .text.*)
*libc.a:*printf.o(.literal .text .literal.* .text.*)
*libc.a:*-printf.o(.literal .text .literal.* .text.*)
*libc.a:*-sprintf.o(.literal .text .literal.* .text.*)
*libc.a:*-fprintf.o(.literal .text .literal.* .text.*)
*libc.a:*-svfprintf.o(.literal .text .literal.* .text.*)
*libc.a:*-vfprintf.o(.literal .text .literal.* .text.*)
*libc.a:*findfp.o(.literal .text .literal.* .text.*)
*libc.a:*fputwc.o(.literal .text .literal.* .text.*)
@ -249,10 +253,13 @@ SECTIONS
*(.gnu.linkonce.r.*)
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
*(.xt_except_table)
*(.gcc_except_table)
*(.gcc_except_table .gcc_except_table.*)
*(.gnu.linkonce.e.*)
*(.gnu.version_r)
*(.eh_frame)
. = (. + 3) & ~ 3;
__eh_frame = ABSOLUTE(.);
KEEP(*(.eh_frame))
. = (. + 7) & ~ 3;
. = ALIGN(4);
*(.dynamic)
*(.gnu.version_d)