Merge pull request #22117 from dezgeg/aarch64-for-merge

Aarch64 (ARM64) support
This commit is contained in:
Tuomas Tynkkynen
2017-01-26 17:52:28 +02:00
committed by GitHub
30 changed files with 305 additions and 27 deletions

View File

@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
postPatch = ''
# Fixes an issue with version detection under perl 5.22.x
sed -i 's/(defined\((@TEMPLATE_FILE)\))/\1/' config/milestone.pl
'' + stdenv.lib.optionalString stdenv.isAarch64 ''
patch -p1 -d ../.. < ${./aarch64-double-conversion.patch}
'';
preConfigure = ''

View File

@@ -0,0 +1,13 @@
diff -ru mozjs17.0.0-orig/mfbt/double-conversion/utils.h mozjs17.0.0/mfbt/double-conversion/utils.h
--- mozjs17.0.0-orig/mfbt/double-conversion/utils.h 2013-02-11 17:33:28.000000000 -0500
+++ mozjs17.0.0/mfbt/double-conversion/utils.h 2016-12-03 20:39:07.915042988 -0500
@@ -58,7 +58,8 @@
defined(__mips__) || defined(__powerpc__) || \
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
defined(__SH4__) || defined(__alpha__) || \
- defined(_MIPS_ARCH_MIPS32R2)
+ defined(_MIPS_ARCH_MIPS32R2) || \
+ defined(__AARCH64EL__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
#if defined(_WIN32)

View File

@@ -93,7 +93,7 @@ stdenv.mkDerivation ({
"--enable-kernel=2.6.32"
] ++ lib.optionals (cross != null) [
(if cross.withTLS then "--with-tls" else "--without-tls")
(if cross.float == "soft" then "--without-fp" else "--with-fp")
(if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp")
] ++ lib.optionals (cross != null
&& cross.platform ? kernelMajor
&& cross.platform.kernelMajor == "2.6") [

View File

@@ -0,0 +1,39 @@
{ stdenv, fetchurl }:
let
rev = "6a82322dd05cdc57b4cd9f7effdf1e2fd6f7482b";
# Don't use fetchgit as this is needed during Aarch64 bootstrapping
configGuess = fetchurl {
url = "http://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=${rev}";
sha256 = "1yj9yi94h7z4z6jzickddv64ksz1aq5kj0c7krgzjn8xf8p3avmh";
};
configSub = fetchurl {
url = "http://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=${rev}";
sha256 = "1qsqdpla6icbzskkk7v3zxrpzlpqlc94ny9hyy5wh5lm5rwwfvb7";
};
in
stdenv.mkDerivation rec {
name = "gnu-config-${version}";
version = "2016-12-31";
buildCommand = ''
mkdir -p $out
cp ${configGuess} $out/config.guess
cp ${configSub} $out/config.sub
'';
meta = with stdenv.lib; {
description = "Attempt to guess a canonical system name";
homepage = http://savannah.gnu.org/projects/config;
license = licenses.gpl3;
# In addition to GPLv3:
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program.
maintainers = [ maintainers.dezgeg ];
platforms = platforms.all;
};
}

View File

@@ -0,0 +1,13 @@
diff -ru gnu-efi-3.0.4-orig/lib/aarch64/initplat.c gnu-efi-3.0.4/lib/aarch64/initplat.c
--- gnu-efi-3.0.4-orig/lib/aarch64/initplat.c 2016-03-17 09:53:14.000000000 -0400
+++ gnu-efi-3.0.4/lib/aarch64/initplat.c 2016-12-03 17:53:57.166575974 -0500
@@ -41,7 +41,8 @@
void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n)
{
- unsigned char *p = dest, *q = src;
+ unsigned char *p = dest;
+ const unsigned char *q = src;
while (n--)
*p++ = *q++;

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchurl, pciutils }:
{ stdenv, fetchurl, pciutils }: with stdenv.lib;
stdenv.mkDerivation rec {
name = "gnu-efi-${version}";
@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "1bzq5czw5dxlvpgs9ij2iz7q6krwhja87vc982r6vffcqcl0982i";
};
patches = optional stdenv.isAarch64 ./aarch64-fix-discarded-qualifier.patch;
buildInputs = [ pciutils ];
hardeningDisable = [ "stackprotector" ];

View File

@@ -0,0 +1,12 @@
diff --git a/configure b/configure
index 6c4e868..0298e19 100755
--- a/configure
+++ b/configure
@@ -14501,6 +14501,7 @@ else
case "$host_cpu" in
a29k | \
+ aarch64* | \
alpha* | \
arc | \
arm* | strongarm* | xscale* | \

View File

@@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
sha256 = "16hrs8k3nmc7a8jam5j1fpspd6sdpkamskvsdpcw6m29vnis8q44";
};
# Based on https://github.com/davidgfnet/buildroot-Os/blob/69fe6065b9dd1cb4dcc0a4b554e42cc2e5bd0d60/package/libsigsegv/libsigsegv-0002-fix-aarch64-build.patch
# but applied directly to configure since we can't use autoreconf while bootstrapping.
patches = if stdenv.isAarch64 || stdenv.cross.arch or "" == "aarch64"
then [ ./aarch64.patch ]
else null; # TODO: change to lib.optional on next mass rebuild
# https://github.com/NixOS/nixpkgs/issues/6028
doCheck = false;

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch, xz }:
{ stdenv, fetchurl, fetchpatch, autoreconfHook, xz }:
stdenv.mkDerivation rec {
name = "libunwind-1.1";
@@ -8,13 +8,18 @@ stdenv.mkDerivation rec {
sha256 = "16nhx2pahh9d62mvszc88q226q5lwjankij276fxwrm8wb50zzlx";
};
buildInputs = stdenv.lib.optional stdenv.isAarch64 autoreconfHook;
patches = [ ./libunwind-1.1-lzma.patch ./cve-2015-3239.patch
# https://lists.nongnu.org/archive/html/libunwind-devel/2014-04/msg00000.html
(fetchpatch {
url = "https://raw.githubusercontent.com/dropbox/pyston/1b2e676417b0f5f17526ece0ed840aa88c744145/libunwind_patches/0001-Change-the-RBP-validation-heuristic-to-allow-size-0-.patch";
sha256 = "1a0fsgfxmgd218nscswx7pgyb7rcn2gh6566252xhfvzhgn5i4ha";
})
];
] ++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
url = "https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/77709d1c6d5c39e23c1535b1bd584be1455f2551/extra/libunwind/libunwind-aarch64.patch";
sha256 = "1mpjs8izq9wxiaf5rl4gzaxrkz0s51f9qz5qc5dj72pr84mw50w8";
});
postPatch = ''
sed -i -e '/LIBLZMA/s:-lzma:-llzma:' configure