Merge "Switch to clang 7.0"

This commit is contained in:
Chih-hung Hsieh
2018-03-27 18:38:19 +00:00
committed by Gerrit Code Review
5 changed files with 13 additions and 15 deletions

View File

@@ -67,7 +67,9 @@ var (
partialLd = pctx.AndroidStaticRule("partialLd", partialLd = pctx.AndroidStaticRule("partialLd",
blueprint.RuleParams{ blueprint.RuleParams{
Command: "$ldCmd -nostdlib -Wl,-r ${in} -o ${out} ${ldFlags}", // Without -no-pie, clang 7.0 adds -pie to link Android files,
// but -r and -pie cannot be used together.
Command: "$ldCmd -nostdlib -no-pie -Wl,-r ${in} -o ${out} ${ldFlags}",
CommandDeps: []string{"$ldCmd"}, CommandDeps: []string{"$ldCmd"},
}, },
"ldCmd", "ldFlags") "ldCmd", "ldFlags")

View File

@@ -36,6 +36,7 @@ var ClangUnknownCflags = sorted([]string{
"-Wno-error=maybe-uninitialized", "-Wno-error=maybe-uninitialized",
"-Wno-error=unused-but-set-parameter", "-Wno-error=unused-but-set-parameter",
"-Wno-error=unused-but-set-variable", "-Wno-error=unused-but-set-variable",
"-Wno-extended-offsetof",
"-Wno-free-nonheap-object", "-Wno-free-nonheap-object",
"-Wno-literal-suffix", "-Wno-literal-suffix",
"-Wno-maybe-uninitialized", "-Wno-maybe-uninitialized",
@@ -116,6 +117,10 @@ func init() {
// http://b/68236239 Allow 0/NULL instead of using nullptr everywhere. // http://b/68236239 Allow 0/NULL instead of using nullptr everywhere.
"-Wno-zero-as-null-pointer-constant", "-Wno-zero-as-null-pointer-constant",
// Warnings from clang-7.0
"-Wno-deprecated-register",
"-Wno-sign-compare",
}, " ")) }, " "))
pctx.StaticVariable("ClangExtraCppflags", strings.Join([]string{ pctx.StaticVariable("ClangExtraCppflags", strings.Join([]string{
@@ -151,6 +156,9 @@ func init() {
// http://b/72331526 Disable -Wtautological-* until the instances detected by these // http://b/72331526 Disable -Wtautological-* until the instances detected by these
// new warnings are fixed. // new warnings are fixed.
"-Wno-tautological-constant-compare", "-Wno-tautological-constant-compare",
"-Wno-tautological-type-limit-compare",
"-Wno-tautological-unsigned-enum-zero-compare",
"-Wno-tautological-unsigned-zero-compare",
// http://b/72331524 Allow null pointer arithmetic until the instances detected by // http://b/72331524 Allow null pointer arithmetic until the instances detected by
// this new warning are fixed. // this new warning are fixed.

View File

@@ -116,8 +116,8 @@ var (
// prebuilts/clang default settings. // prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host" ClangDefaultBase = "prebuilts/clang/host"
ClangDefaultVersion = "clang-4639204" ClangDefaultVersion = "clang-4679922"
ClangDefaultShortVersion = "6.0.1" ClangDefaultShortVersion = "7.0.1"
// Directories with warnings from Android.bp files. // Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{ WarningAllowedProjects = []string{

View File

@@ -95,12 +95,6 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
flags.LdFlags = append(flags.LdFlags, cachePolicyFormat+policy) flags.LdFlags = append(flags.LdFlags, cachePolicyFormat+policy)
} }
if ctx.Device() {
// Work around bug in Clang that doesn't pass correct emulated
// TLS option to target. See b/72706604 or
// https://github.com/android-ndk/ndk/issues/498.
flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls")
}
flags.ArGoldPlugin = true flags.ArGoldPlugin = true
// If the module does not have a profile, be conservative and do not inline // If the module does not have a profile, be conservative and do not inline

View File

@@ -407,12 +407,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
flags.CFlags = append(flags.CFlags, "-fvisibility=default") flags.CFlags = append(flags.CFlags, "-fvisibility=default")
} }
flags.LdFlags = append(flags.LdFlags, cfiLdflags...) flags.LdFlags = append(flags.LdFlags, cfiLdflags...)
if ctx.Device() {
// Work around a bug in Clang. The CFI sanitizer requires LTO, and when
// LTO is enabled, the Clang driver fails to enable emutls for Android.
// See b/72706604 or https://github.com/android-ndk/ndk/issues/498.
flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls")
}
flags.ArGoldPlugin = true flags.ArGoldPlugin = true
if Bool(sanitize.Properties.Sanitize.Diag.Cfi) { if Bool(sanitize.Properties.Sanitize.Diag.Cfi) {
diagSanitizers = append(diagSanitizers, "cfi") diagSanitizers = append(diagSanitizers, "cfi")