Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27777d8b authored by Spandan Das's avatar Spandan Das Committed by Gerrit Code Review
Browse files

Merge "Use a boolean to determine if linker.config.pb should be generated" into main

parents d7cecd83 173256b0
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -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).
@@ -691,13 +699,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)
}
+4 −1
Original line number Diff line number Diff line
@@ -670,7 +670,10 @@ func TestInstallLinkerConfigFile(t *testing.T) {
android_filesystem {
    name: "myfilesystem",
    deps: ["libfoo_has_no_stubs", "libfoo_has_stubs"],
    linkerconfig: {
	    gen_linker_config: true,
	    linker_config_srcs: ["linker.config.json"],
    },
    partition_type: "vendor",
}
cc_library {
+2 −1
Original line number Diff line number Diff line
@@ -480,7 +480,8 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti
	}

	if partitionType == "vendor" || partitionType == "product" {
		fsProps.Linker_config_srcs = f.createLinkerConfigSourceFilegroups(ctx, partitionType)
		fsProps.Linkerconfig.Gen_linker_config = proptools.BoolPtr(true)
		fsProps.Linkerconfig.Linker_config_srcs = f.createLinkerConfigSourceFilegroups(ctx, partitionType)
	}

	var module android.Module