Hi,
Michael wrote:
> These changes are larger than I would like. Please upstream them
> first, especially the assembly changes to openmax.
Submitted and applied upstream: https://codereview.chromium.org/1420973006/
Sandbox patch is also applied, and boringssl compiler flag changes has just been
submitted.
On 18 November 2015 at 23:26, Joost van Zwieten
<[email protected]> wrote:
> On 3 November 2015 at 20:37, Joost van Zwieten
> <[email protected]> wrote:
> That took a bit longer than expected. With the latest binutils from
> experimental I was still unable to link chromium: ld failed with the
> message 'Memory exhausted'. I came up the following solution: reduce
> the amount of debug information to line numbers only. Passing
> '-gline-tables-only' to clang does the job, see fourth attached patch.
> With all patches applied I can successfully build chromium.
I've verified that linking succeeds with these change on abel.debian.org,
which is identical to the Debian armhf builders.
Attached is the combined patch of my arm64 changes and Joost's armhf changes
against the experimental version of chromium:
ps. notice the vaapi.patch is broken. It assumes the tests "arch!=arm" and
"arch = x86" are identical.
diff -Nru chromium-browser-47.0.2526.16/debian/control chromium-browser-47.0.2526.16/debian/control
--- chromium-browser-47.0.2526.16/debian/control 2015-10-25 04:00:14.000000000 +0200
+++ chromium-browser-47.0.2526.16/debian/control 2015-10-28 21:53:26.000000000 +0200
@@ -82,10 +82,11 @@
libgcrypt20-dev,
fonts-ipafont-gothic,
fonts-ipafont-mincho,
+ binutils (>= 2.25.1-7.1) [armhf],
Standards-Version: 3.9.6
Package: chromium
-Architecture: i386 amd64
+Architecture: i386 amd64 armhf arm64
Built-Using: ${Built-Using}
Depends:
${misc:Depends},
@@ -106,7 +107,7 @@
This package contains the web browser component.
Package: chromium-dbg
-Architecture: i386 amd64
+Architecture: i386 amd64 armhf arm64
Section: debug
Priority: extra
Built-Using: ${Built-Using}
@@ -135,7 +136,7 @@
ro, ru, sk, sl, sr, sv, sw, ta, te, th, tr, uk, vi, zh-CN, zh-TW
Package: chromedriver
-Architecture: i386 amd64
+Architecture: i386 amd64 armhf arm64
Depends:
${misc:Depends},
${shlibs:Depends},
diff -Nru chromium-browser-47.0.2526.16/debian/patches/aarch64-fixes.patch chromium-browser-47.0.2526.16/debian/patches/aarch64-fixes.patch
--- chromium-browser-47.0.2526.16/debian/patches/aarch64-fixes.patch 1970-01-01 02:00:00.000000000 +0200
+++ chromium-browser-47.0.2526.16/debian/patches/aarch64-fixes.patch 2015-11-16 17:50:26.000000000 +0200
@@ -0,0 +1,29 @@
+Index: chromium-browser-47.0.2526.16/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
+===================================================================
+--- chromium-browser-47.0.2526.16.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
++++ chromium-browser-47.0.2526.16/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
+@@ -194,8 +194,11 @@ ResultExpr GpuBrokerProcessPolicy::Evalu
+ #if !defined(OS_CHROMEOS)
+ // The broker process needs to able to unlink the temporary
+ // files that it may create. This is used by DRI3.
++#if !defined(__aarch64__)
+ case __NR_unlink:
+-#endif
++#endif // !defined(__aarch64__)
++ case __NR_unlinkat:
++#endif // !defined(OS_CHROMEOS)
+ return Allow();
+ default:
+ return GpuProcessPolicy::EvaluateSyscall(sysno);
+Index: chromium-browser-47.0.2526.16/third_party/boringssl/boringssl.gyp
+===================================================================
+--- chromium-browser-47.0.2526.16.orig/third_party/boringssl/boringssl.gyp
++++ chromium-browser-47.0.2526.16/third_party/boringssl/boringssl.gyp
+@@ -40,6 +40,7 @@
+ 'conditions': [
+ ['OS == "linux" or OS == "android"', {
+ 'sources': [ '<@(boringssl_linux_aarch64_sources)' ],
++ 'cflags': [ '-march=armv8-a+crypto', ],
+ }, {
+ 'defines': [ 'OPENSSL_NO_ASM' ],
+ }],
diff -Nru chromium-browser-47.0.2526.16/debian/patches/aarch64_openmax_clang.patch chromium-browser-47.0.2526.16/debian/patches/aarch64_openmax_clang.patch
--- chromium-browser-47.0.2526.16/debian/patches/aarch64_openmax_clang.patch 1970-01-01 02:00:00.000000000 +0200
+++ chromium-browser-47.0.2526.16/debian/patches/aarch64_openmax_clang.patch 2015-11-06 16:00:35.000000000 +0200
@@ -0,0 +1,308 @@
+From 4636f5bb744c0828ac853e1a513e375886fcd424 Mon Sep 17 00:00:00 2001
+From: Riku Voipio <[email protected]>
+Date: Thu, 5 Nov 2015 15:34:36 -0800
+Subject: [PATCH] arm64: clang assembler compatability
+
+Fixes to compile with clang (3.7)
+
+- Fix fmul syntax:
+ fmul v0.2s,v1.2s,v2.2s[0] -> v0.2s,v1.2s,v2.s[0]
+- lowercase RSB macro call to -> rsb
+- add w modifier and use U32 in and out for fastlog2()
+
+With these changes openmax_dl compiles as part of chromium on arm64
+ with both gcc 5.2 and clang 3.7. Unfortunately there was no
+instructions how to run the included tests. The generated .o
+files looks same before and after (minor changes in debug sections)
+
+BUG=5090
[email protected], [email protected]
+
+Review URL: https://codereview.webrtc.org/1420973006 .
+
+Patch from Riku Voipio <[email protected]>.
+---
+--- a/third_party/openmax_dl/dl/sp/api/armSP.h
++++ b/third_party/openmax_dl/dl/sp/api/armSP.h
+@@ -93,8 +93,8 @@
+ /*
+ * Compute log2(x), where x must be a power of 2.
+ */
+-static inline OMX_U32 fastlog2(long x) {
+- OMX_U32 out;
++static inline long fastlog2(long x) {
++ long out;
+ asm("clz %0,%1\n\t"
+ "sub %0, %0, #63\n\t"
+ "neg %0, %0\n\t"
+--- a/third_party/openmax_dl/dl/sp/src/arm/arm64/ComplexToRealFixup.S
++++ b/third_party/openmax_dl/dl/sp/src/arm/arm64/ComplexToRealFixup.S
+@@ -94,6 +94,7 @@
+ #define qT3 v20.2s
+
+ #define half v0.2s
++#define halfs v0.s
+ #define dZip v21.2s
+ #define dZip8b v21.8b
+
+@@ -106,7 +107,7 @@
+
+ clz order, subFFTNum // N = 2^order
+
+- RSB order,order,#63
++ rsb order,order,#63
+ MOV subFFTSize,subFFTNum // subFFTSize = N/2
+ //MOV subFFTNum,N
+ mov argDst, pDst
+@@ -127,7 +128,7 @@
+ MOV zero,#0
+ mov dX0rs[1],zero
+ lsl step,subFFTSize, #3 // step = N/2 * 8 bytes
+- mov dX0i[1],zero
++ mov dX0is[1],zero
+ // twStep = 3N/8 * 8 bytes pointing to W^1
+ SUB twStep,step,subFFTSize,LSL #1
+
+@@ -185,8 +186,8 @@
+ fadd dT0,dX0r,dX1r // a+c
+ fsub dT1,dX0i,dX1i // b-d
+ fadd dT3,dX0i,dX1i // b+d
+- fmul dT0,dT0,half[0]
+- fmul dT1,dT1,half[0]
++ fmul dT0,dT0,halfs[0]
++ fmul dT1,dT1,halfs[0]
+ // VZIP dW1r,dW1i
+ // VZIP dW0r,dW0i
+ zip1 dZip, dW1r, dW1i
+@@ -208,8 +209,8 @@
+ fmla qT3,dW0i,dT2
+
+
+- fmul dX1r,qT0,half[0]
+- fmul dX1i,qT1,half[0]
++ fmul dX1r,qT0,halfs[0]
++ fmul dX1i,qT1,halfs[0]
+
+ fsub dY1r,dT0,dX1i // F(N/2 -1)
+ fadd dY1i,dT1,dX1r
+@@ -219,8 +220,8 @@
+ rev64 dY1i,dY1i
+
+
+- fmul dX0r,qT2,half[0]
+- fmul dX0i,qT3,half[0]
++ fmul dX0r,qT2,halfs[0]
++ fmul dX0i,qT3,halfs[0]
+
+ fsub dY0r,dT0,dX0i // F(1)
+ fadd dY0i,dT1,dX0r
+--- a/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_s.S
++++ b/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_s.S
+@@ -112,6 +112,7 @@
+ #define dZip v19.2s
+ #define dZip8b v19.8b
+ #define half v13.2s
++#define halfs v13.s
+
+ .macro FFTSTAGE scaled, inverse, name
+
+@@ -140,8 +141,8 @@
+
+ fadd dY0,dX0,dX1 // [b+d | a+c]
+ fsub dY1,dX0,dX1 // [b-d | a-c]
+- fmul dY0, dY0, half[0]
+- fmul dY1, dY1, half[0]
++ fmul dY0, dY0, halfs[0]
++ fmul dY1, dY1, halfs[0]
+
+ // dY0= [a-c | a+c] ;dY1= [b-d | b+d]
+ // VZIP dY0,dY1
+@@ -201,11 +202,11 @@
+ fsub dT1,dX0i,dX1i // b-d
+ SUB step1,step1,#8
+
+- fmul dT2, dT2, half[0]
+- fmul dT3, dT3, half[0]
++ fmul dT2, dT2, halfs[0]
++ fmul dT3, dT3, halfs[0]
+
+- fmul dT0, dT0, half[0]
+- fmul dT1, dT1, half[0]
++ fmul dT0, dT0, halfs[0]
++ fmul dT1, dT1, halfs[0]
+
+ // VZIP dW1r,dW1i
+ // VZIP dW0r,dW0i
+--- a/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_s.S
++++ b/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_s.S
+@@ -70,6 +70,7 @@
+ // Neon Registers
+
+ #define dW v0.2s
++#define dWs v0.s
+ #define dX0 v2.2s
+ #define dX1 v3.2s
+ #define dX2 v4.2s
+@@ -135,17 +136,17 @@
+ SUBS setCount,setCount,#2
+
+ .ifeqs "\inverse", "TRUE"
+- fmul qT0,dX2,dW[0]
+- fmla qT0,dX3,dW[1] // real part
+- fmul qT1,dX3,dW[0]
+- fmls qT1,dX2,dW[1] // imag part
++ fmul qT0,dX2,dWs[0]
++ fmla qT0,dX3,dWs[1] // real part
++ fmul qT1,dX3,dWs[0]
++ fmls qT1,dX2,dWs[1] // imag part
+
+ .else
+
+- fmul qT0,dX2,dW[0]
+- fmls qT0,dX3,dW[1] // real part
+- fmul qT1,dX3,dW[0]
+- fmla qT1,dX2,dW[1] // imag part
++ fmul qT0,dX2,dWs[0]
++ fmls qT0,dX3,dWs[1] // real part
++ fmul qT1,dX3,dWs[0]
++ fmla qT1,dX2,dWs[1] // imag part
+
+ .endif
+
+--- a/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_s.S
++++ b/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_s.S
+@@ -80,8 +80,11 @@
+ // Neon Registers
+
+ #define dW1 v0.2s
++#define dW1s v0.s
+ #define dW2 v1.2s
++#define dW2s v1.s
+ #define dW3 v2.2s
++#define dW3s v2.s
+
+ #define dXr0 v4.2s
+ #define dXi0 v5.2s
+@@ -182,49 +185,49 @@
+
+
+ .ifeqs "\inverse", "TRUE"
+- fmul dZr1,dXr1,dW1[0]
+- fmul dZi1,dXi1,dW1[0]
+- fmul dZr2,dXr2,dW2[0]
+- fmul dZi2,dXi2,dW2[0]
+- fmul dZr3,dXr3,dW3[0]
+- fmul dZi3,dXi3,dW3[0]
++ fmul dZr1,dXr1,dW1s[0]
++ fmul dZi1,dXi1,dW1s[0]
++ fmul dZr2,dXr2,dW2s[0]
++ fmul dZi2,dXi2,dW2s[0]
++ fmul dZr3,dXr3,dW3s[0]
++ fmul dZi3,dXi3,dW3s[0]
+
+- fmla dZr1,dXi1,dW1[1] // real part
+- fmls dZi1,dXr1,dW1[1] // imag part
++ fmla dZr1,dXi1,dW1s[1] // real part
++ fmls dZi1,dXr1,dW1s[1] // imag part
+
+ // data[1] for next iteration
+ ld2 {dXr1,dXi1},[pSrc],pointStep
+
+- fmla dZr2,dXi2,dW2[1] // real part
+- fmls dZi2,dXr2,dW2[1] // imag part
++ fmla dZr2,dXi2,dW2s[1] // real part
++ fmls dZi2,dXr2,dW2s[1] // imag part
+
+ // data[2] for next iteration
+ ld2 {dXr2,dXi2},[pSrc],pointStep
+
+- fmla dZr3,dXi3,dW3[1] // real part
+- fmls dZi3,dXr3,dW3[1] // imag part
++ fmla dZr3,dXi3,dW3s[1] // real part
++ fmls dZi3,dXr3,dW3s[1] // imag part
+ .else
+- fmul dZr1,dXr1,dW1[0]
+- fmul dZi1,dXi1,dW1[0]
+- fmul dZr2,dXr2,dW2[0]
+- fmul dZi2,dXi2,dW2[0]
+- fmul dZr3,dXr3,dW3[0]
+- fmul dZi3,dXi3,dW3[0]
++ fmul dZr1,dXr1,dW1s[0]
++ fmul dZi1,dXi1,dW1s[0]
++ fmul dZr2,dXr2,dW2s[0]
++ fmul dZi2,dXi2,dW2s[0]
++ fmul dZr3,dXr3,dW3s[0]
++ fmul dZi3,dXi3,dW3s[0]
+
+- fmls dZr1,dXi1,dW1[1] // real part
+- fmla dZi1,dXr1,dW1[1] // imag part
++ fmls dZr1,dXi1,dW1s[1] // real part
++ fmla dZi1,dXr1,dW1s[1] // imag part
+
+ // data[1] for next iteration
+ ld2 {dXr1,dXi1},[pSrc],pointStep
+
+- fmls dZr2,dXi2,dW2[1] // real part
+- fmla dZi2,dXr2,dW2[1] // imag part
++ fmls dZr2,dXi2,dW2s[1] // real part
++ fmla dZi2,dXr2,dW2s[1] // imag part
+
+ // data[2] for next iteration
+ ld2 {dXr2,dXi2},[pSrc],pointStep
+
+- fmls dZr3,dXi3,dW3[1] // real part
+- fmla dZi3,dXr3,dW3[1] // imag part
++ fmls dZr3,dXi3,dW3s[1] // real part
++ fmla dZi3,dXr3,dW3s[1] // imag part
+ .endif
+
+ // data[3] & update pSrc to data[0]
+--- a/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix8_fs_s.S
++++ b/third_party/openmax_dl/dl/sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix8_fs_s.S
+@@ -352,10 +352,10 @@
+ .ifeqs "\inverse", "TRUE"
+
+ // calculate a*v5
+- fmul dT1,dVr5,dT0[0] // use dVi0 for dT1
++ fmul dT1,dVr5,dT0s[0] // use dVi0 for dT1
+
+ ld2 {dXr4,dXi4},[pSrc],pointStep // data[4]
+- fmul dVi5,dVi5,dT0[0]
++ fmul dVi5,dVi5,dT0s[0]
+
+ ld2 {dXr5,dXi5},[pSrc],pointStep // data[5]
+ fsub dVr5,dT1,dVi5 // a * V5
+@@ -364,8 +364,8 @@
+ ld2 {dXr6,dXi6},[pSrc],pointStep // data[6]
+
+ // calculate b*v7
+- fmul dT1,dVr7,dT0[0]
+- fmul dVi7,dVi7,dT0[0]
++ fmul dT1,dVr7,dT0s[0]
++ fmul dVi7,dVi7,dT0s[0]
+
+ // fadd qY1,qV1,qV5
+ // fsub qY5,qV1,qV5
+@@ -399,9 +399,9 @@
+ .else
+
+ // calculate b*v7
+- fmul dT1,dVr7,dT0[0]
++ fmul dT1,dVr7,dT0s[0]
+ ld2 {dXr4,dXi4},[pSrc],pointStep // data[4]
+- fmul dVi7,dVi7,dT0[0]
++ fmul dVi7,dVi7,dT0s[0]
+
+ ld2 {dXr5,dXi5},[pSrc],pointStep // data[5]
+ fadd dVr7,dT1,dVi7 // b * V7
+@@ -410,8 +410,8 @@
+ ld2 {dXr6,dXi6},[pSrc],pointStep // data[6]
+
+ // calculate a*v5
+- fmul dT1,dVr5,dT0[0] // use dVi0 for dT1
+- fmul dVi5,dVi5,dT0[0]
++ fmul dT1,dVr5,dT0s[0] // use dVi0 for dT1
++ fmul dVi5,dVi5,dT0s[0]
+
+ fadd dYr7,dVr3,dVr7
+ fadd dYi7,dVi3,dVi7
diff -Nru chromium-browser-47.0.2526.16/debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch chromium-browser-47.0.2526.16/debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch
--- chromium-browser-47.0.2526.16/debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch 1970-01-01 02:00:00.000000000 +0200
+++ chromium-browser-47.0.2526.16/debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch 2015-11-17 09:53:17.000000000 +0200
@@ -0,0 +1,48 @@
+From b4d5d97f6a1446babda7cebcb039ed7fef7b73fd Mon Sep 17 00:00:00 2001
+From: Joost van Zwieten <[email protected]>
+Date: Mon, 2 Nov 2015 21:47:21 +0100
+Subject: [PATCH] fix detection of ARM hard float ABI with clang
+
+The Linux version of `base::OS::ArmUsingHardFloat`, defined in
+`src/base/platform/platform-linux.cc`, always returns `false` when compiling V8
+with Clang, regardless of the target float ABI. When targeting ARMv7 with hard
+float ABI this results in faulty `fast_exp` and `fast_sqrt` functions,
+generated using masm in `src/arm/codegen-arm.cc`.
+
+As the behavior of Clang equals the latest versions of GCC, use the same test
+when we are being compiled by Clang.
+---
+ src/base/platform/platform-linux.cc | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/v8/src/base/platform/platform-linux.cc b/v8/src/base/platform/platform-linux.cc
+index a4b742a..b210ece 100644
+--- a/v8/src/base/platform/platform-linux.cc
++++ b/v8/src/base/platform/platform-linux.cc
+@@ -61,10 +61,10 @@ namespace base {
+ #ifdef __arm__
+
+ bool OS::ArmUsingHardFloat() {
+- // GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify
+- // the Floating Point ABI used (PCS stands for Procedure Call Standard).
+- // We use these as well as a couple of other defines to statically determine
+- // what FP ABI used.
++ // Clang and GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to
++ // specify the Floating Point ABI used (PCS stands for Procedure Call
++ // Standard). We use these as well as a couple of other defines to
++ // statically determine what FP ABI used.
+ // GCC versions 4.4 and below don't support hard-fp.
+ // GCC versions 4.5 may support hard-fp without defining __ARM_PCS or
+ // __ARM_PCS_VFP.
+@@ -72,7 +72,7 @@ bool OS::ArmUsingHardFloat() {
+ #define GCC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+-#if GCC_VERSION >= 40600
++#if GCC_VERSION >= 40600 || defined(__clang__)
+ #if defined(__ARM_PCS_VFP)
+ return true;
+ #else
+--
+2.6.1
+
diff -Nru chromium-browser-47.0.2526.16/debian/patches/series chromium-browser-47.0.2526.16/debian/patches/series
--- chromium-browser-47.0.2526.16/debian/patches/series 2015-10-25 04:22:41.000000000 +0200
+++ chromium-browser-47.0.2526.16/debian/patches/series 2015-11-26 12:18:36.000000000 +0200
@@ -17,3 +17,6 @@
system/ffmpeg.patch
webui.patch
+aarch64_openmax_clang.patch
+aarch64-fixes.patch
+fix-detection-of-ARM-hard-float-ABI-with-clang.patch
diff -Nru chromium-browser-47.0.2526.16/debian/rules chromium-browser-47.0.2526.16/debian/rules
--- chromium-browser-47.0.2526.16/debian/rules 2015-10-25 00:27:47.000000000 +0300
+++ chromium-browser-47.0.2526.16/debian/rules 2015-11-17 09:51:31.000000000 +0200
@@ -6,6 +6,8 @@
# enable all build hardening flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+
# linker flags to avoid memory allocation issues on i386
export LDFLAGS+=-Wl,--no-keep-memory -Wl,--reduce-memory-overheads -Wl,--hash-size=7919
@@ -15,6 +17,21 @@
# treat all warnings as errors
defines=werror=
+ifeq (arm64,$(DEB_HOST_ARCH))
+defines += \
+ target_arch=arm64
+endif
+
+ifeq (armhf,$(DEB_HOST_ARCH))
+defines += \
+ sysroot= \
+ arm_neon=0 \
+ v8_use_arm_eabi_hardfloat=true \
+ remove_webcore_debug_symbols=1 \
+ arm_version=7 \
+ enable_webrtc=0
+endif
+
# use clang instead of gcc
defines+=clang=1
defines+=clang_use_chrome_plugins=
diff -Nru chromium-browser-47.0.2526.16/debian/scripts/chromium chromium-browser-47.0.2526.16/debian/scripts/chromium
--- chromium-browser-47.0.2526.16/debian/scripts/chromium 2015-10-25 00:27:47.000000000 +0300
+++ chromium-browser-47.0.2526.16/debian/scripts/chromium 2015-11-26 12:20:10.000000000 +0200
@@ -30,11 +30,15 @@
For more information, please read and possibly provide input to their
bug tracking system at http://crbug.com/348761."
-# Check whether this system supports sse2
-if test -z "$(grep sse2 /proc/cpuinfo)"; then
- xmessage "$nosse2"
- exit 1
-fi
+case `uname -m` in
+ i386|i586|i686|x86_64)
+ # Check whether this system supports sse2
+ if ! grep -q sse2 /proc/cpuinfo; then
+ xmessage "$nosse2"
+ exit 1
+ fi
+ ;;
+esac
# Source additional settings
for file in /etc/chromium.d/*; do