Merge "Remove old-style support for translated second architectures"
This commit is contained in:
commit
c6136c9d65
|
@ -527,7 +527,6 @@ type Arch struct {
|
||||||
CpuVariant string
|
CpuVariant string
|
||||||
Abi []string
|
Abi []string
|
||||||
ArchFeatures []string
|
ArchFeatures []string
|
||||||
Native bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a Arch) String() string {
|
func (a Arch) String() string {
|
||||||
|
@ -1361,11 +1360,6 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
||||||
addTarget(Android, *variables.DeviceSecondaryArch,
|
addTarget(Android, *variables.DeviceSecondaryArch,
|
||||||
variables.DeviceSecondaryArchVariant, variables.DeviceSecondaryCpuVariant,
|
variables.DeviceSecondaryArchVariant, variables.DeviceSecondaryCpuVariant,
|
||||||
variables.DeviceSecondaryAbi, NativeBridgeDisabled, nil, nil)
|
variables.DeviceSecondaryAbi, NativeBridgeDisabled, nil, nil)
|
||||||
|
|
||||||
deviceArches := targets[Android]
|
|
||||||
if deviceArches[0].Arch.ArchType.Multilib == deviceArches[1].Arch.ArchType.Multilib {
|
|
||||||
deviceArches[1].Arch.Native = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if variables.NativeBridgeArch != nil && *variables.NativeBridgeArch != "" {
|
if variables.NativeBridgeArch != nil && *variables.NativeBridgeArch != "" {
|
||||||
|
@ -1513,7 +1507,7 @@ func decodeArchSettings(os OsType, archConfigs []archConfig) ([]Target, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
arch.Native = false
|
|
||||||
ret = append(ret, Target{
|
ret = append(ret, Target{
|
||||||
Os: Android,
|
Os: Android,
|
||||||
Arch: arch,
|
Arch: arch,
|
||||||
|
@ -1542,7 +1536,6 @@ func decodeArch(os OsType, arch string, archVariant, cpuVariant *string, abi []s
|
||||||
ArchVariant: stringPtr(archVariant),
|
ArchVariant: stringPtr(archVariant),
|
||||||
CpuVariant: stringPtr(cpuVariant),
|
CpuVariant: stringPtr(cpuVariant),
|
||||||
Abi: abi,
|
Abi: abi,
|
||||||
Native: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.ArchVariant == a.ArchType.Name || a.ArchVariant == "generic" {
|
if a.ArchVariant == a.ArchType.Name || a.ArchVariant == "generic" {
|
||||||
|
|
|
@ -93,6 +93,10 @@ type config struct {
|
||||||
BuildOsVariant string
|
BuildOsVariant string
|
||||||
BuildOsCommonVariant string
|
BuildOsCommonVariant string
|
||||||
|
|
||||||
|
// multilibConflicts for an ArchType is true if there is earlier configured device architecture with the same
|
||||||
|
// multilib value.
|
||||||
|
multilibConflicts map[ArchType]bool
|
||||||
|
|
||||||
deviceConfig *deviceConfig
|
deviceConfig *deviceConfig
|
||||||
|
|
||||||
srcDir string // the path of the root source directory
|
srcDir string // the path of the root source directory
|
||||||
|
@ -240,10 +244,10 @@ func TestArchConfigNativeBridge(buildDir string, env map[string]string) Config {
|
||||||
config := testConfig.config
|
config := testConfig.config
|
||||||
|
|
||||||
config.Targets[Android] = []Target{
|
config.Targets[Android] = []Target{
|
||||||
{Android, Arch{ArchType: X86_64, ArchVariant: "silvermont", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", ""},
|
{Android, Arch{ArchType: X86_64, ArchVariant: "silvermont", Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", ""},
|
||||||
{Android, Arch{ArchType: X86, ArchVariant: "silvermont", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled, "", ""},
|
{Android, Arch{ArchType: X86, ArchVariant: "silvermont", Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled, "", ""},
|
||||||
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeEnabled, "x86_64", "arm64"},
|
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Abi: []string{"arm64-v8a"}}, NativeBridgeEnabled, "x86_64", "arm64"},
|
||||||
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeEnabled, "x86", "arm"},
|
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Abi: []string{"armeabi-v7a"}}, NativeBridgeEnabled, "x86", "arm"},
|
||||||
}
|
}
|
||||||
|
|
||||||
return testConfig
|
return testConfig
|
||||||
|
@ -255,7 +259,7 @@ func TestArchConfigFuchsia(buildDir string, env map[string]string) Config {
|
||||||
|
|
||||||
config.Targets = map[OsType][]Target{
|
config.Targets = map[OsType][]Target{
|
||||||
Fuchsia: []Target{
|
Fuchsia: []Target{
|
||||||
{Fuchsia, Arch{ArchType: Arm64, ArchVariant: "", Native: true}, NativeBridgeDisabled, "", ""},
|
{Fuchsia, Arch{ArchType: Arm64, ArchVariant: ""}, NativeBridgeDisabled, "", ""},
|
||||||
},
|
},
|
||||||
BuildOs: []Target{
|
BuildOs: []Target{
|
||||||
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", ""},
|
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", ""},
|
||||||
|
@ -272,8 +276,8 @@ func TestArchConfig(buildDir string, env map[string]string) Config {
|
||||||
|
|
||||||
config.Targets = map[OsType][]Target{
|
config.Targets = map[OsType][]Target{
|
||||||
Android: []Target{
|
Android: []Target{
|
||||||
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", ""},
|
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", ""},
|
||||||
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled, "", ""},
|
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled, "", ""},
|
||||||
},
|
},
|
||||||
BuildOs: []Target{
|
BuildOs: []Target{
|
||||||
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", ""},
|
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", ""},
|
||||||
|
@ -307,6 +311,7 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
|
||||||
|
|
||||||
srcDir: srcDir,
|
srcDir: srcDir,
|
||||||
buildDir: buildDir,
|
buildDir: buildDir,
|
||||||
|
multilibConflicts: make(map[ArchType]bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
config.deviceConfig = &deviceConfig{
|
config.deviceConfig = &deviceConfig{
|
||||||
|
@ -360,6 +365,14 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
|
||||||
targets[Android] = androidTargets
|
targets[Android] = androidTargets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
multilib := make(map[string]bool)
|
||||||
|
for _, target := range targets[Android] {
|
||||||
|
if seen := multilib[target.Arch.ArchType.Multilib]; seen {
|
||||||
|
config.multilibConflicts[target.Arch.ArchType] = true
|
||||||
|
}
|
||||||
|
multilib[target.Arch.ArchType.Multilib] = true
|
||||||
|
}
|
||||||
|
|
||||||
config.Targets = targets
|
config.Targets = targets
|
||||||
config.BuildOsVariant = targets[BuildOs][0].String()
|
config.BuildOsVariant = targets[BuildOs][0].String()
|
||||||
config.BuildOsCommonVariant = getCommonTargets(targets[BuildOs])[0].String()
|
config.BuildOsCommonVariant = getCommonTargets(targets[BuildOs])[0].String()
|
||||||
|
@ -852,6 +865,10 @@ func (c *config) VndkSnapshotBuildArtifacts() bool {
|
||||||
return Bool(c.productVariables.VndkSnapshotBuildArtifacts)
|
return Bool(c.productVariables.VndkSnapshotBuildArtifacts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *config) HasMultilibConflict(arch ArchType) bool {
|
||||||
|
return c.multilibConflicts[arch]
|
||||||
|
}
|
||||||
|
|
||||||
func (c *deviceConfig) Arches() []Arch {
|
func (c *deviceConfig) Arches() []Arch {
|
||||||
var arches []Arch
|
var arches []Arch
|
||||||
for _, target := range c.config.Targets[Android] {
|
for _, target := range c.config.Targets[Android] {
|
||||||
|
@ -1009,19 +1026,6 @@ func findOverrideValue(overrides []string, name string, errorMsg string) (newVal
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecondArchIsTranslated returns true if the primary device arch is X86 or X86_64 and the device also has an arch
|
|
||||||
// that is Arm or Arm64.
|
|
||||||
func (c *config) SecondArchIsTranslated() bool {
|
|
||||||
deviceTargets := c.Targets[Android]
|
|
||||||
if len(deviceTargets) < 2 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
arch := deviceTargets[0].Arch
|
|
||||||
|
|
||||||
return (arch.ArchType == X86 || arch.ArchType == X86_64) && hasArmAndroidArch(deviceTargets)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *config) IntegerOverflowDisabledForPath(path string) bool {
|
func (c *config) IntegerOverflowDisabledForPath(path string) bool {
|
||||||
if c.productVariables.IntegerOverflowExcludePaths == nil {
|
if c.productVariables.IntegerOverflowExcludePaths == nil {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -869,9 +869,7 @@ func getCopyManifestForNativeLibrary(ccMod *cc.Module, config android.Config, ha
|
||||||
dirInApex = "lib64"
|
dirInApex = "lib64"
|
||||||
}
|
}
|
||||||
dirInApex = filepath.Join(dirInApex, ccMod.RelativeInstallPath())
|
dirInApex = filepath.Join(dirInApex, ccMod.RelativeInstallPath())
|
||||||
if !ccMod.Arch().Native {
|
if ccMod.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
dirInApex = filepath.Join(dirInApex, ccMod.Arch().ArchType.String())
|
|
||||||
} else if ccMod.Target().NativeBridge == android.NativeBridgeEnabled {
|
|
||||||
dirInApex = filepath.Join(dirInApex, ccMod.Target().NativeBridgeRelativePath)
|
dirInApex = filepath.Join(dirInApex, ccMod.Target().NativeBridgeRelativePath)
|
||||||
}
|
}
|
||||||
if handleSpecialLibs && cc.InstallToBootstrap(ccMod.BaseModuleName(), config) {
|
if handleSpecialLibs && cc.InstallToBootstrap(ccMod.BaseModuleName(), config) {
|
||||||
|
@ -894,9 +892,7 @@ func getCopyManifestForNativeLibrary(ccMod *cc.Module, config android.Config, ha
|
||||||
|
|
||||||
func getCopyManifestForExecutable(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
|
func getCopyManifestForExecutable(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
|
||||||
dirInApex = filepath.Join("bin", cc.RelativeInstallPath())
|
dirInApex = filepath.Join("bin", cc.RelativeInstallPath())
|
||||||
if !cc.Arch().Native {
|
if cc.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
dirInApex = filepath.Join(dirInApex, cc.Arch().ArchType.String())
|
|
||||||
} else if cc.Target().NativeBridge == android.NativeBridgeEnabled {
|
|
||||||
dirInApex = filepath.Join(dirInApex, cc.Target().NativeBridgeRelativePath)
|
dirInApex = filepath.Join(dirInApex, cc.Target().NativeBridgeRelativePath)
|
||||||
}
|
}
|
||||||
fileToCopy = cc.OutputFile().Path()
|
fileToCopy = cc.OutputFile().Path()
|
||||||
|
|
|
@ -1501,10 +1501,10 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
|
||||||
}
|
}
|
||||||
`, withTargets(map[android.OsType][]android.Target{
|
`, withTargets(map[android.OsType][]android.Target{
|
||||||
android.Android: []android.Target{
|
android.Android: []android.Target{
|
||||||
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm64, ArchVariant: "armv8-a", Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
||||||
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm, ArchVariant: "armv7-a-neon", Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
||||||
{Os: android.Android, Arch: android.Arch{ArchType: android.X86_64, ArchVariant: "silvermont", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm64", NativeBridgeRelativePath: "x86_64"},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.X86_64, ArchVariant: "silvermont", Abi: []string{"arm64-v8a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm64", NativeBridgeRelativePath: "x86_64"},
|
||||||
{Os: android.Android, Arch: android.Arch{ArchType: android.X86, ArchVariant: "silvermont", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm", NativeBridgeRelativePath: "x86"},
|
{Os: android.Android, Arch: android.Arch{ArchType: android.X86, ArchVariant: "silvermont", Abi: []string{"armeabi-v7a"}}, NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "arm", NativeBridgeRelativePath: "x86"},
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -453,7 +453,7 @@ func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
|
||||||
// Bionic binaries (e.g. linker) is installed to the bootstrap subdirectory.
|
// Bionic binaries (e.g. linker) is installed to the bootstrap subdirectory.
|
||||||
// The original path becomes a symlink to the corresponding file in the
|
// The original path becomes a symlink to the corresponding file in the
|
||||||
// runtime APEX.
|
// runtime APEX.
|
||||||
translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled || !ctx.Arch().Native
|
translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled
|
||||||
if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !translatedArch && ctx.apexName() == "" && !ctx.inRecovery() {
|
if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !translatedArch && ctx.apexName() == "" && !ctx.inRecovery() {
|
||||||
if ctx.Device() && isBionic(ctx.baseModuleName()) {
|
if ctx.Device() && isBionic(ctx.baseModuleName()) {
|
||||||
binary.installSymlinkToRuntimeApex(ctx, file)
|
binary.installSymlinkToRuntimeApex(ctx, file)
|
||||||
|
|
|
@ -66,11 +66,10 @@ func (installer *baseInstaller) installDir(ctx ModuleContext) android.InstallPat
|
||||||
if ctx.toolchain().Is64Bit() && installer.dir64 != "" {
|
if ctx.toolchain().Is64Bit() && installer.dir64 != "" {
|
||||||
dir = installer.dir64
|
dir = installer.dir64
|
||||||
}
|
}
|
||||||
if !ctx.Host() && !ctx.Arch().Native {
|
|
||||||
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
|
||||||
}
|
|
||||||
if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
dir = filepath.Join(dir, ctx.Target().NativeBridgeRelativePath)
|
dir = filepath.Join(dir, ctx.Target().NativeBridgeRelativePath)
|
||||||
|
} else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
|
||||||
|
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
||||||
}
|
}
|
||||||
if installer.location == InstallInData && ctx.useVndk() {
|
if installer.location == InstallInData && ctx.useVndk() {
|
||||||
dir = filepath.Join(dir, "vendor")
|
dir = filepath.Join(dir, "vendor")
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
|
||||||
// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
|
// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
|
||||||
// The original path becomes a symlink to the corresponding file in the
|
// The original path becomes a symlink to the corresponding file in the
|
||||||
// runtime APEX.
|
// runtime APEX.
|
||||||
translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled || !ctx.Arch().Native
|
translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled
|
||||||
if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && !translatedArch && !ctx.inRecovery() {
|
if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && !translatedArch && !ctx.inRecovery() {
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
library.installSymlinkToRuntimeApex(ctx, file)
|
library.installSymlinkToRuntimeApex(ctx, file)
|
||||||
|
|
|
@ -126,10 +126,6 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
|
||||||
archs = archs[:1]
|
archs = archs[:1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ctx.Config().SecondArchIsTranslated() {
|
|
||||||
// Only preopt primary arch for translated arch since there is only an image there.
|
|
||||||
archs = archs[:1]
|
|
||||||
}
|
|
||||||
|
|
||||||
var images android.Paths
|
var images android.Paths
|
||||||
var imagesDeps []android.Paths
|
var imagesDeps []android.Paths
|
||||||
|
|
|
@ -87,11 +87,7 @@ var systemServerClasspathKey = android.NewOnceKey("systemServerClasspath")
|
||||||
// supported through native bridge.
|
// supported through native bridge.
|
||||||
func dexpreoptTargets(ctx android.PathContext) []android.Target {
|
func dexpreoptTargets(ctx android.PathContext) []android.Target {
|
||||||
var targets []android.Target
|
var targets []android.Target
|
||||||
for i, target := range ctx.Config().Targets[android.Android] {
|
for _, target := range ctx.Config().Targets[android.Android] {
|
||||||
if ctx.Config().SecondArchIsTranslated() && i > 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if target.NativeBridge == android.NativeBridgeDisabled {
|
if target.NativeBridge == android.NativeBridgeDisabled {
|
||||||
targets = append(targets, target)
|
targets = append(targets, target)
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (installer *pythonInstaller) installDir(ctx android.ModuleContext) android.
|
||||||
if ctx.Arch().ArchType.Multilib == "lib64" && installer.dir64 != "" {
|
if ctx.Arch().ArchType.Multilib == "lib64" && installer.dir64 != "" {
|
||||||
dir = installer.dir64
|
dir = installer.dir64
|
||||||
}
|
}
|
||||||
if !ctx.Host() && !ctx.Arch().Native {
|
if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
|
||||||
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
||||||
}
|
}
|
||||||
return android.PathForModuleInstall(ctx, dir, installer.relative)
|
return android.PathForModuleInstall(ctx, dir, installer.relative)
|
||||||
|
|
|
@ -184,7 +184,7 @@ func (compiler *baseCompiler) installDir(ctx ModuleContext) android.InstallPath
|
||||||
if ctx.toolchain().Is64Bit() && compiler.dir64 != "" {
|
if ctx.toolchain().Is64Bit() && compiler.dir64 != "" {
|
||||||
dir = compiler.dir64
|
dir = compiler.dir64
|
||||||
}
|
}
|
||||||
if (!ctx.Host() && !ctx.Arch().Native) || ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
if !ctx.Host() || ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
||||||
}
|
}
|
||||||
return android.PathForModuleInstall(ctx, dir, compiler.subDir,
|
return android.PathForModuleInstall(ctx, dir, compiler.subDir,
|
||||||
|
|
Loading…
Reference in New Issue