Make no-tcmalloc (really, non-base/allocator) builds work again,

(i.e. this is a plain vanilla build used when layers like base/allocator
are getting in the way of debugging)
and make sure they use msvcrt rather than libcmt
(libcmt is used to help shim malloc/free, but it gets
in the way of valgrind doing the same thing).

Sadly, this is now a gyp-time operation rather than a Configuration
option.

Had to remove hardcoded C prototype for _set_new_mode, 
as that caused link errors.

Also add variables win_{release,debug}_{Optimization,RuntimeLibrary}
to let the valgrind build override those settings.

Fix calling convention on _set_new_mode to match the
one in <new.h>

BUG=none
TEST=build with ~/.gyp/include.gypi set as described in comment in common.gypi, gclient runhooks, do release build, verify all exe's and dll's linked against msvcrt dll


Review URL: http://codereview.chromium.org/455037

git-svn-id: http://src.chromium.org/svn/trunk/src/build@33719 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
dank@chromium.org 2009-12-03 21:07:47 +00:00
Родитель 7930aa5773
Коммит d9a7a5e8fe
2 изменённых файлов: 46 добавлений и 11 удалений

Просмотреть файл

@ -85,8 +85,14 @@
],
}],
['OS=="win"', {
'conditions': [
['win_use_allocator_shim==1', {
'dependencies': [
'../base/allocator/allocator.gyp:*',
],
}],
],
'dependencies': [
'../base/allocator/allocator.gyp:*',
'../breakpad/breakpad.gyp:*',
'../chrome/app/locales/locales.gyp:*',
'../courgette/courgette.gyp:*',

Просмотреть файл

@ -127,6 +127,14 @@
# JavaScript engines.
'javascript_engine%': 'v8',
# Although base/allocator lets you select a heap library via an
# environment variable, the libcmt shim it uses sometimes gets in
# the way. To disable it entirely, and switch to normal msvcrt, do e.g.
# 'win_use_allocator_shim': 0,
# 'win_release_RuntimeLibrary': 2
# to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
'win_use_allocator_shim%': 1, # 0 = shim allocator via libcmt; 1 = msvcrt
# To do a shared build on linux we need to be able to choose between type
# static_library and shared_library. We default to doing a static build
# but you can override this with "gyp -Dlibrary=shared_library" or you
@ -280,8 +288,16 @@
},
'target_defaults': {
'variables': {
# See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
'mac_release_optimization%': '3', # Use -O3 unless overridden
'mac_debug_optimization%': '0', # Use -O0 unless overridden
# See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
'win_release_Optimization%': '2', # 2 = /Os
'win_debug_Optimization%': '0', # 0 = /Od
# See http://msdn.microsoft.com/en-us/library/aa652367(VS.71).aspx
'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
'win_debug_RuntimeLibrary%': '1', # 1 = /MTd (debug static)
'release_extra_cflags%': '',
'debug_extra_cflags%': '',
'release_valgrind_build%': 0,
@ -325,6 +341,13 @@
['selinux==1', {
'defines': ['CHROMIUM_SELINUX=1'],
}],
['win_use_allocator_shim==0', {
'conditions': [
['OS=="win"', {
'defines': ['NO_TCMALLOC'],
}],
],
}],
['coverage!=0', {
'conditions': [
['OS=="mac"', {
@ -389,10 +412,10 @@
},
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '0',
'Optimization': '<(win_debug_Optimization)',
'PreprocessorDefinitions': ['_DEBUG'],
'BasicRuntimeChecks': '3',
'RuntimeLibrary': '1',
'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
},
'VCLinkerTool': {
'LinkIncremental': '<(msvs_debug_link_incremental)',
@ -420,6 +443,10 @@
'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
},
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '<(win_release_Optimization)',
'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
},
'VCLinkerTool': {
'LinkIncremental': '1',
},
@ -428,6 +455,16 @@
['release_valgrind_build==0', {
'defines': ['NVALGRIND'],
}],
['win_use_allocator_shim==0', {
'defines': ['NO_TCMALLOC'],
}],
['win_release_RuntimeLibrary==2', {
# Visual C++ 2008 barfs when building anything with /MD (msvcrt):
# VC\include\typeinfo(139) : warning C4275: non dll-interface
# class 'stdext::exception' used as base for dll-interface
# class 'std::bad_cast'
'msvs_disabled_warnings': [4275],
}],
['msvs_use_common_release', {
'msvs_props': ['release.vsprops'],
}],
@ -459,10 +496,6 @@
},
},
},
'Release - no tcmalloc': {
'inherit_from': ['Release'],
'defines': ['NO_TCMALLOC'],
},
'Debug_x64': {
'inherit_from': ['Debug'],
'msvs_configuration_platform': 'x64',
@ -475,10 +508,6 @@
'inherit_from': ['Purify'],
'msvs_configuration_platform': 'x64',
},
'Release - no tcmalloc_x64': {
'inherit_from': ['Release - no tcmalloc'],
'msvs_configuration_platform': 'x64',
},
}],
],
},