Skip to content

Commit

Permalink
Merge pull request gliaskos#3 from cpu82/master
Browse files Browse the repository at this point in the history
Unbreak on arm64
  • Loading branch information
mwolf-rw authored Apr 17, 2019
2 parents b18b110 + e5a8d55 commit 67ed81c
Show file tree
Hide file tree
Showing 8 changed files with 362 additions and 56 deletions.
2 changes: 1 addition & 1 deletion www/chromium/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ PLIST_SUB+= NOT_AARCH64=""
.endif

# Make better javascript with java
.if (${ARCH} == amd64 || ${ARCH} == i386) && !defined(GN_ONLY)
.if !defined(GN_ONLY)
JAVA_BUILD= yes
JAVA_VERSION= 1.8
USE_JAVA= yes
Expand Down
11 changes: 11 additions & 0 deletions www/chromium/files/patch-build_detect__host__arch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- build/detect_host_arch.py.orig 2019-04-04 10:22:51.354518000 +0200
+++ build/detect_host_arch.py 2019-04-04 10:23:07.641855000 +0200
@@ -19,6 +19,8 @@ def HostArch():
host_arch = 'ia32'
elif host_arch in ['x86_64', 'amd64']:
host_arch = 'x64'
+ elif host_arch.startswith('arm64'):
+ host_arch = 'arm64'
elif host_arch.startswith('arm'):
host_arch = 'arm'
elif host_arch.startswith('aarch64'):
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
--- third_party/boringssl/src/crypto/cpu-aarch64-linux.c.orig 2019-03-11 22:07:58 UTC
+++ third_party/boringssl/src/crypto/cpu-aarch64-linux.c
@@ -14,49 +14,7 @@
--- third_party/boringssl/src/crypto/cpu-aarch64-linux.c.orig 2019-04-05 02:55:11.000000000 +0200
+++ third_party/boringssl/src/crypto/cpu-aarch64-linux.c 2019-04-15 08:45:47.936052000 +0200
@@ -14,49 +14,35 @@

#include <openssl/cpu.h>

-#if defined(OPENSSL_AARCH64) && defined(OPENSSL_LINUX) && \
- !defined(OPENSSL_STATIC_ARMCAP)
-
+#if defined(OPENSSL_AARCH64)

-#include <sys/auxv.h>
-
-#include <openssl/arm_arch.h>
-
-#include "internal.h"
-
-
-extern uint32_t OPENSSL_armcap_P;
#include <openssl/arm_arch.h>

#include "internal.h"

-
+#ifdef __FreeBSD__
extern uint32_t OPENSSL_armcap_P;

+#include <sys/types.h>
+#include <machine/armreg.h>
+
void OPENSSL_cpuid_setup(void) {
- unsigned long hwcap = getauxval(AT_HWCAP);
-
+ uint64_t id_aa64isar0;

- // See /usr/include/asm/hwcap.h on an aarch64 installation for the source of
- // these values.
- static const unsigned long kNEON = 1 << 1;
- static const unsigned long kAES = 1 << 3;
- static const unsigned long kPMULL = 1 << 4;
- static const unsigned long kSHA1 = 1 << 5;
- static const unsigned long kSHA256 = 1 << 6;
-
+ id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);

- if ((hwcap & kNEON) == 0) {
- // Matching OpenSSL, if NEON is missing, don't report other features
- // either.
- return;
- }
-
- OPENSSL_armcap_P |= ARMV7_NEON;
-
OPENSSL_armcap_P |= ARMV7_NEON;
- if (hwcap & kAES) {
- OPENSSL_armcap_P |= ARMV8_AES;
- }
+ if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_BASE) {
OPENSSL_armcap_P |= ARMV8_AES;
}
- if (hwcap & kPMULL) {
- OPENSSL_armcap_P |= ARMV8_PMULL;
- }
+ if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) {
OPENSSL_armcap_P |= ARMV8_PMULL;
}
- if (hwcap & kSHA1) {
- OPENSSL_armcap_P |= ARMV8_SHA1;
- }
+ if (ID_AA64ISAR0_SHA1(id_aa64isar0) == ID_AA64ISAR0_SHA1_BASE) {
OPENSSL_armcap_P |= ARMV8_SHA1;
}
- if (hwcap & kSHA256) {
- OPENSSL_armcap_P |= ARMV8_SHA256;
- }
+ if(ID_AA64ISAR0_SHA2(id_aa64isar0) == ID_AA64ISAR0_SHA2_BASE) {
OPENSSL_armcap_P |= ARMV8_SHA256;
}
}
-
-#endif // OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP
+#endif
+#endif // OPENSSL_AARCH64
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
--- third_party/crc32c/src/src/crc32c_arm64_linux_check.h.orig 2019-03-11 22:07:59 UTC
+++ third_party/crc32c/src/src/crc32c_arm64_linux_check.h
@@ -29,6 +29,8 @@ extern "C" unsigned long getauxval(unsigned long type)
--- third_party/crc32c/src/src/crc32c_arm64_linux_check.h.orig 2019-04-05 02:55:11.000000000 +0200
+++ third_party/crc32c/src/src/crc32c_arm64_linux_check.h 2019-04-15 08:43:01.276910000 +0200
@@ -7,8 +7,6 @@
#ifndef CRC32C_CRC32C_ARM_LINUX_CHECK_H_
#define CRC32C_CRC32C_ARM_LINUX_CHECK_H_

