Delay error on version_script, etc. properties on Darwin
Darwin's linker doesn't support version_script, dynamic_list
or linker_scripts. Using any of these properites in a host module
would break analysis on Darwin, even though we don't build most of
the platform on Darwin any more. Move the error to build time to
allow analysis to complete.
Test: builds
Change-Id: Ia7f029ed7b319ce79e43627490c824663939f6a5
diff --git a/cc/linker.go b/cc/linker.go
index f9d58ea..b96d139 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -235,13 +235,16 @@
// Generate compact dynamic relocation table, default true.
Pack_relocations *bool `android:"arch_variant"`
- // local file name to pass to the linker as --version-script
+ // local file name to pass to the linker as --version-script. Not supported on darwin, and will fail to build
+ // if provided to the darwin variant of a module.
Version_script *string `android:"path,arch_variant"`
- // local file name to pass to the linker as --dynamic-list
+ // local file name to pass to the linker as --dynamic-list. Not supported on darwin, and will fail to build
+ // if provided to the darwin variant of a module.
Dynamic_list *string `android:"path,arch_variant"`
- // local files to pass to the linker as --script
+ // local files to pass to the linker as --script. Not supported on darwin or windows, and will fail to build
+ // if provided to the darwin or windows variant of a module.
Linker_scripts []string `android:"path,arch_variant"`
// list of static libs that should not be used to build this module
@@ -560,7 +563,7 @@
if versionScript.Valid() {
if ctx.Darwin() {
- ctx.PropertyErrorf("version_script", "Not supported on Darwin")
+ ctx.AddMissingDependencies([]string{"version_script_not_supported_on_darwin"})
} else {
flags.Local.LdFlags = append(flags.Local.LdFlags,
config.VersionScriptFlagPrefix+versionScript.String())
@@ -578,7 +581,7 @@
dynamicList := android.OptionalPathForModuleSrc(ctx, linker.Properties.Dynamic_list)
if dynamicList.Valid() {
if ctx.Darwin() {
- ctx.PropertyErrorf("dynamic_list", "Not supported on Darwin")
+ ctx.AddMissingDependencies([]string{"dynamic_list_not_supported_on_darwin"})
} else {
flags.Local.LdFlags = append(flags.Local.LdFlags,
"-Wl,--dynamic-list,"+dynamicList.String())
@@ -587,13 +590,17 @@
}
linkerScriptPaths := android.PathsForModuleSrc(ctx, linker.Properties.Linker_scripts)
- if len(linkerScriptPaths) > 0 && (ctx.Darwin() || ctx.Windows()) {
- ctx.PropertyErrorf("linker_scripts", "Only supported for ELF files")
- } else {
- for _, linkerScriptPath := range linkerScriptPaths {
- flags.Local.LdFlags = append(flags.Local.LdFlags,
- "-Wl,--script,"+linkerScriptPath.String())
- flags.LdFlagsDeps = append(flags.LdFlagsDeps, linkerScriptPath)
+ if len(linkerScriptPaths) > 0 {
+ if ctx.Darwin() {
+ ctx.AddMissingDependencies([]string{"linker_scripts_not_supported_on_darwin"})
+ } else if ctx.Windows() {
+ ctx.PropertyErrorf("linker_scripts", "Only supported for ELF files")
+ } else {
+ for _, linkerScriptPath := range linkerScriptPaths {
+ flags.Local.LdFlags = append(flags.Local.LdFlags,
+ "-Wl,--script,"+linkerScriptPath.String())
+ flags.LdFlagsDeps = append(flags.LdFlagsDeps, linkerScriptPath)
+ }
}
}
}