diff options
author | 2024-10-31 19:59:30 +0000 | |
---|---|---|
committer | 2024-11-01 00:28:00 +0000 | |
commit | 173256b06a4d8a2c52efcc95ca6aab9a59a9f61e (patch) | |
tree | 6921ce8323c1dd70eaa0e3501c7ae77e2938d928 /filesystem/filesystem.go | |
parent | 8fe68dcfd71efa99aebf7f5ef2f3b19d78621a24 (diff) |
Use a boolean to determine if linker.config.pb should be generated
vendor and product generate a linker.config.pb even if
`PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS` or
`PRODUCT_PRODUCT_LINKER_CONFIG_FRAGMENTS` are empty respectively. This
CL introduces a new property to determine if a filesystem should
generate a linker.config.pb. The autogenerated vendor and product
filesystem modules will set this property to true.
Test: go test ./filesystem
Bug: 376515221
Change-Id: Ibd007df0d287034f4d227a6054bd83937570ec27
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r-- | filesystem/filesystem.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index d0d482561..0e3c3a094 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -147,9 +147,7 @@ type FilesystemProperties struct { Erofs ErofsProperties - // List of files (in .json format) that will be converted to a linker config file (in .pb format). - // The linker config file be installed in the filesystem at /etc/linker.config.pb - Linker_config_srcs []string `android:"path"` + Linkerconfig LinkerConfigProperties // Determines if the module is auto-generated from Soong or not. If the module is // auto-generated, its deps are exempted from visibility enforcement. @@ -168,6 +166,16 @@ type ErofsProperties struct { Sparse *bool } +type LinkerConfigProperties struct { + + // Build a linker.config.pb file + Gen_linker_config *bool + + // List of files (in .json format) that will be converted to a linker config file (in .pb format). + // The linker config file be installed in the filesystem at /etc/linker.config.pb + Linker_config_srcs []string `android:"path"` +} + // android_filesystem packages a set of modules and their transitive dependencies into a filesystem // image. The filesystem images are expected to be mounted in the target device, which means the // modules in the filesystem image are built for the target device (i.e. Android, not Linux host). @@ -690,13 +698,13 @@ func (f *filesystem) buildEventLogtagsFile(ctx android.ModuleContext, builder *a } func (f *filesystem) buildLinkerConfigFile(ctx android.ModuleContext, builder *android.RuleBuilder, rebasedDir android.OutputPath) { - if len(f.properties.Linker_config_srcs) == 0 { + if !proptools.Bool(f.properties.Linkerconfig.Gen_linker_config) { return } provideModules, _ := f.getLibsForLinkerConfig(ctx) output := rebasedDir.Join(ctx, "etc", "linker.config.pb") - linkerconfig.BuildLinkerConfig(ctx, builder, android.PathsForModuleSrc(ctx, f.properties.Linker_config_srcs), provideModules, nil, output) + linkerconfig.BuildLinkerConfig(ctx, builder, android.PathsForModuleSrc(ctx, f.properties.Linkerconfig.Linker_config_srcs), provideModules, nil, output) f.appendToEntry(ctx, output) } |