-// X86-specific code checking for the availability of SSE4.2 instructions.
-
#include <cstddef>
#include <cstdint>

@@ -16,30 +14,19 @@

#if HAVE_ARM64_CRC32C

-#if HAVE_STRONG_GETAUXVAL
-#include <sys/auxv.h>
-#elif HAVE_WEAK_GETAUXVAL
-// getauxval() is not available on Android until API level 20. Link it as a weak
-// symbol.
-extern "C" unsigned long getauxval(unsigned long type) __attribute__((weak));
-
-#define AT_HWCAP 16
-#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL
-
+#include <machine/armreg.h>
+#include <sys/types.h>
namespace crc32c {

inline bool CanUseArm64Linux() {
+return false;
+#if 0
#if HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL
// From 'arch/arm64/include/uapi/asm/hwcap.h' in Linux kernel source code.
constexpr unsigned long kHWCAP_PMULL = 1 << 4;
@@ -39,6 +41,7 @@ inline bool CanUseArm64Linux() {
#else
return false;
#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL
+#endif
}
-inline bool CanUseArm64Linux() {
-#if HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL
- // From 'arch/arm64/include/uapi/asm/hwcap.h' in Linux kernel source code.
- constexpr unsigned long kHWCAP_PMULL = 1 << 4;
- constexpr unsigned long kHWCAP_CRC32 = 1 << 7;
- unsigned long hwcap = (&getauxval != nullptr) ? getauxval(AT_HWCAP) : 0;
- return (hwcap & (kHWCAP_PMULL | kHWCAP_CRC32)) ==
- (kHWCAP_PMULL | kHWCAP_CRC32);
-#else
- return false;
-#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL
-}
+ inline bool CanUseArm64Linux() {
+ uint64_t id_aa64isar0;
+
+ id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);
+ if ((ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) && \
+ (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE))
+ return true;
+ return false;
+ }

} // namespace crc32c

Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
--- third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h.orig 2019-04-05 02:55:18.000000000 +0200
+++ third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h 2019-04-17 10:09:09.339341000 +0200
@@ -8,15 +8,15 @@
#define BUG_REPORT_URL "https://bugs.llvm.org/"

/* Define to 1 to enable backtraces, and to 0 otherwise. */
-/* #undef ENABLE_BACKTRACES */
+#define ENABLE_BACKTRACES 1

/* Define to 1 to enable crash overrides, and to 0 otherwise. */
-/* #undef ENABLE_CRASH_OVERRIDES */
+#define ENABLE_CRASH_OVERRIDES 1

/* Define to 1 if you have the `backtrace' function. */
-/* #undef HAVE_BACKTRACE */
+#define HAVE_BACKTRACE TRUE

-/* #undef BACKTRACE_HEADER */
+#define BACKTRACE_HEADER <execinfo.h>

/* Define to 1 if you have the <CrashReporterClient.h> header file. */
/* #undef HAVE_CRASHREPORTERCLIENT_H */
@@ -26,7 +26,7 @@

/* Define to 1 if you have the declaration of `arc4random', and to 0 if you
don't. */
-#define HAVE_DECL_ARC4RANDOM 0
+#define HAVE_DECL_ARC4RANDOM 1

/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you
don't. */
@@ -50,7 +50,7 @@
#define HAVE_DLOPEN 1

/* Define if dladdr() is available on this platform. */
-/* #undef HAVE_DLADDR */
+#define HAVE_DLADDR 1

/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
@@ -89,7 +89,7 @@
#define HAVE_ISATTY 1

/* Define to 1 if you have the `edit' library (-ledit). */
-/* #undef HAVE_LIBEDIT */
+#define HAVE_LIBEDIT 1

/* Define to 1 if you have the `pfm' library (-lpfm). */
/* #undef HAVE_LIBPFM */
@@ -107,25 +107,25 @@
/* #undef HAVE_PTHREAD_SETNAME_NP */

/* Define to 1 if you have the `z' library (-lz). */
-/* #undef HAVE_LIBZ */
+#define HAVE_LIBZ 1

