Merge changes from topic "update_make_flags"
* changes: Update flags passed to make Stop using GCC in toolchain_library
This commit is contained in:
commit
1c7e0a235b
6 changed files with 63 additions and 68 deletions
42
Android.bp
42
Android.bp
|
@ -360,9 +360,19 @@ toolchain_library {
|
||||||
defaults: ["linux_bionic_supported"],
|
defaults: ["linux_bionic_supported"],
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
|
|
||||||
arch: {
|
arch: {
|
||||||
arm: {
|
arm: {
|
||||||
instruction_set: "arm",
|
src: "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/lib/libatomic.a",
|
||||||
|
},
|
||||||
|
arm64: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/lib64/libatomic.a",
|
||||||
|
},
|
||||||
|
x86: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/lib/libatomic.a",
|
||||||
|
},
|
||||||
|
x86_64: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/x86_64-linux-android/lib64/libatomic.a",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -372,9 +382,19 @@ toolchain_library {
|
||||||
defaults: ["linux_bionic_supported"],
|
defaults: ["linux_bionic_supported"],
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
|
|
||||||
arch: {
|
arch: {
|
||||||
arm: {
|
arm: {
|
||||||
instruction_set: "arm",
|
src: "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a",
|
||||||
|
},
|
||||||
|
arm64: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/libgcc.a",
|
||||||
|
},
|
||||||
|
x86: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/lib/gcc/x86_64-linux-android/4.9.x/32/libgcc.a",
|
||||||
|
},
|
||||||
|
x86_64: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/lib/gcc/x86_64-linux-android/4.9.x/libgcc.a",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -387,15 +407,31 @@ toolchain_library {
|
||||||
windows: {
|
windows: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
windows_x86: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32/libwinpthread.a",
|
||||||
|
},
|
||||||
|
windows_x86_64: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib/libwinpthread.a",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
toolchain_library {
|
||||||
name: "libgcov",
|
name: "libgcov",
|
||||||
defaults: ["linux_bionic_supported"],
|
defaults: ["linux_bionic_supported"],
|
||||||
|
|
||||||
arch: {
|
arch: {
|
||||||
arm: {
|
arm: {
|
||||||
instruction_set: "arm",
|
src: "prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x/libgcov.a",
|
||||||
|
},
|
||||||
|
arm64: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/lib/gcc/aarch64-linux-android/4.9.x/libgcov.a",
|
||||||
|
},
|
||||||
|
x86: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/lib/gcc/x86_64-linux-android/4.9.x/32/libgcov.a",
|
||||||
|
},
|
||||||
|
x86_64: {
|
||||||
|
src: "prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/lib/gcc/x86_64-linux-android/4.9.x/libgcov.a",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,17 +127,6 @@ var (
|
||||||
Command: "rm -f $out && touch $out",
|
Command: "rm -f $out && touch $out",
|
||||||
})
|
})
|
||||||
|
|
||||||
_ = pctx.SourcePathVariable("copyGccLibPath", "build/soong/scripts/copygcclib.sh")
|
|
||||||
|
|
||||||
copyGccLib = pctx.AndroidStaticRule("copyGccLib",
|
|
||||||
blueprint.RuleParams{
|
|
||||||
Depfile: "${out}.d",
|
|
||||||
Deps: blueprint.DepsGCC,
|
|
||||||
Command: "$copyGccLibPath $out $ccCmd $cFlags -print-file-name=${libName}",
|
|
||||||
CommandDeps: []string{"$copyGccLibPath", "$ccCmd"},
|
|
||||||
},
|
|
||||||
"ccCmd", "cFlags", "libName")
|
|
||||||
|
|
||||||
_ = pctx.SourcePathVariable("tocPath", "build/soong/scripts/toc.sh")
|
_ = pctx.SourcePathVariable("tocPath", "build/soong/scripts/toc.sh")
|
||||||
|
|
||||||
toc = pctx.AndroidStaticRule("toc",
|
toc = pctx.AndroidStaticRule("toc",
|
||||||
|
@ -880,21 +869,6 @@ func TransformCoverageFilesToLib(ctx android.ModuleContext,
|
||||||
return android.OptionalPath{}
|
return android.OptionalPath{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CopyGccLib(ctx android.ModuleContext, libName string,
|
|
||||||
flags builderFlags, outputFile android.WritablePath) {
|
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
|
||||||
Rule: copyGccLib,
|
|
||||||
Description: "copy gcc library " + libName,
|
|
||||||
Output: outputFile,
|
|
||||||
Args: map[string]string{
|
|
||||||
"ccCmd": gccCmd(flags.toolchain, "gcc"),
|
|
||||||
"cFlags": flags.globalFlags,
|
|
||||||
"libName": libName,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func gccCmd(toolchain config.Toolchain, cmd string) string {
|
func gccCmd(toolchain config.Toolchain, cmd string) string {
|
||||||
return filepath.Join(toolchain.GccRoot(), "bin", toolchain.GccTriple()+"-"+cmd)
|
return filepath.Join(toolchain.GccRoot(), "bin", toolchain.GccTriple()+"-"+cmd)
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,18 +76,21 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
||||||
name: "libatomic",
|
name: "libatomic",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
|
src: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
toolchain_library {
|
||||||
name: "libcompiler_rt-extras",
|
name: "libcompiler_rt-extras",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
|
src: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
toolchain_library {
|
||||||
name: "libgcc",
|
name: "libgcc",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
|
src: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
|
|
|
@ -87,9 +87,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
||||||
ctx.Strict("RS_LLVM_LINK", "${config.RSLLVMPrebuiltsPath}/llvm-link")
|
ctx.Strict("RS_LLVM_LINK", "${config.RSLLVMPrebuiltsPath}/llvm-link")
|
||||||
|
|
||||||
ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ClangExternalCflags}")
|
ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ClangExternalCflags}")
|
||||||
ctx.Strict("GLOBAL_CFLAGS_NO_OVERRIDE", "${config.NoOverrideGlobalCflags}")
|
ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.NoOverrideClangGlobalCflags}")
|
||||||
ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.ClangExtraNoOverrideCflags}")
|
|
||||||
ctx.Strict("GLOBAL_CPPFLAGS_NO_OVERRIDE", "")
|
|
||||||
ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "")
|
ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "")
|
||||||
ctx.Strict("NDK_PREBUILT_SHARED_LIBRARIES", strings.Join(ndkPrebuiltSharedLibs, " "))
|
ctx.Strict("NDK_PREBUILT_SHARED_LIBRARIES", strings.Join(ndkPrebuiltSharedLibs, " "))
|
||||||
|
|
||||||
|
@ -230,13 +228,13 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
|
||||||
ctx.StrictRaw(makePrefix+"C_SYSTEM_INCLUDES", strings.Join(systemIncludes, " "))
|
ctx.StrictRaw(makePrefix+"C_SYSTEM_INCLUDES", strings.Join(systemIncludes, " "))
|
||||||
|
|
||||||
if target.Arch.ArchType == android.Arm {
|
if target.Arch.ArchType == android.Arm {
|
||||||
flags, err := toolchain.InstructionSetFlags("arm")
|
flags, err := toolchain.ClangInstructionSetFlags("arm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
ctx.Strict(makePrefix+"arm_CFLAGS", flags)
|
ctx.Strict(makePrefix+"arm_CFLAGS", flags)
|
||||||
|
|
||||||
flags, err = toolchain.InstructionSetFlags("thumb")
|
flags, err = toolchain.ClangInstructionSetFlags("thumb")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -309,16 +307,14 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
|
||||||
ctx.Strict(makePrefix+"OBJCOPY", gccCmd(toolchain, "objcopy"))
|
ctx.Strict(makePrefix+"OBJCOPY", gccCmd(toolchain, "objcopy"))
|
||||||
ctx.Strict(makePrefix+"LD", gccCmd(toolchain, "ld"))
|
ctx.Strict(makePrefix+"LD", gccCmd(toolchain, "ld"))
|
||||||
ctx.Strict(makePrefix+"GCC_VERSION", toolchain.GccVersion())
|
ctx.Strict(makePrefix+"GCC_VERSION", toolchain.GccVersion())
|
||||||
ctx.Strict(makePrefix+"NDK_GCC_VERSION", toolchain.GccVersion())
|
|
||||||
ctx.Strict(makePrefix+"NDK_TRIPLE", config.NDKTriple(toolchain))
|
ctx.Strict(makePrefix+"NDK_TRIPLE", config.NDKTriple(toolchain))
|
||||||
|
ctx.Strict(makePrefix+"TOOLS_PREFIX", gccCmd(toolchain, ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.Os.Class == android.Host || target.Os.Class == android.HostCross {
|
if target.Os.Class == android.Host || target.Os.Class == android.HostCross {
|
||||||
ctx.Strict(makePrefix+"AVAILABLE_LIBRARIES", strings.Join(toolchain.AvailableLibraries(), " "))
|
ctx.Strict(makePrefix+"AVAILABLE_LIBRARIES", strings.Join(toolchain.AvailableLibraries(), " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Strict(makePrefix+"TOOLCHAIN_ROOT", toolchain.GccRoot())
|
|
||||||
ctx.Strict(makePrefix+"TOOLS_PREFIX", gccCmd(toolchain, ""))
|
|
||||||
ctx.Strict(makePrefix+"SHLIB_SUFFIX", toolchain.ShlibSuffix())
|
ctx.Strict(makePrefix+"SHLIB_SUFFIX", toolchain.ShlibSuffix())
|
||||||
ctx.Strict(makePrefix+"EXECUTABLE_SUFFIX", toolchain.ExecutableSuffix())
|
ctx.Strict(makePrefix+"EXECUTABLE_SUFFIX", toolchain.ExecutableSuffix())
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,15 @@ func init() {
|
||||||
android.RegisterModuleType("toolchain_library", toolchainLibraryFactory)
|
android.RegisterModuleType("toolchain_library", toolchainLibraryFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type toolchainLibraryProperties struct {
|
||||||
|
// the prebuilt toolchain library, as a path from the top of the source tree
|
||||||
|
Src *string `android:"arch_variant"`
|
||||||
|
}
|
||||||
|
|
||||||
type toolchainLibraryDecorator struct {
|
type toolchainLibraryDecorator struct {
|
||||||
*libraryDecorator
|
*libraryDecorator
|
||||||
|
|
||||||
|
Properties toolchainLibraryProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*toolchainLibraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
func (*toolchainLibraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||||
|
@ -35,6 +42,12 @@ func (*toolchainLibraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (library *toolchainLibraryDecorator) linkerProps() []interface{} {
|
||||||
|
var props []interface{}
|
||||||
|
props = append(props, library.libraryDecorator.linkerProps()...)
|
||||||
|
return append(props, &library.Properties)
|
||||||
|
}
|
||||||
|
|
||||||
func toolchainLibraryFactory() android.Module {
|
func toolchainLibraryFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostAndDeviceSupported)
|
module, library := NewLibrary(android.HostAndDeviceSupported)
|
||||||
library.BuildOnlyStatic()
|
library.BuildOnlyStatic()
|
||||||
|
@ -58,16 +71,10 @@ func (library *toolchainLibraryDecorator) compile(ctx ModuleContext, flags Flags
|
||||||
func (library *toolchainLibraryDecorator) link(ctx ModuleContext,
|
func (library *toolchainLibraryDecorator) link(ctx ModuleContext,
|
||||||
flags Flags, deps PathDeps, objs Objects) android.Path {
|
flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
|
|
||||||
libName := ctx.ModuleName() + staticLibraryExtension
|
if library.Properties.Src == nil {
|
||||||
outputFile := android.PathForModuleOut(ctx, libName)
|
ctx.PropertyErrorf("src", "No library source specified")
|
||||||
|
return android.PathForSource(ctx, "")
|
||||||
if flags.Clang {
|
|
||||||
ctx.ModuleErrorf("toolchain_library must use GCC, not Clang")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyGccLib(ctx, libName, flagsToBuilderFlags(flags), outputFile)
|
return android.PathForSource(ctx, *library.Properties.Src)
|
||||||
|
|
||||||
ctx.CheckbuildFile(outputFile)
|
|
||||||
|
|
||||||
return outputFile
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
# Copyright 2017 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.
|
|
||||||
|
|
||||||
OUT=$1
|
|
||||||
shift
|
|
||||||
LIBPATH=$($@ | sed -e "s|^$PWD/||")
|
|
||||||
cp -f $LIBPATH $OUT
|
|
||||||
echo "$OUT: $LIBPATH" > ${OUT}.d
|
|
Loading…
Reference in a new issue