2016-07-29 21:48:20 +02:00
|
|
|
// Copyright 2016 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"android/soong/android"
|
|
|
|
)
|
|
|
|
|
|
|
|
type BinaryLinkerProperties struct {
|
|
|
|
// compile executable with -static
|
|
|
|
Static_executable *bool `android:"arch_variant"`
|
|
|
|
|
|
|
|
// set the name of the output
|
2017-11-07 19:57:05 +01:00
|
|
|
Stem *string `android:"arch_variant"`
|
2016-07-29 21:48:20 +02:00
|
|
|
|
|
|
|
// append to the name of the output
|
2017-11-07 19:57:05 +01:00
|
|
|
Suffix *string `android:"arch_variant"`
|
2016-07-29 21:48:20 +02:00
|
|
|
|
|
|
|
// if set, add an extra objcopy --prefix-symbols= step
|
2017-11-07 19:57:05 +01:00
|
|
|
Prefix_symbols *string
|
2016-08-25 00:25:47 +02:00
|
|
|
|
2017-08-29 15:00:01 +02:00
|
|
|
// local file name to pass to the linker as --version_script
|
|
|
|
Version_script *string `android:"arch_variant"`
|
|
|
|
|
2016-08-25 00:25:47 +02:00
|
|
|
// if set, install a symlink to the preferred architecture
|
2017-11-07 19:57:05 +01:00
|
|
|
Symlink_preferred_arch *bool
|
2016-09-07 22:14:06 +02:00
|
|
|
|
2016-12-07 22:37:42 +01:00
|
|
|
// install symlinks to the binary. Symlink names will have the suffix and the binary
|
|
|
|
// extension (if any) appended
|
|
|
|
Symlinks []string `android:"arch_variant"`
|
|
|
|
|
2017-01-31 07:44:19 +01:00
|
|
|
// do not pass -pie
|
|
|
|
No_pie *bool `android:"arch_variant"`
|
|
|
|
|
2016-09-07 22:14:06 +02:00
|
|
|
DynamicLinker string `blueprint:"mutated"`
|
2018-04-03 22:22:50 +02:00
|
|
|
|
|
|
|
// Names of modules to be overridden. Listed modules can only be other binaries
|
|
|
|
// (in Make or Soong).
|
|
|
|
// This does not completely prevent installation of the overridden binaries, but if both
|
|
|
|
// binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
|
|
|
|
// from PRODUCT_PACKAGES.
|
|
|
|
Overrides []string
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-10-12 23:28:16 +02:00
|
|
|
android.RegisterModuleType("cc_binary", binaryFactory)
|
|
|
|
android.RegisterModuleType("cc_binary_host", binaryHostFactory)
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Module factory for binaries
|
2017-06-24 00:06:31 +02:00
|
|
|
func binaryFactory() android.Module {
|
2016-07-30 02:28:03 +02:00
|
|
|
module, _ := NewBinary(android.HostAndDeviceSupported)
|
2016-07-29 21:48:20 +02:00
|
|
|
return module.Init()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Module factory for host binaries
|
2017-06-24 00:06:31 +02:00
|
|
|
func binaryHostFactory() android.Module {
|
2016-07-30 02:28:03 +02:00
|
|
|
module, _ := NewBinary(android.HostSupported)
|
2016-07-29 21:48:20 +02:00
|
|
|
return module.Init()
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Executables
|
|
|
|
//
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
type binaryDecorator struct {
|
|
|
|
*baseLinker
|
2016-08-25 00:25:47 +02:00
|
|
|
*baseInstaller
|
2016-07-29 21:48:20 +02:00
|
|
|
stripper
|
|
|
|
|
|
|
|
Properties BinaryLinkerProperties
|
|
|
|
|
2016-09-29 01:18:03 +02:00
|
|
|
toolPath android.OptionalPath
|
2016-12-07 22:37:42 +01:00
|
|
|
|
|
|
|
// Names of symlinks to be installed for use in LOCAL_MODULE_SYMLINKS
|
|
|
|
symlinks []string
|
2017-02-10 01:16:31 +01:00
|
|
|
|
|
|
|
// Output archive of gcno coverage information
|
|
|
|
coverageOutputFile android.OptionalPath
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
var _ linker = (*binaryDecorator)(nil)
|
2016-07-29 21:48:20 +02:00
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
func (binary *binaryDecorator) linkerProps() []interface{} {
|
2016-08-01 22:20:05 +02:00
|
|
|
return append(binary.baseLinker.linkerProps(),
|
2016-07-29 21:48:20 +02:00
|
|
|
&binary.Properties,
|
|
|
|
&binary.stripper.StripProperties)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
func (binary *binaryDecorator) getStem(ctx BaseModuleContext) string {
|
2016-10-07 01:12:58 +02:00
|
|
|
stem := ctx.baseModuleName()
|
2017-11-07 19:57:05 +01:00
|
|
|
if String(binary.Properties.Stem) != "" {
|
|
|
|
stem = String(binary.Properties.Stem)
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
2017-11-07 19:57:05 +01:00
|
|
|
return stem + String(binary.Properties.Suffix)
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
2016-12-14 02:06:13 +01:00
|
|
|
func (binary *binaryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
2016-08-01 22:20:05 +02:00
|
|
|
deps = binary.baseLinker.linkerDeps(ctx, deps)
|
2016-11-17 10:02:25 +01:00
|
|
|
if ctx.toolchain().Bionic() {
|
2016-07-29 21:48:20 +02:00
|
|
|
if !Bool(binary.baseLinker.Properties.Nocrt) {
|
2017-09-28 02:01:44 +02:00
|
|
|
if !ctx.useSdk() {
|
2016-07-30 02:28:03 +02:00
|
|
|
if binary.static() {
|
2016-07-29 21:48:20 +02:00
|
|
|
deps.CrtBegin = "crtbegin_static"
|
|
|
|
} else {
|
|
|
|
deps.CrtBegin = "crtbegin_dynamic"
|
|
|
|
}
|
|
|
|
deps.CrtEnd = "crtend_android"
|
|
|
|
} else {
|
2016-11-09 00:06:22 +01:00
|
|
|
// TODO(danalbert): Add generation of crt objects.
|
|
|
|
// For `sdk_version: "current"`, we don't actually have a
|
|
|
|
// freshly generated set of CRT objects. Use the last stable
|
|
|
|
// version.
|
|
|
|
version := ctx.sdkVersion()
|
|
|
|
if version == "current" {
|
2017-05-09 19:21:52 +02:00
|
|
|
version = getCurrentNdkPrebuiltVersion(ctx)
|
2016-11-09 00:06:22 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
if binary.static() {
|
2016-11-09 00:06:22 +01:00
|
|
|
deps.CrtBegin = "ndk_crtbegin_static." + version
|
2016-07-29 21:48:20 +02:00
|
|
|
} else {
|
2016-07-30 02:28:03 +02:00
|
|
|
if binary.static() {
|
2016-11-09 00:06:22 +01:00
|
|
|
deps.CrtBegin = "ndk_crtbegin_static." + version
|
2016-07-29 21:48:20 +02:00
|
|
|
} else {
|
2016-11-09 00:06:22 +01:00
|
|
|
deps.CrtBegin = "ndk_crtbegin_dynamic." + version
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
2016-11-09 00:06:22 +01:00
|
|
|
deps.CrtEnd = "ndk_crtend_android." + version
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
if binary.static() {
|
2017-01-27 02:44:26 +01:00
|
|
|
if ctx.selectedStl() == "libc++_static" {
|
2016-07-29 21:48:20 +02:00
|
|
|
deps.StaticLibs = append(deps.StaticLibs, "libm", "libc", "libdl")
|
|
|
|
}
|
|
|
|
// static libraries libcompiler_rt, libc and libc_nomalloc need to be linked with
|
|
|
|
// --start-group/--end-group along with libgcc. If they are in deps.StaticLibs,
|
|
|
|
// move them to the beginning of deps.LateStaticLibs
|
|
|
|
var groupLibs []string
|
|
|
|
deps.StaticLibs, groupLibs = filterList(deps.StaticLibs,
|
|
|
|
[]string{"libc", "libc_nomalloc", "libcompiler_rt"})
|
|
|
|
deps.LateStaticLibs = append(groupLibs, deps.LateStaticLibs...)
|
|
|
|
}
|
2017-09-19 08:19:12 +02:00
|
|
|
|
|
|
|
if ctx.Os() == android.LinuxBionic && !binary.static() {
|
|
|
|
deps.LinkerScript = "host_bionic_linker_script"
|
|
|
|
}
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
if !binary.static() && inList("libc", deps.StaticLibs) {
|
2016-07-29 21:48:20 +02:00
|
|
|
ctx.ModuleErrorf("statically linking libc to dynamic executable, please remove libc\n" +
|
|
|
|
"from static libs or set static_executable: true")
|
|
|
|
}
|
2018-02-06 23:40:13 +01:00
|
|
|
|
|
|
|
android.ExtractSourceDeps(ctx, binary.Properties.Version_script)
|
|
|
|
|
2016-07-29 21:48:20 +02:00
|
|
|
return deps
|
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
func (binary *binaryDecorator) isDependencyRoot() bool {
|
2016-07-29 21:48:20 +02:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
func NewBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) {
|
2016-07-29 21:48:20 +02:00
|
|
|
module := newModule(hod, android.MultilibFirst)
|
2016-07-30 02:28:03 +02:00
|
|
|
binary := &binaryDecorator{
|
2016-08-25 00:25:47 +02:00
|
|
|
baseLinker: NewBaseLinker(),
|
|
|
|
baseInstaller: NewBaseInstaller("bin", "", InstallInSystem),
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
2016-07-30 02:28:03 +02:00
|
|
|
module.compiler = NewBaseCompiler()
|
|
|
|
module.linker = binary
|
2016-08-25 00:25:47 +02:00
|
|
|
module.installer = binary
|
2016-07-30 02:28:03 +02:00
|
|
|
return module, binary
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
|
2016-08-01 22:20:05 +02:00
|
|
|
binary.baseLinker.linkerInit(ctx)
|
2016-07-29 21:48:20 +02:00
|
|
|
|
2016-11-17 10:02:25 +01:00
|
|
|
if !ctx.toolchain().Bionic() {
|
2016-07-29 21:48:20 +02:00
|
|
|
if ctx.Os() == android.Linux {
|
2018-03-12 23:30:26 +01:00
|
|
|
if binary.Properties.Static_executable == nil && ctx.Config().HostStaticBinaries() {
|
2017-11-07 19:57:05 +01:00
|
|
|
binary.Properties.Static_executable = BoolPtr(true)
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Static executables are not supported on Darwin or Windows
|
2016-07-30 02:28:03 +02:00
|
|
|
binary.Properties.Static_executable = nil
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
func (binary *binaryDecorator) static() bool {
|
|
|
|
return Bool(binary.Properties.Static_executable)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (binary *binaryDecorator) staticBinary() bool {
|
|
|
|
return binary.static()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
2016-08-01 22:20:05 +02:00
|
|
|
flags = binary.baseLinker.linkerFlags(ctx, flags)
|
2016-07-29 21:48:20 +02:00
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
if ctx.Host() && !binary.static() {
|
2017-11-29 09:27:14 +01:00
|
|
|
if !ctx.Config().IsEnvTrue("DISABLE_HOST_PIE") {
|
2017-01-31 07:44:19 +01:00
|
|
|
flags.LdFlags = append(flags.LdFlags, "-pie")
|
2017-04-04 21:59:48 +02:00
|
|
|
if ctx.Windows() {
|
2017-01-31 07:44:19 +01:00
|
|
|
flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
|
|
|
|
}
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
|
|
|
|
// all code is position independent, and then those warnings get promoted to
|
|
|
|
// errors.
|
2017-04-04 21:59:48 +02:00
|
|
|
if !ctx.Windows() {
|
2017-04-18 01:21:41 +02:00
|
|
|
flags.CFlags = append(flags.CFlags, "-fPIE")
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
|
2016-11-17 10:02:25 +01:00
|
|
|
if ctx.toolchain().Bionic() {
|
2016-07-30 02:28:03 +02:00
|
|
|
if binary.static() {
|
2016-07-29 21:48:20 +02:00
|
|
|
// Clang driver needs -static to create static executable.
|
|
|
|
// However, bionic/linker uses -shared to overwrite.
|
|
|
|
// Linker for x86 targets does not allow coexistance of -static and -shared,
|
|
|
|
// so we add -static only if -shared is not used.
|
|
|
|
if !inList("-shared", flags.LdFlags) {
|
|
|
|
flags.LdFlags = append(flags.LdFlags, "-static")
|
|
|
|
}
|
|
|
|
|
|
|
|
flags.LdFlags = append(flags.LdFlags,
|
|
|
|
"-nostdlib",
|
|
|
|
"-Bstatic",
|
|
|
|
"-Wl,--gc-sections",
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
if flags.DynamicLinker == "" {
|
2016-09-07 22:14:06 +02:00
|
|
|
if binary.Properties.DynamicLinker != "" {
|
|
|
|
flags.DynamicLinker = binary.Properties.DynamicLinker
|
|
|
|
} else {
|
2016-06-14 02:19:03 +02:00
|
|
|
switch ctx.Os() {
|
|
|
|
case android.Android:
|
|
|
|
flags.DynamicLinker = "/system/bin/linker"
|
|
|
|
case android.LinuxBionic:
|
2017-09-19 08:19:12 +02:00
|
|
|
flags.DynamicLinker = ""
|
2016-06-14 02:19:03 +02:00
|
|
|
default:
|
|
|
|
ctx.ModuleErrorf("unknown dynamic linker")
|
|
|
|
}
|
2016-09-07 22:14:06 +02:00
|
|
|
if flags.Toolchain.Is64Bit() {
|
|
|
|
flags.DynamicLinker += "64"
|
|
|
|
}
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
flags.LdFlags = append(flags.LdFlags,
|
|
|
|
"-pie",
|
|
|
|
"-nostdlib",
|
|
|
|
"-Bdynamic",
|
|
|
|
"-Wl,--gc-sections",
|
|
|
|
"-Wl,-z,nocopyreloc",
|
|
|
|
)
|
2017-08-29 15:00:01 +02:00
|
|
|
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|
|
|
|
} else {
|
2016-07-30 02:28:03 +02:00
|
|
|
if binary.static() {
|
2016-07-29 21:48:20 +02:00
|
|
|
flags.LdFlags = append(flags.LdFlags, "-static")
|
|
|
|
}
|
|
|
|
if ctx.Darwin() {
|
|
|
|
flags.LdFlags = append(flags.LdFlags, "-Wl,-headerpad_max_install_names")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return flags
|
|
|
|
}
|
|
|
|
|
2016-07-30 02:28:03 +02:00
|
|
|
func (binary *binaryDecorator) link(ctx ModuleContext,
|
2016-09-27 02:33:01 +02:00
|
|
|
flags Flags, deps PathDeps, objs Objects) android.Path {
|
2016-07-29 21:48:20 +02:00
|
|
|
|
2018-02-06 23:40:13 +01:00
|
|
|
versionScript := ctx.ExpandOptionalSource(binary.Properties.Version_script, "version_script")
|
2016-07-29 21:48:20 +02:00
|
|
|
fileName := binary.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
|
|
|
|
outputFile := android.PathForModuleOut(ctx, fileName)
|
|
|
|
ret := outputFile
|
|
|
|
|
|
|
|
var linkerDeps android.Paths
|
|
|
|
|
|
|
|
sharedLibs := deps.SharedLibs
|
|
|
|
sharedLibs = append(sharedLibs, deps.LateSharedLibs...)
|
|
|
|
|
2017-08-29 15:00:01 +02:00
|
|
|
if versionScript.Valid() {
|
|
|
|
if ctx.Darwin() {
|
|
|
|
ctx.PropertyErrorf("version_script", "Not supported on Darwin")
|
|
|
|
} else {
|
|
|
|
flags.LdFlags = append(flags.LdFlags, "-Wl,--version-script,"+versionScript.String())
|
|
|
|
linkerDeps = append(linkerDeps, versionScript.Path())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-19 08:19:12 +02:00
|
|
|
if deps.LinkerScript.Valid() {
|
|
|
|
flags.LdFlags = append(flags.LdFlags, "-Wl,-T,"+deps.LinkerScript.String())
|
|
|
|
linkerDeps = append(linkerDeps, deps.LinkerScript.Path())
|
|
|
|
}
|
|
|
|
|
2016-07-29 21:48:20 +02:00
|
|
|
if flags.DynamicLinker != "" {
|
|
|
|
flags.LdFlags = append(flags.LdFlags, " -Wl,-dynamic-linker,"+flags.DynamicLinker)
|
|
|
|
}
|
|
|
|
|
|
|
|
builderFlags := flagsToBuilderFlags(flags)
|
|
|
|
|
|
|
|
if binary.stripper.needsStrip(ctx) {
|
2018-06-04 19:37:43 +02:00
|
|
|
// b/80093681, GNU strip/objcopy bug.
|
|
|
|
// Use llvm-{strip,objcopy} when clang lld is used.
|
|
|
|
builderFlags.stripUseLlvmStrip =
|
|
|
|
flags.Clang && binary.baseLinker.useClangLld(ctx)
|
2016-07-29 21:48:20 +02:00
|
|
|
strippedOutputFile := outputFile
|
|
|
|
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
|
|
|
|
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
|
|
|
}
|
|
|
|
|
2017-11-07 19:57:05 +01:00
|
|
|
if String(binary.Properties.Prefix_symbols) != "" {
|
2016-07-29 21:48:20 +02:00
|
|
|
afterPrefixSymbols := outputFile
|
|
|
|
outputFile = android.PathForModuleOut(ctx, "unprefixed", fileName)
|
2017-11-07 19:57:05 +01:00
|
|
|
TransformBinaryPrefixSymbols(ctx, String(binary.Properties.Prefix_symbols), outputFile,
|
2016-07-29 21:48:20 +02:00
|
|
|
flagsToBuilderFlags(flags), afterPrefixSymbols)
|
|
|
|
}
|
|
|
|
|
2018-02-15 23:12:26 +01:00
|
|
|
if Bool(binary.baseLinker.Properties.Use_version_lib) && ctx.Host() {
|
|
|
|
versionedOutputFile := outputFile
|
|
|
|
outputFile = android.PathForModuleOut(ctx, "unversioned", fileName)
|
|
|
|
binary.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
|
|
|
|
}
|
|
|
|
|
2016-10-01 02:10:16 +02:00
|
|
|
linkerDeps = append(linkerDeps, deps.SharedLibsDeps...)
|
|
|
|
linkerDeps = append(linkerDeps, deps.LateSharedLibsDeps...)
|
2016-09-27 00:45:04 +02:00
|
|
|
linkerDeps = append(linkerDeps, objs.tidyFiles...)
|
2017-09-01 08:38:27 +02:00
|
|
|
linkerDeps = append(linkerDeps, flags.LdFlagsDeps...)
|
2016-10-01 02:10:16 +02:00
|
|
|
|
2016-09-27 02:33:01 +02:00
|
|
|
TransformObjToDynamicBinary(ctx, objs.objFiles, sharedLibs, deps.StaticLibs,
|
2016-07-29 21:48:20 +02:00
|
|
|
deps.LateStaticLibs, deps.WholeStaticLibs, linkerDeps, deps.CrtBegin, deps.CrtEnd, true,
|
|
|
|
builderFlags, outputFile)
|
|
|
|
|
2017-02-10 01:16:31 +01:00
|
|
|
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
|
|
|
|
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)
|
|
|
|
binary.coverageOutputFile = TransformCoverageFilesToLib(ctx, objs, builderFlags, binary.getStem(ctx))
|
|
|
|
|
2016-07-29 21:48:20 +02:00
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2016-09-29 01:18:03 +02:00
|
|
|
func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
|
|
|
|
binary.baseInstaller.install(ctx, file)
|
2016-12-07 22:37:42 +01:00
|
|
|
for _, symlink := range binary.Properties.Symlinks {
|
|
|
|
binary.symlinks = append(binary.symlinks,
|
2017-11-07 19:57:05 +01:00
|
|
|
symlink+String(binary.Properties.Suffix)+ctx.toolchain().ExecutableSuffix())
|
2016-12-07 22:37:42 +01:00
|
|
|
}
|
|
|
|
|
2017-11-07 19:57:05 +01:00
|
|
|
if Bool(binary.Properties.Symlink_preferred_arch) {
|
|
|
|
if String(binary.Properties.Stem) == "" && String(binary.Properties.Suffix) == "" {
|
2016-12-07 22:37:42 +01:00
|
|
|
ctx.PropertyErrorf("symlink_preferred_arch", "must also specify stem or suffix")
|
|
|
|
}
|
|
|
|
if ctx.TargetPrimary() {
|
|
|
|
binary.symlinks = append(binary.symlinks, ctx.baseModuleName())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, symlink := range binary.symlinks {
|
|
|
|
ctx.InstallSymlink(binary.baseInstaller.installDir(ctx), symlink, binary.baseInstaller.path)
|
|
|
|
}
|
|
|
|
|
2016-09-29 01:18:03 +02:00
|
|
|
if ctx.Os().Class == android.Host {
|
|
|
|
binary.toolPath = android.OptionalPathForPath(binary.baseInstaller.path)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (binary *binaryDecorator) hostToolPath() android.OptionalPath {
|
|
|
|
return binary.toolPath
|
2016-07-29 21:48:20 +02:00
|
|
|
}
|