summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-26 02:11:32 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-11-26 02:11:32 +0000
commit1f14b136ca847e3aa097b55b69193ff9f3c59603 (patch)
tree380cf0d40c3021238761fb53448085a114fc13f9
parenta96d40e406be8d26dfd0f8f7a814ea8cc7cb18a8 (diff)
parent301c01aec10893727c7021eb372b65a451c770ce (diff)
Merge "Delay error on version_script, etc. properties on Darwin" into main am: 301c01aec1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3376691 Change-Id: I7875d6372023fea28dcfc7b142da5b16e71e8c57 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--cc/linker.go31
1 files changed, 19 insertions, 12 deletions
diff --git a/cc/linker.go b/cc/linker.go
index f9d58ea20..b96d13983 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -235,13 +235,16 @@ type BaseLinkerProperties struct {
// 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 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
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 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
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 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
}
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)
+ }
}
}
}