From 40b246a3b04ab1cb527bc0937aba25dc69919773 Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Thu, 10 Aug 2017 12:57:20 +0200 Subject: Rebase to current AOSP master Signed-off-by: Bernhard Rosenkraenzer --- build_core-aarch64-host.patch | 37 ------ build_soong-aarch64-host.patch | 292 +++++++++++++++++++++-------------------- 2 files changed, 151 insertions(+), 178 deletions(-) diff --git a/build_core-aarch64-host.patch b/build_core-aarch64-host.patch index 93368ff..2b174b5 100644 --- a/build_core-aarch64-host.patch +++ b/build_core-aarch64-host.patch @@ -98,43 +98,6 @@ index e21083d7c..09d4b5814 100644 echo ' "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false),'; \ echo ' "EnableCFI": $(if $(filter false,$(ENABLE_CFI)),false,true),'; \ echo ' "Device_uses_hwc2": $(if $(filter true,$(TARGET_USES_HWC2)),true,false),'; \ -diff --git a/envsetup.sh b/envsetup.sh -index b71a8256a..aa400e4c7 100644 ---- a/envsetup.sh -+++ b/envsetup.sh -@@ -728,7 +728,9 @@ function getdriver() - # c++-analyzer and ccc-analyzer. - local CLANG_VERSION=$(get_build_var LLVM_PREBUILTS_VERSION) - local BUILD_OS=$(get_build_var BUILD_OS) -- local CLANG_DIR="$T/prebuilts/clang/host/${BUILD_OS}-x86/${CLANG_VERSION}" -+ local BUILD_ARCH="x86" -+ test $(uname -m) = "aarch64" && BUILD_ARCH=arm64 -+ local CLANG_DIR="$T/prebuilts/clang/host/${BUILD_OS}-${BUILD_ARCH}/${CLANG_VERSION}" - echo "\ - ${CLANG_DIR}/tools/scan-build/bin/scan-build \ - --use-analyzer ${CLANG_DIR}/bin/clang \ -diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py -index 652fadf56..17d851b3c 100644 ---- a/tools/releasetools/common.py -+++ b/tools/releasetools/common.py -@@ -38,10 +38,15 @@ from hashlib import sha1 as sha1 - - class Options(object): - def __init__(self): -- platform_search_path = { -+ if platform.processor() == 'aarch64': -+ platform_search_path = { -+ "linux2": "out/host/linux-arm64", -+ } -+ else: -+ platform_search_path = { - "linux2": "out/host/linux-x86", - "darwin": "out/host/darwin-x86", -- } -+ } - - self.search_path = platform_search_path.get(sys.platform, None) - self.signapk_path = "framework/signapk.jar" # Relative to search_path --- /dev/null 2017-05-30 12:59:06.809484016 +0000 +++ core/clang/HOST_arm.mk 2017-06-08 16:05:39.563015342 +0000 @@ -0,0 +1 @@ diff --git a/build_soong-aarch64-host.patch b/build_soong-aarch64-host.patch index e07442e..6899b2e 100644 --- a/build_soong-aarch64-host.patch +++ b/build_soong-aarch64-host.patch @@ -1,20 +1,7 @@ -diff --git a/Android.bp b/Android.bp -index 9f508d5..3f9a90d 100644 ---- a/Android.bp -+++ b/Android.bp -@@ -95,6 +95,7 @@ bootstrap_go_package { - "cc/config/x86_device.go", - "cc/config/x86_64_device.go", - -+ "cc/config/arm64_linux_host.go", - "cc/config/x86_darwin_host.go", - "cc/config/x86_linux_host.go", - "cc/config/x86_linux_bionic_host.go", -diff --git a/android/arch.go b/android/arch.go -index effd5a6..19ca724 100644 ---- a/android/arch.go -+++ b/android/arch.go -@@ -200,7 +200,7 @@ var ( +diff -up soong/android/arch.go.soong~ soong/android/arch.go +--- soong/android/arch.go.soong~ 2017-08-09 21:40:23.413357040 +0200 ++++ soong/android/arch.go 2017-08-10 12:41:03.465643399 +0200 +@@ -199,7 +199,7 @@ var ( Android = NewOsType("android", Device, false) osArchTypeMap = map[OsType][]ArchType{ @@ -23,7 +10,7 @@ index effd5a6..19ca724 100644 LinuxBionic: []ArchType{X86_64}, Darwin: []ArchType{X86, X86_64}, Windows: []ArchType{X86, X86_64}, -@@ -800,6 +800,7 @@ func decodeTargetProductVariables(config *config) (map[OsClass][]Target, error) +@@ -793,6 +793,7 @@ func decodeTargetProductVariables(config } if config.Host_bionic != nil && *config.Host_bionic { @@ -31,11 +18,21 @@ index effd5a6..19ca724 100644 addTarget(LinuxBionic, "x86_64", nil, nil, nil) } -diff --git a/android/config.go b/android/config.go -index 869a5c4..f3fa60d 100644 ---- a/android/config.go -+++ b/android/config.go -@@ -267,7 +267,12 @@ func (c *config) HostSystemTool(name string) string { +diff -up soong/Android.bp.soong~ soong/Android.bp +--- soong/Android.bp.soong~ 2017-08-10 00:34:29.253072572 +0200 ++++ soong/Android.bp 2017-08-10 12:41:03.465643399 +0200 +@@ -87,6 +87,7 @@ bootstrap_go_package { + "cc/config/x86_device.go", + "cc/config/x86_64_device.go", + ++ "cc/config/arm64_linux_host.go", + "cc/config/x86_darwin_host.go", + "cc/config/x86_linux_host.go", + "cc/config/x86_linux_bionic_host.go", +diff -up soong/android/config.go.soong~ soong/android/config.go +--- soong/android/config.go.soong~ 2017-08-09 21:40:23.414357010 +0200 ++++ soong/android/config.go 2017-08-10 12:41:03.466643368 +0200 +@@ -278,7 +278,12 @@ func (c *config) HostSystemTool(name str func (c *config) PrebuiltOS() string { switch runtime.GOOS { case "linux": @@ -49,10 +46,9 @@ index 869a5c4..f3fa60d 100644 case "darwin": return "darwin-x86" default: -diff --git a/android/paths.go b/android/paths.go -index aa06127..13a60b8 100644 ---- a/android/paths.go -+++ b/android/paths.go +diff -up soong/android/paths.go.soong~ soong/android/paths.go +--- soong/android/paths.go.soong~ 2017-08-09 21:40:23.415356979 +0200 ++++ soong/android/paths.go 2017-08-10 12:41:03.466643368 +0200 @@ -18,6 +18,7 @@ import ( "fmt" "path/filepath" @@ -61,7 +57,7 @@ index aa06127..13a60b8 100644 "strings" "github.com/google/blueprint" -@@ -686,7 +687,11 @@ func PathForModuleInstall(ctx ModuleContext, pathComponents ...string) OutputPat +@@ -697,7 +698,11 @@ func PathForModuleInstall(ctx ModuleInst } outPaths = []string{"target", "product", ctx.AConfig().DeviceName(), partition} } else { @@ -74,12 +70,11 @@ index aa06127..13a60b8 100644 } if ctx.Debug() { outPaths = append([]string{"debug"}, outPaths...) -diff --git a/bootstrap.bash b/bootstrap.bash -index e48f480..95814eb 100755 ---- a/bootstrap.bash -+++ b/bootstrap.bash -@@ -22,19 +22,33 @@ export TOPNAME="Android.bp" - export BOOTSTRAP_MANIFEST="${SRCDIR}/build/soong/build.ninja.in" +diff -up soong/bootstrap.bash.soong~ soong/bootstrap.bash +--- soong/bootstrap.bash.soong~ 2017-08-10 12:41:03.466643368 +0200 ++++ soong/bootstrap.bash 2017-08-10 12:42:05.554725462 +0200 +@@ -30,9 +30,24 @@ export BLUEPRINTDIR="${SRCDIR}/build/blu + export TOPNAME="Android.bp" export RUN_TESTS="-t" +case $(uname -m) in @@ -99,27 +94,15 @@ index e48f480..95814eb 100755 + case $(uname) in Linux) - export GOOS="linux" - export PREBUILTOS="linux-x86" -+ export PREBUILTOS="linux-${ARCH}" ++ export PREBUILTOS="linux-$ARCH" ;; Darwin) - export GOOS="darwin" -- export PREBUILTOS="darwin-x86" -+ export PREBUILTOS="darwin-${ARCH}" - ;; - *) echo "unknown OS:" $(uname) && exit 1;; - esac - export GOROOT="${SRCDIR}/prebuilts/go/$PREBUILTOS/" --export GOARCH="amd64" - export GOCHAR="6" - - if [[ $# -eq 0 ]]; then -diff --git a/cc/binary.go b/cc/binary.go -index e982329..fba9858 100644 ---- a/cc/binary.go -+++ b/cc/binary.go -@@ -245,7 +245,7 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags + export PREBUILTOS="darwin-x86" +diff -up soong/cc/binary.go.soong~ soong/cc/binary.go +--- soong/cc/binary.go.soong~ 2017-08-09 21:40:23.424356707 +0200 ++++ soong/cc/binary.go 2017-08-10 12:41:03.466643368 +0200 +@@ -244,7 +244,7 @@ func (binary *binaryDecorator) linkerFla // The linux kernel expects the linker to be an // absolute path path := android.PathForOutput(ctx, @@ -128,95 +111,9 @@ index e982329..fba9858 100644 if p, err := filepath.Abs(path.String()); err == nil { flags.DynamicLinker = p } else { -diff --git a/cc/config/x86_linux_host.go b/cc/config/x86_linux_host.go -index 80e9289..bce8cb4 100644 ---- a/cc/config/x86_linux_host.go -+++ b/cc/config/x86_linux_host.go -@@ -15,6 +15,7 @@ - package config - - import ( -+ "runtime" - "strings" - - "android/soong/android" -@@ -128,16 +129,22 @@ var ( - ) - - const ( -- linuxGccVersion = "4.8" -+ linuxGccVersion = "6.3" - ) - - func init() { - pctx.StaticVariable("LinuxGccVersion", linuxGccVersion) - -- pctx.SourcePathVariable("LinuxGccRoot", -- "prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-linux-glibc2.15-${LinuxGccVersion}") -+ if runtime.GOARCH == "arm64" { -+ pctx.StaticVariable("LinuxGccTriple", "aarch64-linux") -+ pctx.SourcePathVariable("LinuxGccRoot", -+ "prebuilts/gcc/${HostPrebuiltTag}/host/aarch64-linux-glibc2.25-${LinuxGccVersion}") -+ } else { -+ pctx.SourcePathVariable("LinuxGccRoot", -+ "prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-linux-glibc2.15-${LinuxGccVersion}") - -- pctx.StaticVariable("LinuxGccTriple", "x86_64-linux") -+ pctx.StaticVariable("LinuxGccTriple", "x86_64-linux") -+ } - - pctx.StaticVariable("LinuxCflags", strings.Join(linuxCflags, " ")) - pctx.StaticVariable("LinuxLdflags", strings.Join(linuxLdflags, " ")) -diff --git a/cmd/microfactory/microfactory.bash b/cmd/microfactory/microfactory.bash -index 7489fe3..9bf47c0 100644 ---- a/cmd/microfactory/microfactory.bash -+++ b/cmd/microfactory/microfactory.bash -@@ -23,7 +23,11 @@ - # Ensure GOROOT is set to the in-tree version. - case $(uname) in - Linux) -- export GOROOT="${TOP}/prebuilts/go/linux-x86/" -+ if [ "$(uname -m)" = "aarch64" ]; then -+ export GOROOT="${TOP}/prebuilts/go/linux-arm64/" -+ else -+ export GOROOT="${TOP}/prebuilts/go/linux-x86/" -+ fi - ;; - Darwin) - export GOROOT="${TOP}/prebuilts/go/darwin-x86/" -diff --git a/root.bp b/root.bp -index 08f2ff8..5676e3f 100644 ---- a/root.bp -+++ b/root.bp -@@ -27,6 +27,7 @@ optional_subdirs = [ - "libnativehelper", - "packages/apps/*", -- "prebuilts/clang/host/linux-x86", -+// "prebuilts/clang/host/linux-x86", -+ "prebuilts/clang/host/linux-arm64", - "prebuilts/ndk", - "prebuilts/sdk", - "system/*", -diff --git a/ui/build/config.go b/ui/build/config.go -index 7e8091b..38c1af1 100644 ---- a/ui/build/config.go -+++ b/ui/build/config.go -@@ -388,7 +388,12 @@ func (c *configImpl) hostCrossOut() string { - - func (c *configImpl) HostPrebuiltTag() string { - if runtime.GOOS == "linux" { -- return "linux-x86" -+ if runtime.GOARCH == "x86_64" { -+ panic("FIXME x86") -+ return "linux-x86" -+ } else { -+ return "linux-" + runtime.GOARCH -+ } - } else if runtime.GOOS == "darwin" { - return "darwin-x86" - } else { ---- /dev/null 2017-05-30 12:59:06.809484016 +0000 -+++ soong/cc/config/arm64_linux_host.go 2017-06-08 16:03:35.191891546 +0000 +diff -up soong/cc/config/arm64_linux_host.go.soong~ soong/cc/config/arm64_linux_host.go +--- soong/cc/config/arm64_linux_host.go.soong~ 2017-08-10 12:41:05.978565751 +0200 ++++ soong/cc/config/arm64_linux_host.go 2017-08-10 12:41:05.978565751 +0200 @@ -0,0 +1,276 @@ +// Copyright 2016 Google Inc. All rights reserved. +// @@ -494,3 +391,116 @@ index 7e8091b..38c1af1 100644 + registerToolchainFactory(android.Linux, android.Arm, linuxARMToolchainFactory) + registerToolchainFactory(android.Linux, android.Arm64, linuxARM64ToolchainFactory) +} +diff -up soong/cc/config/x86_linux_host.go.soong~ soong/cc/config/x86_linux_host.go +--- soong/cc/config/x86_linux_host.go.soong~ 2017-08-09 21:40:23.461355586 +0200 ++++ soong/cc/config/x86_linux_host.go 2017-08-10 12:41:03.467643337 +0200 +@@ -15,6 +15,7 @@ + package config + + import ( ++ "runtime" + "strings" + + "android/soong/android" +@@ -128,16 +129,22 @@ var ( + ) + + const ( +- linuxGccVersion = "4.8" ++ linuxGccVersion = "6.3" + ) + + func init() { + pctx.StaticVariable("LinuxGccVersion", linuxGccVersion) + +- pctx.SourcePathVariable("LinuxGccRoot", +- "prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-linux-glibc2.15-${LinuxGccVersion}") ++ if runtime.GOARCH == "arm64" { ++ pctx.StaticVariable("LinuxGccTriple", "aarch64-linux") ++ pctx.SourcePathVariable("LinuxGccRoot", ++ "prebuilts/gcc/${HostPrebuiltTag}/host/aarch64-linux-glibc2.25-${LinuxGccVersion}") ++ } else { ++ pctx.SourcePathVariable("LinuxGccRoot", ++ "prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-linux-glibc2.15-${LinuxGccVersion}") + +- pctx.StaticVariable("LinuxGccTriple", "x86_64-linux") ++ pctx.StaticVariable("LinuxGccTriple", "x86_64-linux") ++ } + + pctx.StaticVariable("LinuxCflags", strings.Join(linuxCflags, " ")) + pctx.StaticVariable("LinuxLdflags", strings.Join(linuxLdflags, " ")) +diff -up soong/root.bp.soong~ soong/root.bp +--- soong/root.bp.soong~ 2017-08-09 21:50:53.664062806 +0200 ++++ soong/root.bp 2017-08-10 12:41:05.954566492 +0200 +@@ -26,7 +26,8 @@ optional_subdirs = [ + "libcore", + "libnativehelper", + "packages/apps/*", +- "prebuilts/clang/host/linux-x86", ++// "prebuilts/clang/host/linux-x86", ++ "prebuilts/clang/host/linux-arm64", + "prebuilts/ndk", + "prebuilts/sdk", + "prebuilts/misc", +diff -up soong/ui/build/config.go.soong~ soong/ui/build/config.go +--- soong/ui/build/config.go.soong~ 2017-08-09 21:40:23.597351467 +0200 ++++ soong/ui/build/config.go 2017-08-10 12:41:05.977565781 +0200 +@@ -433,7 +433,12 @@ func (c *configImpl) hostCrossOut() stri + + func (c *configImpl) HostPrebuiltTag() string { + if runtime.GOOS == "linux" { +- return "linux-x86" ++ if runtime.GOARCH == "x86_64" { ++ panic("FIXME x86") ++ return "linux-x86" ++ } else { ++ return "linux-" + runtime.GOARCH ++ } + } else if runtime.GOOS == "darwin" { + return "darwin-x86" + } else { +diff -up soong/scripts/microfactory.bash.omv~ soong/scripts/microfactory.bash +--- soong/scripts/microfactory.bash.omv~ 2017-08-10 12:46:52.081867716 +0200 ++++ soong/scripts/microfactory.bash 2017-08-10 12:47:33.672581762 +0200 +@@ -21,9 +21,20 @@ + # ${OUT_DIR_COMMON_BASE}/$(basename ${TOP}) + + # Ensure GOROOT is set to the in-tree version. ++case $(uname -m) in ++ x86_64) ++ ARCH=x86 ++ ;; ++ aarch64) ++ ARCH=arm64 ++ ;; ++ *) ++ ARCH="$(uname -m)" ++ ;; ++esac + case $(uname) in + Linux) +- export GOROOT="${TOP}/prebuilts/go/linux-x86/" ++ export GOROOT="${TOP}/prebuilts/go/linux-$ARCH/" + ;; + Darwin) + export GOROOT="${TOP}/prebuilts/go/darwin-x86/" +diff -up soong/android/paths_test.go.omv~ soong/android/paths_test.go +--- soong/android/paths_test.go.omv~ 2017-08-10 12:53:08.612221356 +0200 ++++ soong/android/paths_test.go 2017-08-10 12:54:27.686773353 +0200 +@@ -18,6 +18,7 @@ import ( + "errors" + "fmt" + "reflect" ++ "runtime" + "strings" + "testing" + +@@ -228,7 +229,7 @@ func TestPathForModuleInstall(t *testing + }, + }, + in: []string{"bin", "my_test"}, +- out: "host/linux-x86/bin/my_test", ++ out: "host/linux-" + runtime.GOARCH + "/bin/my_test", + }, + + { -- cgit v1.2.3