Compare commits

...

2 Commits

Author SHA1 Message Date
Francesco Abbate 758209cf98 Hack to get rid of libstdc++
Need to setup meson build with CXX=gcc -m32 -march=pentium4 -msse2 -mfpmath=sse
2021-03-01 11:48:23 +01:00
Francesco Abbate 3527cdfcb4 Testing global options to remove unused functions 2021-03-01 09:47:03 +01:00
3 changed files with 37 additions and 5 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 = [ font_renderer_sources = [
'agg_font_freetype.cpp', 'agg_font_freetype.cpp',
'font_renderer.cpp', 'font_renderer.cpp',
'libstdcpp-replace.cpp',
] ]
font_renderer_cdefs = ['-DFONT_RENDERER_HEIGHT_HACK'] font_renderer_cdefs = ['-DFONT_RENDERER_HEIGHT_HACK']

View File

@ -5,6 +5,16 @@ libm = cc.find_library('m', required : false)
libdl = cc.find_library('dl', required : false) libdl = cc.find_library('dl', required : false)
lua_dep = dependency('lua5.2', required : false) 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++']
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
if not lua_dep.found() if not lua_dep.found()
lua_subproject = subproject('lua', default_options: [ lua_subproject = subproject('lua', default_options: [
'shared=false', 'use_readline=false', 'app=false' 'shared=false', 'use_readline=false', 'app=false'
@ -26,11 +36,6 @@ foreach data_module : ['core', 'fonts', 'plugins', 'colors']
install_subdir('data' / data_module , install_dir : lite_datadir) install_subdir('data' / data_module , install_dir : lite_datadir)
endforeach endforeach
lite_link_args = []
if cc.get_id() == 'gcc' and get_option('buildtype') == 'release'
lite_link_args += ['-static-libgcc', '-static-libstdc++']
endif
lite_rc = [] lite_rc = []
if host_machine.system() == 'windows' if host_machine.system() == 'windows'
windows = import('windows') windows = import('windows')