Skip to content

Commit c3e829f

Browse files
committed
[cpp] attach CXXFLAGS to reduce the resource consumptions
1 parent 593d794 commit c3e829f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/libc/cplusplus/SConscript

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ Import('rtconfig')
55
cwd = GetCurrentDir()
66
src = ['cxx_crt_init.c', 'cxx_crt.cpp']
77
CPPPATH = [cwd]
8+
CXXFLAGS = ''
89

9-
group = DefineGroup('CPP', src, depend=['RT_USING_CPLUSPLUS'], CPPPATH=CPPPATH)
10+
if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: # GCC or Keil AC6 or Clang/LLVM
11+
CXXFLAGS += ' -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections' # reduce resource consumptions
12+
13+
group = DefineGroup('CPP', src, depend=['RT_USING_CPLUSPLUS'], CPPPATH=CPPPATH, CXXFLAGS=CXXFLAGS)
1014

1115
list = os.listdir(cwd)
1216
for d in list:

0 commit comments

Comments
 (0)