Reactor: fix using -x86-asm-syntax only on x86 compilations
The LLVM JIT fails loudly when attempting to parse this command line
option when targeting non-x86 CPUs.
Bug: b/157555596
Change-Id: Ic5ddccbdbc86c2f03ded5f4004369ece0100c031
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52488
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/Reactor/LLVMJIT.cpp b/src/Reactor/LLVMJIT.cpp
index b6c5d22..eaee17b 100644
--- a/src/Reactor/LLVMJIT.cpp
+++ b/src/Reactor/LLVMJIT.cpp
@@ -113,9 +113,7 @@
{
// Use a static immediately invoked lambda to make this thread safe
static auto initialized = [=]() {
- llvm::cl::ParseCommandLineOptions(argc, argv);
-
- return true;
+ return llvm::cl::ParseCommandLineOptions(argc, argv);
}();
return initialized;
@@ -146,8 +144,10 @@
static JITGlobals instance = [] {
const char *argv[] = {
"Reactor",
- "-x86-asm-syntax", "intel", // Use Intel syntax rather than the default AT&T
- "-warn-stack-size", "524288" // Warn when a function uses more than 512 KiB of stack memory
+#if defined(__i386__) || defined(__x86_64__)
+ "-x86-asm-syntax=intel", // Use Intel syntax rather than the default AT&T
+#endif
+ "-warn-stack-size=524288" // Warn when a function uses more than 512 KiB of stack memory
};
parseCommandLineOptionsOnce(sizeof(argv) / sizeof(argv[0]), argv);