summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-09-12 23:50:19 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-09-13 13:50:19 +1000
commitc8ccbfcf988ac32eed4a7e04f6a37d4ae5ff6146 (patch)
tree41c2dc69510fe5d322402602c513d9b0634ebc6c
parent07b6e5d4bef3ca46adfbdda012e35bd2937c49ec (diff)
downloadmongo-c8ccbfcf988ac32eed4a7e04f6a37d4ae5ff6146.tar.gz
WT-2900 Add ARM8 build support to WiredTiger and fix ARM CRC assembler tags (#3028)
Add -march=armv8-a+crc to the gcc compile flags for ARM, we need the optional CRC instructions.
-rw-r--r--build_posix/configure.ac.in8
-rw-r--r--examples/c/ex_event_handler.c2
-rw-r--r--src/checksum/arm64/crc32-arm64.c12
-rw-r--r--test/readonly/readonly.c37
4 files changed, 36 insertions, 23 deletions
diff --git a/build_posix/configure.ac.in b/build_posix/configure.ac.in
index cbd9e4e4123..3526abc8254 100644
--- a/build_posix/configure.ac.in
+++ b/build_posix/configure.ac.in
@@ -39,7 +39,7 @@ if test "$wt_cv_enable_strict" = "yes"; then
case "$wt_cv_cc_version" in
*clang*)
AM_CLANG_WARNINGS;;
- *gcc*|*GCC*)
+ *cc*|*CC*) # cc, CC, gcc, GCC
AM_GCC_WARNINGS;;
*)
AC_MSG_ERROR(
@@ -87,6 +87,12 @@ if test "$GCC" = "yes"; then
if test "`uname -s`" = "SunOS"; then
AM_CFLAGS="$AM_CFLAGS -pthreads"
fi
+
+ # ARMv8-A is the 64-bit ARM architecture, turn on the optional CRC
+ # instructions.
+ if test "$wt_cv_arm64" = "yes"; then
+ AM_CFLAGS="$AM_CFLAGS -march=armv8-a+crc"
+ fi
else
# The Solaris native compiler gets the additional -mt flag.
if test "`uname -s`" = "SunOS"; then
diff --git a/examples/c/ex_event_handler.c b/examples/c/ex_event_handler.c
index 7122e71882e..03809cae7c8 100644
--- a/examples/c/ex_event_handler.c
+++ b/examples/c/ex_event_handler.c
@@ -131,7 +131,7 @@ main(void)
*/
if (getenv("WIREDTIGER_HOME") == NULL) {
home = "WT_HOME";
- (void)system("rm -rf WT_HOME && mkdir WT_HOME");
+ ret = system("rm -rf WT_HOME && mkdir WT_HOME");
} else
home = NULL;
diff --git a/src/checksum/arm64/crc32-arm64.c b/src/checksum/arm64/crc32-arm64.c
index 5d6c5f69c58..38b4f623044 100644
--- a/src/checksum/arm64/crc32-arm64.c
+++ b/src/checksum/arm64/crc32-arm64.c
@@ -32,14 +32,18 @@
#include <asm/hwcap.h>
#include <sys/auxv.h>
+#ifndef __GNUC__
+#define __asm__ asm
+#endif
+
#define CRC32CX(crc,value) \
- asm("crc32cx %w[c], %w[c], %x[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
+ __asm__("crc32cx %w[c], %w[c], %x[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
#define CRC32CW(crc,value) \
- asm("crc32cw %w[c], %w[c], %w[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
+ __asm__("crc32cw %w[c], %w[c], %w[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
#define CRC32CH(crc,value) \
- asm("crc32ch %w[c], %w[c], %w[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
+ __asm__("crc32ch %w[c], %w[c], %w[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
#define CRC32CB(crc,value) \
- asm("crc32cb %w[c], %w[c], %w[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
+ __asm__("crc32cb %w[c], %w[c], %w[v]" : [c]"+r"(*&crc) : [v]"r"(+value))
/*
* __wt_checksum_hw --
diff --git a/test/readonly/readonly.c b/test/readonly/readonly.c
index 31edc0d2a24..7a131912c31 100644
--- a/test/readonly/readonly.c
+++ b/test/readonly/readonly.c
@@ -276,18 +276,21 @@ main(int argc, char *argv[])
(void)snprintf(cmd, sizeof(cmd),
"cp -rp %s/* %s; rm -f %s/WiredTiger.lock",
home, home_wr, home_wr);
- (void)system(cmd);
+ if ((status = system(cmd)) < 0)
+ testutil_die(status, "system: %s", cmd);
(void)snprintf(cmd, sizeof(cmd),
"cp -rp %s/* %s; chmod 0555 %s; chmod -R 0444 %s/*",
home, home_rd, home_rd, home_rd);
- (void)system(cmd);
+ if ((status = system(cmd)) < 0)
+ testutil_die(status, "system: %s", cmd);
(void)snprintf(cmd, sizeof(cmd),
"cp -rp %s/* %s; rm -f %s/WiredTiger.lock; "
"chmod 0555 %s; chmod -R 0444 %s/*",
home, home_rd2, home_rd2, home_rd2, home_rd2);
- (void)system(cmd);
+ if ((status = system(cmd)) < 0)
+ testutil_die(status, "system: %s", cmd);
/*
* Run four scenarios. Sometimes expect errors, sometimes success.
@@ -326,16 +329,15 @@ main(int argc, char *argv[])
* same memory image. Therefore the WT process structure is set in
* the child even though it should not be. So use 'system' to spawn
* an entirely new process.
+ *
+ * The child will exit with success if its test passes.
*/
(void)snprintf(
cmd, sizeof(cmd), "%s -h %s -R", saved_argv0, working_dir);
if ((status = system(cmd)) < 0)
- testutil_die(status, "system");
- /*
- * The child will exit with success if its test passes.
- */
+ testutil_die(status, "system: %s", cmd);
if (WEXITSTATUS(status) != 0)
- testutil_die(WEXITSTATUS(status), "system");
+ testutil_die(WEXITSTATUS(status), "system: %s", cmd);
/*
* Scenario 2. Run child with writable config.
@@ -343,10 +345,9 @@ main(int argc, char *argv[])
(void)snprintf(
cmd, sizeof(cmd), "%s -h %s -W", saved_argv0, working_dir);
if ((status = system(cmd)) < 0)
- testutil_die(status, "system");
-
+ testutil_die(status, "system: %s", cmd);
if (WEXITSTATUS(status) != 0)
- testutil_die(WEXITSTATUS(status), "system");
+ testutil_die(WEXITSTATUS(status), "system: %s", cmd);
/*
* Reopen the two writable directories and rerun the child.
@@ -365,9 +366,9 @@ main(int argc, char *argv[])
(void)snprintf(
cmd, sizeof(cmd), "%s -h %s -R", saved_argv0, working_dir);
if ((status = system(cmd)) < 0)
- testutil_die(status, "system");
+ testutil_die(status, "system: %s", cmd);
if (WEXITSTATUS(status) != 0)
- testutil_die(WEXITSTATUS(status), "system");
+ testutil_die(WEXITSTATUS(status), "system: %s", cmd);
/*
* Scenario 4. Run child with writable config.
@@ -375,9 +376,9 @@ main(int argc, char *argv[])
(void)snprintf(
cmd, sizeof(cmd), "%s -h %s -W", saved_argv0, working_dir);
if ((status = system(cmd)) < 0)
- testutil_die(status, "system");
+ testutil_die(status, "system: %s", cmd);
if (WEXITSTATUS(status) != 0)
- testutil_die(WEXITSTATUS(status), "system");
+ testutil_die(WEXITSTATUS(status), "system: %s", cmd);
/*
* Clean-up.
@@ -395,10 +396,12 @@ main(int argc, char *argv[])
* be removed by scripts.
*/
(void)snprintf(cmd, sizeof(cmd), "chmod 0777 %s %s", home_rd, home_rd2);
- (void)system(cmd);
+ if ((status = system(cmd)) < 0)
+ testutil_die(status, "system: %s", cmd);
(void)snprintf(cmd, sizeof(cmd), "chmod -R 0666 %s/* %s/*",
home_rd, home_rd2);
- (void)system(cmd);
+ if ((status = system(cmd)) < 0)
+ testutil_die(status, "system: %s", cmd);
printf(" *** Readonly test successful ***\n");
return (EXIT_SUCCESS);
}