Fix x86 system calls made from ELF preinit.
Used by CFI, so broke cfi_test#early_init@x86, but I've added a specific
test for this (and a similar test for getauxval from preinit, which this
patch does not fix).
Bug: http://b/35885875
Test: ran tests
Change-Id: I43885bedfb88c0a26b4474bd3c27a87dec7bbc97
diff --git a/tests/libs/libs_utils.h b/tests/libs/libs_utils.h
index f11cbe7..7dae241 100644
--- a/tests/libs/libs_utils.h
+++ b/tests/libs/libs_utils.h
@@ -17,13 +17,11 @@
#ifndef LIBS_UTILS_H
#define LIBS_UTILS_H
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-#define CHECK(x) \
- do { \
- fprintf(stderr, "CHECK(" #x ") failed at %s:%d\n", __FILE__, __LINE__); \
- if (!(x)) abort(); \
- } while (0)
+#define CHECK(e) \
+ ((e) ? static_cast<void>(0) : __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, #e))
#endif // LIBS_UTILS_H