Reduce the set of unnecessary compiler flags a bit
Change-Id: I470bd75a50941f3134f4e037c7cc5db4dce59317
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index 8bddd0e..5889546 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -105,9 +105,6 @@
'<!(readlink -f <(AOS)/../output/compiled-<(ARCHITECTURE)<(EXTERNALS_EXTRA)/gperftools-2.3-prefix/lib/libtcmalloc.a)',
'<!(readlink -f <(AOS)/../output/compiled-<(ARCHITECTURE)<(EXTERNALS_EXTRA)/libunwind-1.1-prefix/lib/libunwind.a)',
],
- 'defines': [
- 'TCMALLOC',
- ],
},
], ['EXTERNALS_EXTRA=="-fPIE"', {
'target_defaults': {
@@ -141,7 +138,6 @@
'__STDC_FORMAT_MACROS',
'__STDC_CONSTANT_MACROS',
'__STDC_LIMIT_MACROS',
- 'AOS_COMPILER_<!(echo <(FULL_COMPILER) | sed \'s/\./_/g\')',
'AOS_ARCHITECTURE_<(ARCHITECTURE)',
'_FILE_OFFSET_BITS=64',
],
diff --git a/aos/linux_code/init.cc b/aos/linux_code/init.cc
index bf0b92d..ca14ab3 100644
--- a/aos/linux_code/init.cc
+++ b/aos/linux_code/init.cc
@@ -17,13 +17,11 @@
#include "aos/linux_code/logging/linux_logging.h"
#include "aos/linux_code/ipc_lib/shared_mem.h"
-#ifdef TCMALLOC
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_double_instead {
-extern double FLAGS_tcmalloc_release_rate;
+extern double FLAGS_tcmalloc_release_rate __attribute__((weak));
}
using FLAG__namespace_do_not_use_directly_use_DECLARE_double_instead::
FLAGS_tcmalloc_release_rate;
-#endif
namespace aos {
namespace logging {
@@ -76,10 +74,10 @@
// Don't use mmap for large malloc chunks.
CHECK_EQ(1, mallopt(M_MMAP_MAX, 0));
-#ifdef TCMALLOC
- // Tell tcmalloc not to return memory.
- FLAGS_tcmalloc_release_rate = 0.0;
-#endif
+ if (&FLAGS_tcmalloc_release_rate) {
+ // Tell tcmalloc not to return memory.
+ FLAGS_tcmalloc_release_rate = 0.0;
+ }
// Forces the memory pages for all the stack space that we're ever going to
// use to be loaded into memory (so it can be locked there).