Statically link the unwinder into binaries packaged into an unbundled APEX with legacy_android10_support: true.
Bug: 149075752
Test: tapas com.android.conscrypt com.android.tethering arm64
Test: m out/target/product/generic_arm64/{,symbols/}apex/com.android.{tethering,conscrypt}/lib64/libc++.so
Test: Verified that unwinder was dynamically linked to tethering's
Test: libc++ and statically linked to conscrypt's.
Test: lunch flame-userdebug && m
Test: Verified that unwinder was dynamically linked to /system/lib64/libc++.so
Change-Id: I98eed7cb4316962b19b5c12e150c224c25d0e91d
diff --git a/cc/cc.go b/cc/cc.go
index e55c576..9ab176c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -95,6 +95,8 @@
HeaderLibs []string
RuntimeLibs []string
+ StaticUnwinderIfLegacy bool
+
ReexportSharedLibHeaders, ReexportStaticLibHeaders, ReexportHeaderLibHeaders []string
ObjFiles []string
@@ -385,6 +387,7 @@
lateSharedDepTag = DependencyTag{Name: "late shared", Library: true, Shared: true}
staticExportDepTag = DependencyTag{Name: "static", Library: true, ReexportFlags: true}
lateStaticDepTag = DependencyTag{Name: "late static", Library: true}
+ staticUnwinderDepTag = DependencyTag{Name: "static unwinder", Library: true}
wholeStaticDepTag = DependencyTag{Name: "whole static", Library: true, ReexportFlags: true}
headerDepTag = DependencyTag{Name: "header", Library: true}
headerExportDepTag = DependencyTag{Name: "header", Library: true, ReexportFlags: true}
@@ -1796,6 +1799,12 @@
}, depTag, lib)
}
+ if deps.StaticUnwinderIfLegacy && ctx.Config().UnbundledBuild() {
+ actx.AddVariationDependencies([]blueprint.Variation{
+ {Mutator: "link", Variation: "static"},
+ }, staticUnwinderDepTag, staticUnwinder(actx))
+ }
+
for _, lib := range deps.LateStaticLibs {
actx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
@@ -2169,6 +2178,14 @@
}
}
+ if depTag == staticUnwinderDepTag {
+ if c.ApexProperties.Info.LegacyAndroid10Support {
+ depTag = StaticDepTag
+ } else {
+ return
+ }
+ }
+
// Extract ExplicitlyVersioned field from the depTag and reset it inside the struct.
// Otherwise, SharedDepTag and lateSharedDepTag with ExplicitlyVersioned set to true
// won't be matched to SharedDepTag and lateSharedDepTag.