Merge "Change the naming policy of system_$(VER)"
diff --git a/android/module.go b/android/module.go
index 14b9f41..9de5294 100644
--- a/android/module.go
+++ b/android/module.go
@@ -110,6 +110,7 @@
ExpandSources(srcFiles, excludes []string) Paths
ExpandSource(srcFile, prop string) Path
+ ExpandOptionalSource(srcFile *string, prop string) OptionalPath
ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths
Glob(globPattern string, excludes []string) Paths
@@ -1162,6 +1163,16 @@
}
}
+// Returns an optional single path expanded from globs and modules referenced using ":module" syntax if
+// the srcFile is non-nil.
+// ExtractSourceDeps must have already been called during the dependency resolution phase.
+func (ctx *androidModuleContext) ExpandOptionalSource(srcFile *string, prop string) OptionalPath {
+ if srcFile != nil {
+ return OptionalPathForPath(ctx.ExpandSource(*srcFile, prop))
+ }
+ return OptionalPath{}
+}
+
func (ctx *androidModuleContext) ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths {
prefix := PathForModuleSrc(ctx).String()
diff --git a/cc/binary.go b/cc/binary.go
index 206237a..630a68d 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -158,6 +158,9 @@
ctx.ModuleErrorf("statically linking libc to dynamic executable, please remove libc\n" +
"from static libs or set static_executable: true")
}
+
+ android.ExtractSourceDeps(ctx, binary.Properties.Version_script)
+
return deps
}
@@ -277,7 +280,7 @@
func (binary *binaryDecorator) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
- versionScript := android.OptionalPathForModuleSrc(ctx, binary.Properties.Version_script)
+ versionScript := ctx.ExpandOptionalSource(binary.Properties.Version_script, "version_script")
fileName := binary.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
outputFile := android.PathForModuleOut(ctx, fileName)
ret := outputFile
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 004840a..a33db01 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -151,16 +151,16 @@
// http://b/72331526 Disable -Wtautological-* until the instances detected by these
// new warnings are fixed.
- "-Wno-error=tautological-constant-compare",
+ "-Wno-tautological-constant-compare",
// http://b/72331524 Allow null pointer arithmetic until the instances detected by
// this new warning are fixed.
- "-Wno-error=null-pointer-arithmetic",
+ "-Wno-null-pointer-arithmetic",
// http://b/72330874 Disable -Wenum-compare until the instances detected by this new
// warning are fixed.
- "-Wno-error=enum-compare",
- "-Wno-error=enum-compare-switch",
+ "-Wno-enum-compare",
+ "-Wno-enum-compare-switch",
}, " "))
}
diff --git a/cc/library.go b/cc/library.go
index 54c5476..f8e20e2 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -476,6 +476,13 @@
deps.SharedLibs = removeListFromList(deps.SharedLibs, library.baseLinker.Properties.Target.Vendor.Exclude_shared_libs)
deps.StaticLibs = removeListFromList(deps.StaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)
}
+
+ android.ExtractSourceDeps(ctx, library.Properties.Version_script)
+ android.ExtractSourceDeps(ctx, library.Properties.Unexported_symbols_list)
+ android.ExtractSourceDeps(ctx, library.Properties.Force_symbols_not_weak_list)
+ android.ExtractSourceDeps(ctx, library.Properties.Force_symbols_weak_list)
+ android.ExtractSourceDeps(ctx, library.Properties.Target.Vendor.Version_script)
+
return deps
}
@@ -507,12 +514,12 @@
var linkerDeps android.Paths
linkerDeps = append(linkerDeps, flags.LdFlagsDeps...)
- versionScript := android.OptionalPathForModuleSrc(ctx, library.Properties.Version_script)
- unexportedSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Unexported_symbols_list)
- forceNotWeakSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Force_symbols_not_weak_list)
- forceWeakSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Force_symbols_weak_list)
+ versionScript := ctx.ExpandOptionalSource(library.Properties.Version_script, "version_script")
+ unexportedSymbols := ctx.ExpandOptionalSource(library.Properties.Unexported_symbols_list, "unexported_symbols_list")
+ forceNotWeakSymbols := ctx.ExpandOptionalSource(library.Properties.Force_symbols_not_weak_list, "force_symbols_not_weak_list")
+ forceWeakSymbols := ctx.ExpandOptionalSource(library.Properties.Force_symbols_weak_list, "force_symbols_weak_list")
if ctx.useVndk() && library.Properties.Target.Vendor.Version_script != nil {
- versionScript = android.OptionalPathForModuleSrc(ctx, library.Properties.Target.Vendor.Version_script)
+ versionScript = ctx.ExpandOptionalSource(library.Properties.Target.Vendor.Version_script, "target.vendor.version_script")
}
if !ctx.Darwin() {
if versionScript.Valid() {
diff --git a/cc/lto.go b/cc/lto.go
index 7bc22ec..91b11b5 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -82,7 +82,8 @@
flags.LdFlags = append(flags.LdFlags, ltoFlag)
if ctx.Device() {
// Work around bug in Clang that doesn't pass correct emulated
- // TLS option to target
+ // 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.ArFlags = append(flags.ArFlags, " --plugin ${config.LLVMGoldPlugin}")
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 02aedc8..ac6cb77 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -401,6 +401,12 @@
flags.CFlags = append(flags.CFlags, "-fvisibility=default")
}
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.ArFlags = append(flags.ArFlags, cfiArflags...)
if Bool(sanitize.Properties.Sanitize.Diag.Cfi) {
diagSanitizers = append(diagSanitizers, "cfi")