Merge "Add stub_only_libs property"
diff --git a/android/variable.go b/android/variable.go
index af414cb..4cd5313 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -62,6 +62,11 @@
Cflags []string
}
+ // Product_is_iot is true for Android Things devices.
+ Product_is_iot struct {
+ Cflags []string
+ }
+
// treble_linker_namespaces is true when the system/vendor linker namespace separation is
// enabled.
Treble_linker_namespaces struct {
@@ -201,6 +206,8 @@
Override_rs_driver *string `json:",omitempty"`
+ Product_is_iot *bool `json:",omitempty"`
+
DeviceKernelHeaders []string `json:",omitempty"`
DistDir *string `json:",omitempty"`
diff --git a/cc/binary.go b/cc/binary.go
index 4a6eb93..0303d9a 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -216,9 +216,6 @@
if ctx.Host() && !binary.static() {
if !ctx.Config().IsEnvTrue("DISABLE_HOST_PIE") {
flags.LdFlags = append(flags.LdFlags, "-pie")
- if ctx.Windows() {
- flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
- }
}
}
diff --git a/cc/config/tidy.go b/cc/config/tidy.go
index a20d556..5d53a8c 100644
--- a/cc/config/tidy.go
+++ b/cc/config/tidy.go
@@ -19,6 +19,13 @@
"strings"
)
+// clang-tidy doesn't recognize every flag that clang does. This is unlikely to
+// be a complete list, but we can populate this with the ones we know to avoid
+// issues with clang-diagnostic-unused-command-line-argument.
+var ClangTidyUnknownCflags = sorted([]string{
+ "-Wa,%",
+})
+
func init() {
// Most Android source files are not clang-tidy clean yet.
// Global tidy checks include only google*, performance*,
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index 6fbff9f..4cb8fa4 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -45,7 +45,6 @@
windowsIncludeFlags = []string{
"-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include",
- "-isystem ${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/include",
}
windowsClangCppflags = []string{
@@ -79,22 +78,34 @@
"-m32",
"-Wl,--large-address-aware",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib32",
+ "-static-libgcc",
}
windowsX86ClangLdflags = append(ClangFilterUnknownCflags(windowsX86Ldflags), []string{
+ "-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib32",
+ "-pthread",
+ // Bug: http://b/109759970 - WAR until issue with ld.bfd's
+ // inability to handle Clang-generated section names is fixed.
+ "-Wl,--allow-multiple-definition",
}...)
windowsX86ClangLldflags = ClangFilterUnknownLldflags(windowsX86ClangLdflags)
windowsX8664Ldflags = []string{
"-m64",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib64",
+ "-static-libgcc",
}
windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{
+ "-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib64",
+ "-pthread",
+ // Bug: http://b/109759970 - WAR until issue with ld.bfd's
+ // inability to handle Clang-generated section names is fixed.
+ "-Wl,--allow-multiple-definition",
}...)
windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags)
@@ -220,7 +231,7 @@
}
func (t *toolchainWindows) ClangSupported() bool {
- return false
+ return true
}
func (t *toolchainWindowsX86) ClangTriple() string {
diff --git a/cc/linker.go b/cc/linker.go
index f6223a7..6bbf015 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -246,6 +246,10 @@
if ctx.Darwin() {
return false
}
+ // http://b/110800681 - lld cannot link Android's Windows modules yet.
+ if ctx.Windows() {
+ return false
+ }
if linker.Properties.Use_clang_lld != nil {
return Bool(linker.Properties.Use_clang_lld)
}
diff --git a/cc/makevars.go b/cc/makevars.go
index 5a912e1..88d4639 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -75,6 +75,7 @@
ctx.Strict("LLVM_OBJCOPY", "${config.ClangBin}/llvm-objcopy")
ctx.Strict("LLVM_STRIP", "${config.ClangBin}/llvm-strip")
ctx.Strict("PATH_TO_CLANG_TIDY", "${config.ClangBin}/clang-tidy")
+ ctx.Strict("CLANG_TIDY_UNKNOWN_CFLAGS", strings.Join(config.ClangTidyUnknownCflags, " "))
ctx.StrictSorted("CLANG_CONFIG_UNKNOWN_CFLAGS", strings.Join(config.ClangUnknownCflags, " "))
ctx.Strict("RS_LLVM_PREBUILTS_VERSION", "${config.RSClangVersion}")
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 080ac09..4c8a611 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -155,7 +155,9 @@
if ctx.clang() {
if ctx.Host() {
- globalSanitizers = ctx.Config().SanitizeHost()
+ if !ctx.Windows() {
+ globalSanitizers = ctx.Config().SanitizeHost()
+ }
} else {
arches := ctx.Config().SanitizeDeviceArch()
if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
diff --git a/java/builder.go b/java/builder.go
index 1944e69..15e9631 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -41,10 +41,11 @@
blueprint.RuleParams{
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
+ `(if [ -s $srcJarDir/list ] || [ -s $out.rsp ] ; then ` +
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
`$processorpath $javacFlags $bootClasspath $classpath ` +
`-source $javaVersion -target $javaVersion ` +
- `-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list && ` +
+ `-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list ; fi ) && ` +
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
CommandDeps: []string{
"${config.JavacCmd}",
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 9821bcf..1eb935f 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -640,20 +640,17 @@
var bootClasspathArgs string
javaVersion := getJavaVersion(ctx, String(d.Javadoc.properties.Java_version), String(d.Javadoc.properties.Sdk_version))
- if javaVersion == "1.9" {
- if len(deps.bootClasspath) > 0 {
- var systemModules classpath
- if deps.systemModules != nil {
- systemModules = append(systemModules, deps.systemModules)
- }
- bootClasspathArgs = systemModules.FormJavaSystemModulesPath("--system ", ctx.Device())
- bootClasspathArgs = bootClasspathArgs + " --patch-module java.base=."
- }
- } else {
- if len(deps.bootClasspath.Strings()) > 0 {
- // For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
- bootClasspathArgs = deps.bootClasspath.FormJavaClassPath("-bootclasspath")
- }
+ // Doclava has problem with "-source 1.9", so override javaVersion when Doclava
+ // is running with EXPERIMENTAL_USE_OPENJDK9=true. And eventually Doclava will be
+ // replaced by Metalava.
+ if !Bool(d.properties.Metalava_enabled) {
+ javaVersion = "1.8"
+ }
+ // continue to use -bootclasspath even if Metalava under -source 1.9 is enabled
+ // since it doesn't support system modules yet.
+ if len(deps.bootClasspath.Strings()) > 0 {
+ // For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
+ bootClasspathArgs = deps.bootClasspath.FormJavaClassPath("-bootclasspath")
}
classpathArgs := deps.classpath.FormJavaClassPath("-classpath")