Bug 1491004 - Set CFLAGS and CXXFLAGS in toolchain.configure for coverage builds. r=chmanchester

Differential Revision: https://phabricator.services.mozilla.com/D18510

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Marco Castelluccio 2019-02-20 12:18:32 +00:00
parent e2ff25bf86
commit 2dffc6b8bf
5 changed files with 14 additions and 6 deletions

View File

@ -12,8 +12,6 @@ ac_add_options --disable-profiling
ac_add_options --disable-warnings-as-errors
ac_add_options --enable-coverage
export CFLAGS="--coverage"
export CXXFLAGS="--coverage"
export LDFLAGS="--coverage -L$topsrcdir/clang/lib/clang/7.0.1/lib/linux/"
export LIBS="-lclang_rt.profile-x86_64"
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads"

View File

@ -8,8 +8,6 @@ ac_add_options --disable-sandbox
ac_add_options --disable-warnings-as-errors
ac_add_options --enable-coverage
export CFLAGS="-coverage -Xclang -coverage-no-function-names-in-data"
export CXXFLAGS="-coverage -Xclang -coverage-no-function-names-in-data"
export LDFLAGS="-coverage -L$topsrcdir/clang/lib/clang/7.0.1/lib/darwin/"
export LIBS="-lclang_rt.profile_osx"
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads"

View File

@ -28,8 +28,6 @@ if [ -d "$topsrcdir/clang" ]; then
export LDFLAGS="clang_rt.profile-x86_64.lib"
fi
export CFLAGS="--coverage -Xclang -coverage-no-function-names-in-data"
export CXXFLAGS="--coverage -Xclang -coverage-no-function-names-in-data"
export RUSTFLAGS="-Ccodegen-units=1 -Zprofile -Zno-landing-pads"
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -1729,6 +1729,19 @@ def code_coverage(value):
set_config('MOZ_CODE_COVERAGE', code_coverage)
set_define('MOZ_CODE_COVERAGE', code_coverage)
@depends(c_compiler, when=code_coverage)
def coverage_cflags(c_compiler):
cflags = ['--coverage']
if c_compiler.type in ('clang', 'clang-cl'):
cflags += [
'-Xclang', '-coverage-no-function-names-in-data',
]
return cflags
set_config('COVERAGE_CFLAGS', coverage_cflags)
# ==============================================================
option(env='RUSTFLAGS',

View File

@ -472,6 +472,7 @@ class CompileFlags(BaseCompileFlags):
('CFLAGS', 'C_LDFLAGS')),
('MOZBUILD_CFLAGS', None, ('CFLAGS',)),
('MOZBUILD_CXXFLAGS', None, ('CXXFLAGS',)),
('COVERAGE', context.config.substs.get('COVERAGE_CFLAGS'), ('CXXFLAGS', 'CFLAGS')),
)
BaseCompileFlags.__init__(self, context)