Create toolchainBionic for the various bionic-based toolchains to inherit from

Host bionic and each of the device bionic architectures will share some
new toolchain functionality in common, create a toolchainBionic and embed
it into the toolchains.  Use it to implement Bionic() once and change
the default implementation from true to false.

Test: go test ./cc/...
Test: m checkbuild
Change-Id: Ia34b80d9691edc4ab1cbdbd005d1ffc950d0881c
This commit is contained in:
Colin Cross
2021-06-21 17:28:25 -07:00
parent 99fc06f8ed
commit e3fee34a3d
12 changed files with 28 additions and 21 deletions

View File

@@ -17,6 +17,8 @@ bootstrap_go_package {
"toolchain.go",
"vndk.go",
"bionic.go",
"arm_device.go",
"arm64_device.go",
"arm64_fuchsia_device.go",

View File

@@ -149,6 +149,7 @@ var (
)
type toolchainArm64 struct {
toolchainBionic
toolchain64Bit
ldflags string

View File

@@ -82,10 +82,6 @@ func (t *toolchainFuchsiaArm64) ClangCflags() string {
return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -I" + fuchsiaArm64SysRoot + "/include"
}
func (t *toolchainFuchsiaArm64) Bionic() bool {
return false
}
func (t *toolchainFuchsiaArm64) ToolchainClangCflags() string {
return "-march=armv8-a"
}

View File

@@ -237,6 +237,7 @@ var (
)
type toolchainArm struct {
toolchainBionic
toolchain32Bit
ldflags string
lldflags string

20
cc/config/bionic.go Normal file
View File

@@ -0,0 +1,20 @@
// Copyright 2015 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 config
type toolchainBionic struct {
}
func (toolchainBionic) Bionic() bool { return true }

View File

@@ -169,7 +169,7 @@ func (toolchainBase) AvailableLibraries() []string {
}
func (toolchainBase) Bionic() bool {
return true
return false
}
func (t toolchainBase) ToolPath() string {

View File

@@ -123,6 +123,7 @@ func init() {
}
type toolchainX86_64 struct {
toolchainBionic
toolchain64Bit
toolchainClangCflags string
}

View File

@@ -83,10 +83,6 @@ func (t *toolchainFuchsiaX8664) ClangCflags() string {
return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -I" + fuchsiaSysRoot + "/include"
}
func (t *toolchainFuchsiaX8664) Bionic() bool {
return false
}
func (t *toolchainFuchsiaX8664) YasmFlags() string {
return "-f elf64 -m amd64"
}

View File

@@ -241,10 +241,6 @@ func (t *toolchainDarwin) AvailableLibraries() []string {
return darwinAvailableLibraries
}
func (t *toolchainDarwin) Bionic() bool {
return false
}
func (t *toolchainDarwin) ToolPath() string {
return "${config.MacToolPath}"
}

View File

@@ -134,6 +134,7 @@ func init() {
}
type toolchainX86 struct {
toolchainBionic
toolchain32Bit
toolchainClangCflags string
}

View File

@@ -76,6 +76,7 @@ func init() {
type toolchainLinuxBionic struct {
toolchain64Bit
toolchainBionic
}
func (t *toolchainLinuxBionic) Name() string {
@@ -133,10 +134,6 @@ func (t *toolchainLinuxBionic) AvailableLibraries() []string {
return nil
}
func (t *toolchainLinuxBionic) Bionic() bool {
return true
}
func (toolchainLinuxBionic) LibclangRuntimeLibraryArch() string {
return "x86_64"
}

View File

@@ -245,10 +245,6 @@ func (t *toolchainLinux) AvailableLibraries() []string {
return linuxAvailableLibraries
}
func (t *toolchainLinux) Bionic() bool {
return false
}
var toolchainLinuxX86Singleton Toolchain = &toolchainLinuxX86{}
var toolchainLinuxX8664Singleton Toolchain = &toolchainLinuxX8664{}