/* Define to 1 if you have the <link.h> header file. */
#define HAVE_LINK_H 1

/* Define to 1 if you have the `lseek64' function. */
-#define HAVE_LSEEK64 1
+/* #undef HAVE_LSEEK64 */

/* Define to 1 if you have the <mach/mach.h> header file. */
/* #undef HAVE_MACH_MACH_H */

/* Define to 1 if you have the `mallctl' function. */
-/* #undef HAVE_MALLCTL */
+#define HAVE_MALLCTL 1

/* Define to 1 if you have the `mallinfo' function. */
-#define HAVE_MALLINFO 1
+/* #undef HAVE_MALLINFO */

/* Define to 1 if you have the <malloc.h> header file. */
-#define HAVE_MALLOC_H 1
+/* #undef HAVE_MALLOC_H */

/* Define to 1 if you have the <malloc/malloc.h> header file. */
/* #undef HAVE_MALLOC_MALLOC_H */
@@ -137,7 +137,7 @@
#define HAVE_POSIX_FALLOCATE 1

/* Define to 1 if you have the `posix_spawn' function. */
-/* #undef HAVE_POSIX_SPAWN */
+#define HAVE_POSIX_SPAWN 1

/* Define to 1 if you have the `pread' function. */
#define HAVE_PREAD 1
@@ -158,16 +158,16 @@
#define HAVE_REALPATH 1

/* Define to 1 if you have the `sbrk' function. */
-#define HAVE_SBRK 1
+/* #undef HAVE_SBRK */

/* Define to 1 if you have the `setenv' function. */
#define HAVE_SETENV 1

/* Define to 1 if you have the `sched_getaffinity' function. */
-#define HAVE_SCHED_GETAFFINITY 1
+/* #undef HAVE_SCHED_GETAFFINITY */

/* Define to 1 if you have the `CPU_COUNT' macro. */
-#define HAVE_CPU_COUNT 1
+/* #undef HAVE_CPU_COUNT */

/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
@@ -209,13 +209,13 @@
#define HAVE_SYS_TYPES_H 1

/* Define if the setupterm() function is supported this platform. */
-/* #undef HAVE_TERMINFO */
+#define HAVE_TERMINFO 1

/* Define if the xar_open() function is supported this platform. */
/* #undef HAVE_LIBXAR */

/* Define to 1 if you have the <termios.h> header file. */
-/* #undef HAVE_TERMIOS_H */
+#define HAVE_TERMIOS_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
@@ -224,7 +224,7 @@
/* #undef HAVE_VALGRIND_VALGRIND_H */

/* Define to 1 if you have the <zlib.h> header file. */
-/* #undef HAVE_ZLIB_H */
+#define HAVE_ZLIB_H 1

/* Have host's _alloca */
/* #undef HAVE__ALLOCA */
@@ -298,7 +298,7 @@
#elif defined(__arm__)
#define LLVM_DEFAULT_TARGET_TRIPLE "armv7-linux-gnueabihf"
#elif defined(__aarch64__)
-#define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-linux-gnu"
+#define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-portbld-freebsd"
#elif defined(__mips__)
#define LLVM_DEFAULT_TARGET_TRIPLE "mipsel-linux-gnu"
#elif defined(__mips64)
@@ -308,7 +308,7 @@
#endif

/* Define if zlib compression is available */
-#define LLVM_ENABLE_ZLIB 0
+#define LLVM_ENABLE_ZLIB 1

/* Define if overriding target triple is enabled */
/* #undef LLVM_TARGET_TRIPLE_ENV */
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/llvm-config.h.orig 2019-04-05 02:55:18.000000000 +0200
+++ third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/llvm-config.h 2019-04-17 10:09:09.340636000 +0200
@@ -28,7 +28,7 @@
#elif defined(__arm__)
#define LLVM_DEFAULT_TARGET_TRIPLE "armv7-linux-gnueabihf"
#elif defined(__aarch64__)
-#define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-linux-gnu"
+#define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-portbld-freebsd"
#elif defined(__mips__)
#define LLVM_DEFAULT_TARGET_TRIPLE "mipsel-linux-gnu"
#elif defined(__mips64)
@@ -51,7 +51,7 @@
#elif defined(__arm__)
#define LLVM_HOST_TRIPLE "armv7-linux-gnueabihf"
#elif defined(__aarch64__)
-#define LLVM_HOST_TRIPLE "aarch64-linux-gnu"
+#define LLVM_HOST_TRIPLE "aarch64-portbld-freebsd"
#elif defined(__mips__)
#define LLVM_HOST_TRIPLE "mipsel-linux-gnu"
#elif defined(__mips64)
Loading

0 comments on commit 67ed81c

Please sign in to comment.