diff --git a/core/androidbp_backend.go b/core/androidbp_backend.go index 538d1a68..9da42678 100644 --- a/core/androidbp_backend.go +++ b/core/androidbp_backend.go @@ -16,6 +16,7 @@ import ( "github.com/ARM-software/bob-build/core/config" "github.com/ARM-software/bob-build/core/file" + "github.com/ARM-software/bob-build/core/tag" "github.com/ARM-software/bob-build/internal/bpwriter" "github.com/ARM-software/bob-build/internal/fileutils" "github.com/ARM-software/bob-build/internal/utils" @@ -87,10 +88,19 @@ func (g *androidBpGenerator) aliasActions(a *ModuleAlias, ctx blueprint.ModuleCo var ownerTagRegex = regexp.MustCompile(`^owner:[a-zA-Z0-9_-]+`) -func addProvenanceProps(writer bpwriter.Module, mod Tagable) { +func addProvenanceProps(ctx blueprint.ModuleContext, writer bpwriter.Module, mod Tagable) { tags := mod.GetTagsRegex(ownerTagRegex) + // Append any tags applied from the toolchain. + ctx.VisitDirectDepsIf( + func(dep blueprint.Module) bool { + return ctx.OtherModuleDependencyTag(dep) == tag.ToolchainTag + }, + func(dep blueprint.Module) { + tags = append(tags, dep.(*ModuleToolchain).GetTagsRegex(ownerTagRegex)...) + }) + switch len(tags) { case 0: // No owner tag set. diff --git a/core/androidbp_cclibs.go b/core/androidbp_cclibs.go index 227f3734..243fe061 100644 --- a/core/androidbp_cclibs.go +++ b/core/androidbp_cclibs.go @@ -318,7 +318,7 @@ func addCcLibraryProps(mod bpwriter.Module, m ModuleLibrary, ctx blueprint.Modul mod.AddString("relative_install_path", installRel) } - addProvenanceProps(mod, &m) + addProvenanceProps(ctx, mod, &m) addPGOProps(mod, m.Properties.Build.AndroidPGOProps) addRequiredModules(mod, m, ctx) @@ -700,7 +700,7 @@ func (g *androidBpGenerator) strictLibraryActions(m *ModuleStrictLibrary, ctx bl // mod.AddString("relative_install_path", installRel) // } - addProvenanceProps(mod, m) + addProvenanceProps(ctx, mod, m) // TODO: Make addPGOProps generic and enable it if needed // addPGOProps(mod, m.Properties.Build.AndroidPGOProps) @@ -745,7 +745,7 @@ func (g *androidBpGenerator) executableTestActions(m *ModuleTest, ctx blueprint. // mod.AddString("compile_multilib", "both") // } - addProvenanceProps(mod, m) + addProvenanceProps(ctx, mod, m) // Avoid using cc_test default setup // TODO: `relative_install_path` needed - Module install directory may only be disabled if relative_install_path is set @@ -783,5 +783,5 @@ func (g *androidBpGenerator) strictBinaryActions(m *ModuleStrictBinary, ctx blue mod.AddString("compile_multilib", "both") } - addProvenanceProps(mod, m) + addProvenanceProps(ctx, mod, m) } diff --git a/core/androidbp_filegroup.go b/core/androidbp_filegroup.go index e22f6eb1..9cdf7c4d 100644 --- a/core/androidbp_filegroup.go +++ b/core/androidbp_filegroup.go @@ -11,5 +11,5 @@ func (g *androidBpGenerator) filegroupActions(m *ModuleFilegroup, ctx blueprint. utils.Die("%v", err.Error()) } mod.AddStringList("srcs", m.Properties.Srcs) - addProvenanceProps(mod, m) + addProvenanceProps(ctx, mod, m) } diff --git a/core/androidbp_kernel_module.go b/core/androidbp_kernel_module.go index 1ada225d..50ed3bc5 100644 --- a/core/androidbp_kernel_module.go +++ b/core/androidbp_kernel_module.go @@ -55,7 +55,7 @@ func (g *androidBpGenerator) kernelModuleActions(ko *ModuleKernelObject, ctx blu kdir = getPathInSourceDir(kdir) } - addProvenanceProps(bpmod, ko) + addProvenanceProps(ctx, bpmod, ko) srcs := []string{} ko.Properties.GetFiles(ctx).ForEach( diff --git a/core/androidbp_resource.go b/core/androidbp_resource.go index 48c009d1..d8733187 100644 --- a/core/androidbp_resource.go +++ b/core/androidbp_resource.go @@ -87,7 +87,7 @@ func (g *androidBpGenerator) resourceActions(r *ModuleResource, ctx blueprint.Mo utils.Die(err.Error()) } - addProvenanceProps(m, r) + addProvenanceProps(ctx, m, r) // TODO: temporary workaround for broken symlinks // Remove while Bob plugins won't be used anymore diff --git a/docs/module_types/bob_toolchain.md b/docs/module_types/bob_toolchain.md index 7e974778..65eb5739 100644 --- a/docs/module_types/bob_toolchain.md +++ b/docs/module_types/bob_toolchain.md @@ -4,7 +4,7 @@ ```bp bob_toolchain { - name, cflags, conlyflags, cppflags, asflags, ldflags, target, host, mte, + name, cflags, conlyflags, cppflags, asflags, ldflags, target, host, mte, tags } ``` @@ -31,6 +31,7 @@ Supports: | [`asflags`](properties/legacy_properties.md#asflags) | List of strings; default is `[]`
Flags used for assembly compilation. | | [`ldflags`](properties/legacy_properties.md#ldflags) | List of strings; default is `[]`
Flags used for linking. | | `mte` | Property map; default is `{}`.
Flags to be used to enable the Arm Memory Tagging Extension.
Only supported on Android.
- **memtag_heap** - Memory-tagging, only available on arm64 if `diag_memtag_heap` unset or false, enables async memory tagging.
- **diag_memtag_heap** - Memory-tagging, only available on arm64 requires `memtag_heap`: true if set, enables sync memory tagging. | +| [`tags`](properties/common_properties.md#tags) | List of strings; default is `[]`
This list of tags will be appended to any module using this toolchain configuration. | ## Example diff --git a/gendiffer/tests/toolchain/tagable/out/android/Android.bp.out b/gendiffer/tests/toolchain/tagable/out/android/Android.bp.out index 21d25f90..f9672a89 100644 --- a/gendiffer/tests/toolchain/tagable/out/android/Android.bp.out +++ b/gendiffer/tests/toolchain/tagable/out/android/Android.bp.out @@ -15,6 +15,10 @@ cc_binary { "-Werror", ], compile_multilib: "both", + owner: "toolchain", + vendor: true, + proprietary: true, + soc_specific: true, } cc_test { @@ -24,6 +28,10 @@ cc_test { "-Wall", "-Werror", ], + owner: "toolchain", + vendor: true, + proprietary: true, + soc_specific: true, include_build_directory: false, auto_gen_config: false, gtest: false,