diff --git a/components/libc/cplusplus/SConscript b/components/libc/cplusplus/SConscript index a7829cea6d1a..63f326e2356d 100644 --- a/components/libc/cplusplus/SConscript +++ b/components/libc/cplusplus/SConscript @@ -1,12 +1,16 @@ from building import * import os -Import('rtconfig') +import rtconfig cwd = GetCurrentDir() src = ['cxx_crt_init.c', 'cxx_crt.cpp'] CPPPATH = [cwd] +CXXFLAGS = '' -group = DefineGroup('CPP', src, depend=['RT_USING_CPLUSPLUS'], CPPPATH=CPPPATH) +if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']: # GCC or Keil AC6 or Clang/LLVM + CXXFLAGS += ' -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections' # reduce the resource consumptions + +group = DefineGroup('CPP', src, depend=['RT_USING_CPLUSPLUS'], CPPPATH=CPPPATH, CXXFLAGS=CXXFLAGS) list = os.listdir(cwd) for d in list: