Skip to content

Commit 8b80907

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

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

components/libc/cplusplus/SConscript

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
from building import *
22
import os
3-
Import('rtconfig')
3+
import rtconfig
44

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 the 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)