summaryrefslogtreecommitdiff
path: root/components/libc/compilers/gcc/newlib/SConscript
diff options
context:
space:
mode:
authorliukangcc <[email protected]>2021-10-14 10:31:44 +0800
committerliukangcc <[email protected]>2021-10-14 10:32:22 +0800
commit3ac36a31071f66a06217b4676fc7266ba66c906a (patch)
treebe32fc9b7abb102aa905fdba0165bf6adf4c065d /components/libc/compilers/gcc/newlib/SConscript
parent0369db718cd3b1ff58ceb2fc44a48641a0fecc66 (diff)
parent33263d7e4ec22b118d0407ec7488ccfa60a8a0a1 (diff)
[update] Fix compiler flags issue
Diffstat (limited to 'components/libc/compilers/gcc/newlib/SConscript')
-rw-r--r--components/libc/compilers/gcc/newlib/SConscript27
1 files changed, 27 insertions, 0 deletions
diff --git a/components/libc/compilers/gcc/newlib/SConscript b/components/libc/compilers/gcc/newlib/SConscript
new file mode 100644
index 0000000000..e0ee482747
--- /dev/null
+++ b/components/libc/compilers/gcc/newlib/SConscript
@@ -0,0 +1,27 @@
+from building import *
+Import('rtconfig')
+
+src = []
+cwd = GetCurrentDir()
+group = []
+LIBS = ['m']
+CPPDEFINES = ['RT_USING_NEWLIB']
+CPPPATH = [cwd]
+
+if rtconfig.PLATFORM == 'gcc':
+ if GetDepend('RT_USING_LIBC'):
+ # link with libc and libm:
+ # libm is a frequently used lib. Newlib is compiled with -ffunction-sections in
+ # recent GCC tool chains. The linker would just link in the functions that have
+ # been referenced. So setting this won't result in bigger text size.
+ LIBS += ['c']
+
+ src += Glob('*.c')
+ if GetDepend('RT_USING_MODULE') == False:
+ SrcRemove(src, ['libc_syms.c'])
+ else:
+ src += ['syscalls.c']
+
+ group = DefineGroup('libc', src, depend = [], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
+
+Return('group')