Propagate empty vs unspecified system_shared_libs correctly.
Necessary to get correct prebuilts for many Bionic libs.
Cleaned up numerious "system_shared_libs: []" from test fixtures, since
they otherwise would need correction in the expected results, and it is
better to have a single test focused on testing system_shared_libs
propagation.
Test: m nothing
Bug: 152255951
Merged-In: If2e8a5296223e6281d833312660e8e9e4cd184c0
Change-Id: If2e8a5296223e6281d833312660e8e9e4cd184c0
(cherry picked from commit 10566a035f648cd85b9af444b06cc2eb9975a9ef)
diff --git a/cc/linker.go b/cc/linker.go
index 9b2c1e7..d56c733 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -503,7 +503,15 @@
func (linker *baseLinker) linkerSpecifiedDeps(specifiedDeps specifiedDeps) specifiedDeps {
specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, linker.Properties.Shared_libs...)
- specifiedDeps.systemSharedLibs = append(specifiedDeps.systemSharedLibs, linker.Properties.System_shared_libs...)
+
+ // Must distinguish nil and [] in system_shared_libs - ensure that [] in
+ // either input list doesn't come out as nil.
+ if specifiedDeps.systemSharedLibs == nil {
+ specifiedDeps.systemSharedLibs = linker.Properties.System_shared_libs
+ } else {
+ specifiedDeps.systemSharedLibs = append(specifiedDeps.systemSharedLibs, linker.Properties.System_shared_libs...)
+ }
+
return specifiedDeps
}