Add support for preferred arch symlinks
am: 1e7d3706d6
Change-Id: Ie6c8657ebed06270fcdfc78fae952be0a7371ece
This commit is contained in:
@@ -75,6 +75,7 @@ type config struct {
|
|||||||
envFrozen bool
|
envFrozen bool
|
||||||
|
|
||||||
inMake bool
|
inMake bool
|
||||||
|
|
||||||
OncePer
|
OncePer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,6 +333,14 @@ func (c *config) AllowMissingDependencies() bool {
|
|||||||
return Bool(c.ProductVariables.Allow_missing_dependencies)
|
return Bool(c.ProductVariables.Allow_missing_dependencies)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *config) DevicePrefer32BitExecutables() bool {
|
||||||
|
return Bool(c.ProductVariables.DevicePrefer32BitExecutables)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *config) HostPrefer32BitExecutables() bool {
|
||||||
|
return Bool(c.ProductVariables.HostPrefer32BitExecutables)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *config) SkipDeviceInstall() bool {
|
func (c *config) SkipDeviceInstall() bool {
|
||||||
return c.EmbeddedInMake() || Bool(c.Mega_device)
|
return c.EmbeddedInMake() || Bool(c.Mega_device)
|
||||||
}
|
}
|
||||||
|
@@ -63,6 +63,7 @@ type androidBaseContext interface {
|
|||||||
Device() bool
|
Device() bool
|
||||||
Darwin() bool
|
Darwin() bool
|
||||||
Debug() bool
|
Debug() bool
|
||||||
|
PrimaryArch() bool
|
||||||
AConfig() Config
|
AConfig() Config
|
||||||
DeviceConfig() DeviceConfig
|
DeviceConfig() DeviceConfig
|
||||||
}
|
}
|
||||||
@@ -548,6 +549,10 @@ func (a *androidBaseContextImpl) Debug() bool {
|
|||||||
return a.debug
|
return a.debug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *androidBaseContextImpl) PrimaryArch() bool {
|
||||||
|
return a.target.Arch.ArchType == a.config.Targets[a.target.Os.Class][0].Arch.ArchType
|
||||||
|
}
|
||||||
|
|
||||||
func (a *androidBaseContextImpl) AConfig() Config {
|
func (a *androidBaseContextImpl) AConfig() Config {
|
||||||
return a.config
|
return a.config
|
||||||
}
|
}
|
||||||
|
@@ -102,6 +102,9 @@ type productVariables struct {
|
|||||||
Schedboost *bool `json:",omitempty"`
|
Schedboost *bool `json:",omitempty"`
|
||||||
Binder32bit *bool `json:",omitempty"`
|
Binder32bit *bool `json:",omitempty"`
|
||||||
|
|
||||||
|
DevicePrefer32BitExecutables *bool `json:",omitempty"`
|
||||||
|
HostPrefer32BitExecutables *bool `json:",omitempty"`
|
||||||
|
|
||||||
SanitizeHost *[]string `json:",omitempty"`
|
SanitizeHost *[]string `json:",omitempty"`
|
||||||
SanitizeDevice *[]string `json:",omitempty"`
|
SanitizeDevice *[]string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
@@ -125,6 +125,7 @@ func (object *objectLinker) AndroidMk(ctx AndroidMkContext, ret *android.Android
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
|
func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
|
||||||
|
ctx.subAndroidMk(ret, binary.baseInstaller)
|
||||||
ctx.subAndroidMk(ret, &binary.stripper)
|
ctx.subAndroidMk(ret, &binary.stripper)
|
||||||
|
|
||||||
ret.Class = "EXECUTABLES"
|
ret.Class = "EXECUTABLES"
|
||||||
|
25
cc/binary.go
25
cc/binary.go
@@ -34,6 +34,9 @@ type BinaryLinkerProperties struct {
|
|||||||
|
|
||||||
// if set, add an extra objcopy --prefix-symbols= step
|
// if set, add an extra objcopy --prefix-symbols= step
|
||||||
Prefix_symbols string
|
Prefix_symbols string
|
||||||
|
|
||||||
|
// if set, install a symlink to the preferred architecture
|
||||||
|
Symlink_preferred_arch bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -59,6 +62,7 @@ func binaryHostFactory() (blueprint.Module, []interface{}) {
|
|||||||
|
|
||||||
type binaryDecorator struct {
|
type binaryDecorator struct {
|
||||||
*baseLinker
|
*baseLinker
|
||||||
|
*baseInstaller
|
||||||
stripper
|
stripper
|
||||||
|
|
||||||
Properties BinaryLinkerProperties
|
Properties BinaryLinkerProperties
|
||||||
@@ -137,11 +141,12 @@ func (binary *binaryDecorator) isDependencyRoot() bool {
|
|||||||
func NewBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) {
|
func NewBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) {
|
||||||
module := newModule(hod, android.MultilibFirst)
|
module := newModule(hod, android.MultilibFirst)
|
||||||
binary := &binaryDecorator{
|
binary := &binaryDecorator{
|
||||||
baseLinker: NewBaseLinker(),
|
baseLinker: NewBaseLinker(),
|
||||||
|
baseInstaller: NewBaseInstaller("bin", "", InstallInSystem),
|
||||||
}
|
}
|
||||||
module.compiler = NewBaseCompiler()
|
module.compiler = NewBaseCompiler()
|
||||||
module.linker = binary
|
module.linker = binary
|
||||||
module.installer = NewBaseInstaller("bin", "", InstallInSystem)
|
module.installer = binary
|
||||||
return module, binary
|
return module, binary
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,6 +163,22 @@ func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
|
|||||||
binary.Properties.Static_executable = nil
|
binary.Properties.Static_executable = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if binary.Properties.Symlink_preferred_arch {
|
||||||
|
if binary.Properties.Stem == "" && binary.Properties.Suffix == "" {
|
||||||
|
ctx.PropertyErrorf("symlink_preferred_arch", "must also specify stem or suffix")
|
||||||
|
}
|
||||||
|
var prefer bool
|
||||||
|
if ctx.Host() {
|
||||||
|
prefer = ctx.AConfig().HostPrefer32BitExecutables()
|
||||||
|
} else {
|
||||||
|
prefer = ctx.AConfig().DevicePrefer32BitExecutables()
|
||||||
|
}
|
||||||
|
if ctx.PrimaryArch() != prefer {
|
||||||
|
binary.baseInstaller.Properties.Symlinks = append(binary.baseInstaller.Properties.Symlinks,
|
||||||
|
ctx.ModuleName())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (binary *binaryDecorator) static() bool {
|
func (binary *binaryDecorator) static() bool {
|
||||||
|
Reference in New Issue
Block a user