Hack to get rid of libstdc++

Need to setup meson build with CXX=gcc -m32 -march=pentium4 -msse2 -mfpmath=sse
This commit is contained in:
Francesco Abbate 2021-03-01 11:48:23 +01:00
parent 3527cdfcb4
commit 758209cf98
3 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,26 @@
#include <stdlib.h>
#include <unistd.h>
extern "C" void* emulate_cc_new(unsigned len) { \
void *p = malloc(len);
if (p == 0) {
/* Don't use stdio (e.g. fputs), because that may want to allocate more
* memory.
*/
(void)!write(2, "out of memory\n", 14);
abort();
}
return p;
}
extern "C" void emulate_cc_delete(void* p) {
if (p != 0)
free(p);
}
void* operator new (unsigned len) __attribute__((alias("emulate_cc_new")));
void* operator new[](unsigned len) __attribute__((alias("emulate_cc_new")));
void operator delete (void* p) __attribute__((alias("emulate_cc_delete")));
void operator delete[](void* p) __attribute__((alias("emulate_cc_delete")));
void* __cxa_pure_virtual = 0;
void* __gxx_personality_sj0 = 0;

View File

@ -9,6 +9,7 @@ endif
font_renderer_sources = [
'agg_font_freetype.cpp',
'font_renderer.cpp',
'libstdcpp-replace.cpp',
]
font_renderer_cdefs = ['-DFONT_RENDERER_HEIGHT_HACK']

View File

@ -8,9 +8,10 @@ lua_dep = dependency('lua5.2', required : false)
lite_link_args = []
if get_option('buildtype') == 'release'
if cc.get_id() == 'gcc'
lite_link_args += ['-static-libgcc', '-static-libstdc++']
lite_link_args += ['-static-libgcc'] #, '-static-libstdc++']
endif
add_global_arguments('-fdata-sections', '-ffunction-sections', language : ['c', 'cpp'])
add_global_arguments('-fno-rtti', '-fno-exceptions', language : 'cpp')
add_global_link_arguments('-Wl,--gc-sections', language : ['c', 'cpp'])
endif