summaryrefslogtreecommitdiff
path: root/build_tools-aarch64-host.patch
blob: 256970e6902448a519e11c966c9279760b25dd27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
diff --git a/core/config.mk b/core/config.mk
index 5ff582a13..7ff3b368f 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -383,7 +383,7 @@ ifeq (,$(filter 1 true,$(WITH_TIDY_ONLY)))
 endif
 
 PATH_TO_CLANG_TIDY := \
-    $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin/clang-tidy
+    $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/$(LLVM_PREBUILTS_VERSION)/bin/clang-tidy
 ifeq ($(wildcard $(PATH_TO_CLANG_TIDY)),)
   ifneq (,$(filter 1 true,$(WITH_TIDY)))
     $(warning *** Disable WITH_TIDY because $(PATH_TO_CLANG_TIDY) does not exist)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 43593e63c..acf755f15 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -116,13 +116,15 @@ HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())")
 BUILD_OS := $(HOST_OS)
 
 HOST_CROSS_OS :=
-# We can cross-build Windows binaries on Linux
+# We can cross-build Windows binaries on x86 Linux
 ifeq ($(HOST_OS),linux)
+ifeq ($(HOST_ARCH),x86)
 HOST_CROSS_OS := windows
 HOST_CROSS_ARCH := x86
 HOST_CROSS_2ND_ARCH := x86_64
 2ND_HOST_CROSS_IS_64_BIT := true
 endif
+endif
 
 ifeq ($(HOST_OS),)
 $(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)
@@ -134,10 +136,15 @@ ifneq (,$(findstring x86_64,$(UNAME)))
   HOST_2ND_ARCH := x86
   HOST_IS_64_BIT := true
 else
+ifneq (,$(findstring aarch64,$(UNAME)))
+  HOST_ARCH := arm64
+  HOST_IS_64_BIT := true
+else
 ifneq (,$(findstring i686,$(UNAME))$(findstring x86,$(UNAME)))
 $(error Building on a 32-bit x86 host is not supported: $(UNAME)!)
 endif
 endif
+endif
 
 BUILD_ARCH := $(HOST_ARCH)
 BUILD_2ND_ARCH := $(HOST_2ND_ARCH)
@@ -157,8 +164,12 @@ $(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)
 endif
 endif
 
+ifneq (,$(findstring x86_64,$(UNAME)))
 # We don't want to move all the prebuilt host tools to a $(HOST_OS)-x86_64 dir.
 HOST_PREBUILT_ARCH := x86
+else
+HOST_PREBUILT_ARCH := $(HOST_ARCH)
+endif
 # This is the standard way to name a directory containing prebuilt host
 # objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc
 HOST_PREBUILT_TAG := $(BUILD_OS)-$(HOST_PREBUILT_ARCH)
diff --git a/core/main.mk b/core/main.mk
index bc4ed0421..34e87f6ec 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -14,6 +14,12 @@ ifndef KATI
 host_prebuilts := linux-x86
 ifeq ($(shell uname),Darwin)
 host_prebuilts := darwin-x86
+else
+ifeq (aarch64,$(shell uname -m))
+host_prebuilts := linux-arm64
+else
+	$(error not arm64)
+endif
 endif
 
 .PHONY: run_soong_ui
diff --git a/core/soong_config.mk b/core/soong_config.mk
index e21083d7c..09d4b5814 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -71,11 +71,11 @@ $(SOONG_VARIABLES): FORCE
 	echo '    "DeviceSecondaryAbi": ["$(TARGET_2ND_CPU_ABI)", "$(TARGET_2ND_CPU_ABI2)"],'; \
 	echo ''; \
 	echo '    "HostArch": "$(HOST_ARCH)",'; \
-	echo '    "HostSecondaryArch": "$(HOST_2ND_ARCH)",'; \
+	test $(shell uname -m) = aarch64 || echo '    "HostSecondaryArch": "$(HOST_2ND_ARCH)",'; \
 	echo ''; \
-	echo '    "CrossHost": "$(HOST_CROSS_OS)",'; \
-	echo '    "CrossHostArch": "$(HOST_CROSS_ARCH)",'; \
-	echo '    "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \
+	test $(shell uname -m) = aarch64 || echo '    "CrossHost": "$(HOST_CROSS_OS)",'; \
+	test $(shell uname -m) = aarch64 || echo '    "CrossHostArch": "$(HOST_CROSS_ARCH)",'; \
+	test $(shell uname -m) = aarch64 || echo '    "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \
 	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
+++ tools/../core/clang/HOST_arm.mk	2017-06-08 16:05:39.563015342 +0000
@@ -0,0 +1 @@
+$(clang_2nd_arch_prefix)HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-armv7.a
--- /dev/null	2017-05-30 12:59:06.809484016 +0000
+++ tools/../core/clang/HOST_arm64.mk	2017-06-08 16:05:39.564015311 +0000
@@ -0,0 +1 @@
+HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-aarch64.a
--- /dev/null	2017-05-30 12:59:06.809484016 +0000
+++ tools/../core/combo/HOST_linux-arm.mk	2017-06-08 16:05:39.564015311 +0000
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# 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.
+#
+
+# Configuration for builds hosted on linux-arm.
+# Included by combo/select.mk
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
+
+############################################################
+## Macros after this line are shared by the 64-bit config.
+
+# $(1): The file to check
+define get-file-size
+stat --format "%s" "$(1)" | tr -d '\n'
+endef
--- /dev/null	2017-05-30 12:59:06.809484016 +0000
+++ tools/../core/combo/HOST_linux-arm64.mk	2017-06-08 16:05:39.564015311 +0000
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# 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.
+#
+
+# Configuration for builds hosted on linux-arm64.
+# Included by combo/select.mk
+
+define $(combo_var_prefix)transform-shared-lib-to-toc
+$(call _gen_toc_command_for_elf,$(1),$(2))
+endef
+
+# $(1): The file to check
+define get-file-size
+stat --format "%s" "$(1)" | tr -d '\n'
+endef