From 67118217ce5b17d5b48e3806595f3a62726a46cc Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Thu, 7 Nov 2024 13:23:44 +0900 Subject: Use common interface to build linker configuration Current filesystem logic is quite separated with systemimage, so it can end up generating linker configuration twice which can end up an error case. This change creates a common interface and let both filesystem and systemimage can implement their own function to generate linker configuration. Bug: 324995772 Test: Compared linker.config.pb of generic_system_image with this patch Change-Id: Ic515e54deeafbae74fd02bb023661606aa7e0b7c --- filesystem/filesystem_test.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'filesystem/filesystem_test.go') diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index 29f9373d7..205a216a0 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -156,11 +156,15 @@ func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) { result := fixture.RunTestWithBp(t, ` android_system_image { name: "myfilesystem", + base_dir: "system", deps: [ "libfoo", "libbar", ], - linker_config_src: "linker.config.json", + linkerconfig: { + gen_linker_config: true, + linker_config_srcs: ["linker.config.json"], + }, } cc_library { @@ -176,7 +180,7 @@ func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) { `) module := result.ModuleForTests("myfilesystem", "android_common") - output := module.Output("system/etc/linker.config.pb") + output := module.Output("out/soong/.intermediates/myfilesystem/android_common/root/system/etc/linker.config.pb") android.AssertStringDoesContain(t, "linker.config.pb should have libfoo", output.RuleParams.Command, "libfoo.so") @@ -223,7 +227,10 @@ func TestFileSystemGathersItemsOnlyInSystemPartition(t *testing.T) { deps: ["foo"], }, }, - linker_config_src: "linker.config.json", + linkerconfig: { + gen_linker_config: true, + linker_config_srcs: ["linker.config.json"], + }, } component { name: "foo", @@ -318,7 +325,10 @@ func TestFileSystemWithCoverageVariants(t *testing.T) { deps: [ "libfoo", ], - linker_config_src: "linker.config.json", + linkerconfig: { + gen_linker_config: true, + linker_config_srcs: ["linker.config.json"], + }, } cc_library { @@ -671,8 +681,8 @@ android_filesystem { name: "myfilesystem", deps: ["libfoo_has_no_stubs", "libfoo_has_stubs"], linkerconfig: { - gen_linker_config: true, - linker_config_srcs: ["linker.config.json"], + gen_linker_config: true, + linker_config_srcs: ["linker.config.json"], }, partition_type: "vendor", } -- cgit v1.2.3-59-g8ed1b