On 3 November 2015 at 20:37, Joost van Zwieten
<[email protected]> wrote:
> Hi,
>
> I have been building chromium for (and on) an armhf machine for more
> than a year using the first two of the attached patches (rebased onto
> debian/46.0.2490.71-1). I also suffered from the OOM issue during
> linking, but I solved it by disabling generating debug symbols (not in
> included in the patches!). I will test the new binutils tonight.

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 updated the first patch to include defining DEB_HOST_ARCH in
debian/rules if undefined, as suggested by the man page of
dpkg-buildflags.

Best, Joost
From 682141d283abbcc62d409d82fab99b062b136a57 Mon Sep 17 00:00:00 2001
From: Joost van Zwieten <[email protected]>
Date: Sun, 24 Aug 2014 23:46:07 +0200
Subject: [PATCH 1/4] enable armhf

---
 debian/control |  6 +++---
 debian/rules   | 13 +++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/debian/control b/debian/control
index 5172532..cfe66a8 100644
--- a/debian/control
+++ b/debian/control
@@ -84,7 +84,7 @@ Build-Depends:
 Standards-Version: 3.9.6
 
 Package: chromium
-Architecture: i386 amd64
+Architecture: i386 amd64 armhf
 Built-Using: ${Built-Using}
 Depends:
  ${misc:Depends},
@@ -105,7 +105,7 @@ Description: web browser
  This package contains the web browser component.
 
 Package: chromium-dbg
-Architecture: i386 amd64
+Architecture: i386 amd64 armhf
 Section: debug
 Priority: extra
 Built-Using: ${Built-Using}
@@ -134,7 +134,7 @@ Description: web browser - language packs
  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
 Depends:
  ${misc:Depends},
  ${shlibs:Depends},
diff --git a/debian/rules b/debian/rules
index cb86461..7412adb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,6 +12,9 @@ export LDFLAGS+=-Wl,--no-keep-memory -Wl,--reduce-memory-overheads -Wl,--hash-si
 # more verbose linker output
 export LDFLAGS+=-Wl,--trace -Wl,--stats
 
+# set DEB_HOST_ARCH if undefined
+DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
+
 # treat all warnings as errors
 defines=werror=
 
@@ -83,6 +86,16 @@ defines+=use_system_icu=0 \
 #  can't use system nss since net/third_party/nss is heavily patched
 #  can't use system ots (open text *summarizer*) since that's not google's ots (open text *sanitizer*)
 
+ifeq ($(DEB_HOST_ARCH),armhf)
+# arm_version=7, arm_neon=0 selects arm_arch=armv7-a, arm_tune=generic-armv7-a, arm_fpu=vfpv3-d16
+defines+=sysroot= \
+         target_arch=arm \
+         arm_version=7 \
+         arm_neon=0
+# webrtc is not compatible with arm_neon=0
+defines+=enable_webrtc=0
+endif
+
 # make gyp a little more informative
 options+=--check \
          --debug=includes \
-- 
2.6.2

From ab6a33d1ed51bb3f392043b3b5422671eee3daca Mon Sep 17 00:00:00 2001
From: Joost van Zwieten <[email protected]>
Date: Wed, 3 Dec 2014 10:04:27 +0100
Subject: [PATCH 2/4] disable sse2 message for arm platforms

---
 debian/scripts/chromium | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/scripts/chromium b/debian/scripts/chromium
index 28f2854..a0b5c9e 100644
--- a/debian/scripts/chromium
+++ b/debian/scripts/chromium
@@ -31,7 +31,7 @@ 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
+if test -z "$(grep sse2 /proc/cpuinfo)" -a -z "$(uname -m | grep arm)"; then
   xmessage "$nosse2"
   exit 1
 fi
-- 
2.6.2

From d19483212de9011c6abed3191a96ffac5025ae13 Mon Sep 17 00:00:00 2001
From: Joost van Zwieten <[email protected]>
Date: Mon, 2 Nov 2015 22:54:47 +0100
Subject: [PATCH 3/4] fix detection of ARM hard float ABI with clang

Bug reported upstream [2140#c24].  Pending approval applying the patch here.

[2140#c24] https://code.google.com/p/v8/issues/detail?id=2140#c24
---
 ...etection-of-ARM-hard-float-ABI-with-clang.patch | 48 ++++++++++++++++++++++
 debian/patches/series                              |  2 +
 2 files changed, 50 insertions(+)
 create mode 100644 debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch

diff --git a/debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch b/debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch
new file mode 100644
index 0000000..aee0246
--- /dev/null
+++ b/debian/patches/fix-detection-of-ARM-hard-float-ABI-with-clang.patch
@@ -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 --git a/debian/patches/series b/debian/patches/series
index d035781..c853cba 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -14,3 +14,5 @@ system/nspr.patch
 system/clang.patch
 system/ffmpeg.patch
 webui.patch
+
+fix-detection-of-ARM-hard-float-ABI-with-clang.patch
-- 
2.6.2

From 000a232ec71eaab97c6bad31e67a03e88c10b206 Mon Sep 17 00:00:00 2001
From: Joost van Zwieten <[email protected]>
Date: Tue, 17 Nov 2015 22:59:14 +0100
Subject: [PATCH 4/4] reduce debug info for armhf to line numbers only

Compiling chromium with `-g` on an armhf causes the linker to run out of
memory.  Replacing `-g` with `-gline-tables-only` reduces the amount of debug
information to line numbers only, which is sufficient to complete the linking
phase.
---
 debian/rules | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/debian/rules b/debian/rules
index 7412adb..5ca617c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -94,6 +94,11 @@ defines+=sysroot= \
          arm_neon=0
 # webrtc is not compatible with arm_neon=0
 defines+=enable_webrtc=0
+# reduce debug information to line numbers only, linker runs out of memory otherwise
+export DEB_CFLAGS_MAINT_STRIP+=-g
+export DEB_CXXFLAGS_MAINT_STRIP+=-g
+export DEB_CFLAGS_MAINT_PREPEND+=-gline-tables-only
+export DEB_CXXFLAGS_MAINT_PREPEND+=-gline-tables-only
 endif
 
 # make gyp a little more informative
-- 
2.6.2

  • Bug#799939: Joost van Zwieten

Reply via email to