Add Toolchain.Bionic()
am: 2e47b34435
Change-Id: I66b2502c56b3b44794679cd258ec0dc8c194012d
This commit is contained in:
commit
21cd6c847e
9 changed files with 30 additions and 9 deletions
|
@ -209,6 +209,7 @@ cc_defaults {
|
|||
|
||||
toolchain_library {
|
||||
name: "libatomic",
|
||||
defaults: ["linux_bionic_supported"],
|
||||
arch: {
|
||||
arm: {
|
||||
instruction_set: "arm",
|
||||
|
@ -218,6 +219,7 @@ toolchain_library {
|
|||
|
||||
toolchain_library {
|
||||
name: "libgcc",
|
||||
defaults: ["linux_bionic_supported"],
|
||||
arch: {
|
||||
arm: {
|
||||
instruction_set: "arm",
|
||||
|
@ -227,6 +229,7 @@ toolchain_library {
|
|||
|
||||
toolchain_library {
|
||||
name: "libgcov",
|
||||
defaults: ["linux_bionic_supported"],
|
||||
arch: {
|
||||
arm: {
|
||||
instruction_set: "arm",
|
||||
|
|
|
@ -91,7 +91,7 @@ func (binary *binaryDecorator) getStem(ctx BaseModuleContext) string {
|
|||
|
||||
func (binary *binaryDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
||||
deps = binary.baseLinker.linkerDeps(ctx, deps)
|
||||
if ctx.Device() {
|
||||
if ctx.toolchain().Bionic() {
|
||||
if !Bool(binary.baseLinker.Properties.Nocrt) {
|
||||
if !ctx.sdk() {
|
||||
if binary.static() {
|
||||
|
@ -163,7 +163,7 @@ func NewBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) {
|
|||
func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
|
||||
binary.baseLinker.linkerInit(ctx)
|
||||
|
||||
if ctx.Host() {
|
||||
if !ctx.toolchain().Bionic() {
|
||||
if ctx.Os() == android.Linux {
|
||||
if binary.Properties.Static_executable == nil && Bool(ctx.AConfig().ProductVariables.HostStaticBinaries) {
|
||||
binary.Properties.Static_executable = proptools.BoolPtr(true)
|
||||
|
@ -210,7 +210,7 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags
|
|||
flags.CFlags = append(flags.CFlags, "-fpie")
|
||||
}
|
||||
|
||||
if ctx.Device() {
|
||||
if ctx.toolchain().Bionic() {
|
||||
if binary.static() {
|
||||
// Clang driver needs -static to create static executable.
|
||||
// However, bionic/linker uses -shared to overwrite.
|
||||
|
|
|
@ -74,6 +74,8 @@ type Toolchain interface {
|
|||
SanitizerRuntimeLibraryArch() string
|
||||
|
||||
AvailableLibraries() []string
|
||||
|
||||
Bionic() bool
|
||||
}
|
||||
|
||||
type toolchainBase struct {
|
||||
|
@ -133,6 +135,10 @@ func (toolchainBase) AvailableLibraries() []string {
|
|||
return []string{}
|
||||
}
|
||||
|
||||
func (toolchainBase) Bionic() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type toolchain64Bit struct {
|
||||
toolchainBase
|
||||
}
|
||||
|
|
|
@ -269,6 +269,10 @@ func (t *toolchainDarwin) AvailableLibraries() []string {
|
|||
return darwinAvailableLibraries
|
||||
}
|
||||
|
||||
func (t *toolchainDarwin) Bionic() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var toolchainDarwinX86Singleton Toolchain = &toolchainDarwinX86{}
|
||||
var toolchainDarwinX8664Singleton Toolchain = &toolchainDarwinX8664{}
|
||||
|
||||
|
|
|
@ -256,6 +256,10 @@ func (t *toolchainLinux) AvailableLibraries() []string {
|
|||
return linuxAvailableLibraries
|
||||
}
|
||||
|
||||
func (t *toolchainLinux) Bionic() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var toolchainLinuxX86Singleton Toolchain = &toolchainLinuxX86{}
|
||||
var toolchainLinuxX8664Singleton Toolchain = &toolchainLinuxX8664{}
|
||||
|
||||
|
|
|
@ -202,6 +202,10 @@ func (t *toolchainWindows) AvailableLibraries() []string {
|
|||
return windowsAvailableLibraries
|
||||
}
|
||||
|
||||
func (t *toolchainWindows) Bionic() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var toolchainWindowsX86Singleton Toolchain = &toolchainWindowsX86{}
|
||||
var toolchainWindowsX8664Singleton Toolchain = &toolchainWindowsX8664{}
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ func (library *libraryDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) De
|
|||
deps.StaticLibs = append(deps.StaticLibs, library.Properties.Static.Static_libs...)
|
||||
deps.SharedLibs = append(deps.SharedLibs, library.Properties.Static.Shared_libs...)
|
||||
} else {
|
||||
if ctx.Device() && !Bool(library.baseLinker.Properties.Nocrt) {
|
||||
if ctx.toolchain().Bionic() && !Bool(library.baseLinker.Properties.Nocrt) {
|
||||
if !ctx.sdk() {
|
||||
deps.CrtBegin = "crtbegin_so"
|
||||
deps.CrtEnd = "crtend_so"
|
||||
|
|
|
@ -119,7 +119,7 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
|||
deps.LateStaticLibs = append(deps.LateStaticLibs, "libcompiler_rt-extras")
|
||||
}
|
||||
|
||||
if ctx.Device() {
|
||||
if ctx.toolchain().Bionic() {
|
||||
// libgcc and libatomic have to be last on the command line
|
||||
deps.LateStaticLibs = append(deps.LateStaticLibs, "libatomic")
|
||||
if !Bool(linker.Properties.No_libgcc) {
|
||||
|
@ -165,7 +165,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||
flags.LdFlags = append(flags.LdFlags, toolchain.Ldflags())
|
||||
}
|
||||
|
||||
if ctx.Host() {
|
||||
if !ctx.toolchain().Bionic() {
|
||||
CheckBadHostLdlibs(ctx, "host_ldlibs", linker.Properties.Host_ldlibs)
|
||||
|
||||
flags.LdFlags = append(flags.LdFlags, linker.Properties.Host_ldlibs...)
|
||||
|
|
|
@ -97,7 +97,7 @@ func (stl *stl) deps(ctx BaseModuleContext, deps Deps) Deps {
|
|||
} else {
|
||||
deps.StaticLibs = append(deps.StaticLibs, stl.Properties.SelectedStl)
|
||||
}
|
||||
if ctx.Device() {
|
||||
if ctx.toolchain().Bionic() {
|
||||
if ctx.Arch().ArchType == android.Arm {
|
||||
deps.StaticLibs = append(deps.StaticLibs, "libunwind_llvm")
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ func (stl *stl) flags(ctx ModuleContext, flags Flags) Flags {
|
|||
switch stl.Properties.SelectedStl {
|
||||
case "libc++", "libc++_static":
|
||||
flags.CFlags = append(flags.CFlags, "-D_USING_LIBCXX")
|
||||
if ctx.Host() {
|
||||
if !ctx.toolchain().Bionic() {
|
||||
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
|
||||
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
|
||||
flags.LdFlags = append(flags.LdFlags, "-lpthread", "-lm")
|
||||
|
@ -161,7 +161,7 @@ func (stl *stl) flags(ctx ModuleContext, flags Flags) Flags {
|
|||
// Nothing
|
||||
case "":
|
||||
// None or error.
|
||||
if ctx.Host() {
|
||||
if !ctx.toolchain().Bionic() {
|
||||
flags.CppFlags = append(flags.CppFlags, "-nostdinc++")
|
||||
flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs")
|
||||
if ctx.staticBinary() {
|
||||
|
|
Loading…
Reference in a new issue