Commit fe796495 by Stephen Lanham

Update BUILD.gn configs to support ARM[64] builds.

Bug: b/114402930 Change-Id: Id7eedc6b01f40d24188d514755d5c89689b24abb Reviewed-on: https://swiftshader-review.googlesource.com/20568Tested-by: 's avatarStephen Lanham <slan@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 17b75890
...@@ -88,7 +88,7 @@ config("swiftshader_config") { ...@@ -88,7 +88,7 @@ config("swiftshader_config") {
"-march=x86-64", "-march=x86-64",
"-mtune=generic", "-mtune=generic",
] ]
} else { # 32 bit version } else if (target_cpu == "x86") { # 32 bit version
cflags += [ cflags += [
"-m32", "-m32",
"-msse2", "-msse2",
......
...@@ -21,7 +21,7 @@ config("swiftshader_common_private_config") { ...@@ -21,7 +21,7 @@ config("swiftshader_common_private_config") {
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd5030", # attribute is not recognized "/wd5030", # attribute is not recognized
] ]
} else { } else if (target_cpu == "x86" || target_cpu == "x64") {
cflags = [ "-msse2" ] cflags = [ "-msse2" ]
} }
} }
......
...@@ -241,7 +241,7 @@ namespace sw ...@@ -241,7 +241,7 @@ namespace sw
return InterlockedExchange64(target, value); return InterlockedExchange64(target, value);
#else #else
int ret; int ret;
__asm__ __volatile__("lock; xchg8 %0,(%1)" : "=r" (ret) :"r" (target), "0" (value) : "memory" ); __asm__ __volatile__("lock; xchg8 %x0,(%x1)" : "=r" (ret) :"r" (target), "0" (value) : "memory" );
return ret; return ret;
#endif #endif
} }
...@@ -252,7 +252,7 @@ namespace sw ...@@ -252,7 +252,7 @@ namespace sw
return InterlockedExchange((volatile long*)target, (long)value); return InterlockedExchange((volatile long*)target, (long)value);
#else #else
int ret; int ret;
__asm__ __volatile__("lock; xchgl %0,(%1)" : "=r" (ret) :"r" (target), "0" (value) : "memory" ); __asm__ __volatile__("lock; xchgl %x0,(%x1)" : "=r" (ret) :"r" (target), "0" (value) : "memory" );
return ret; return ret;
#endif #endif
} }
......
...@@ -29,7 +29,7 @@ config("swiftshader_main_private_config") { ...@@ -29,7 +29,7 @@ config("swiftshader_main_private_config") {
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} }
} else { } else if (target_cpu == "x86" || target_cpu == "x64") {
cflags = [ "-msse2" ] cflags = [ "-msse2" ]
defines = defines =
[ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ] [ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
......
...@@ -28,7 +28,10 @@ config("swiftshader_libEGL_private_config") { ...@@ -28,7 +28,10 @@ config("swiftshader_libEGL_private_config") {
defines += [ "EGLAPI=" ] defines += [ "EGLAPI=" ]
} else { } else {
cflags = [ "-Wno-sign-compare" ] cflags = [
"-Wno-sign-compare",
"-Wno-unused-function",
]
if (!is_clang) { if (!is_clang) {
cflags += [ "-Wno-unused-but-set-variable" ] cflags += [ "-Wno-unused-but-set-variable" ]
} }
......
...@@ -152,7 +152,7 @@ config("swiftshader_reactor_private_config") { ...@@ -152,7 +152,7 @@ config("swiftshader_reactor_private_config") {
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4245", # conversion from int to unsigned int (llvm) "/wd4245", # conversion from int to unsigned int (llvm)
] ]
} else { } else if (target_cpu == "x86" || target_cpu == "x64") {
cflags = [ cflags = [
"-Wno-unused-local-typedef", "-Wno-unused-local-typedef",
"-msse2", "-msse2",
......
...@@ -103,7 +103,7 @@ namespace ...@@ -103,7 +103,7 @@ namespace
static bool detectARM() static bool detectARM()
{ {
#if defined(__arm__) #if defined(__arm__) || defined(__aarch64__)
return true; return true;
#elif defined(__i386__) || defined(__x86_64__) #elif defined(__i386__) || defined(__x86_64__)
return false; return false;
...@@ -372,6 +372,8 @@ namespace sw ...@@ -372,6 +372,8 @@ namespace sw
assert(sizeof(void*) == 8 && elfHeader->e_machine == EM_X86_64); assert(sizeof(void*) == 8 && elfHeader->e_machine == EM_X86_64);
#elif defined(__arm__) #elif defined(__arm__)
assert(sizeof(void*) == 4 && elfHeader->e_machine == EM_ARM); assert(sizeof(void*) == 4 && elfHeader->e_machine == EM_ARM);
#elif defined(__aarch64__)
assert(sizeof(void*) == 8 && elfHeader->e_machine == EM_AARCH64);
#else #else
#error "Unsupported platform" #error "Unsupported platform"
#endif #endif
......
...@@ -22,7 +22,7 @@ config("swiftshader_renderer_private_config") { ...@@ -22,7 +22,7 @@ config("swiftshader_renderer_private_config") {
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
"/wd5030", # attribute is not recognized "/wd5030", # attribute is not recognized
] ]
} else { } else if (target_cpu == "x86" || target_cpu == "x64") {
cflags = [ cflags = [
"-msse2", "-msse2",
"-Wno-sign-compare", "-Wno-sign-compare",
......
...@@ -54,7 +54,7 @@ config("swiftshader_llvm_private_config") { ...@@ -54,7 +54,7 @@ config("swiftshader_llvm_private_config") {
cflags += [ "-Wno-error" ] cflags += [ "-Wno-error" ]
} }
if (is_clang) { if (is_clang && (target_cpu == "x86" || target_cpu == "x64")) {
cflags += [ cflags += [
"-msse2", "-msse2",
"-Wno-header-hygiene", "-Wno-header-hygiene",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment