Commit 99f722e2 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

winegcc: Add ARM64 support.

parent 3f393a65
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
enum target_cpu enum target_cpu
{ {
CPU_x86, CPU_x86_64, CPU_SPARC, CPU_POWERPC, CPU_ARM CPU_x86, CPU_x86_64, CPU_SPARC, CPU_POWERPC, CPU_ARM, CPU_ARM64
}; };
enum target_platform enum target_platform
......
...@@ -160,7 +160,8 @@ static const struct ...@@ -160,7 +160,8 @@ static const struct
{ "x86_64", CPU_x86_64 }, { "x86_64", CPU_x86_64 },
{ "sparc", CPU_SPARC }, { "sparc", CPU_SPARC },
{ "powerpc", CPU_POWERPC }, { "powerpc", CPU_POWERPC },
{ "arm", CPU_ARM } { "arm", CPU_ARM },
{ "aarch64", CPU_ARM64 }
}; };
static const struct static const struct
...@@ -223,6 +224,8 @@ static const enum target_cpu build_cpu = CPU_SPARC; ...@@ -223,6 +224,8 @@ static const enum target_cpu build_cpu = CPU_SPARC;
static const enum target_cpu build_cpu = CPU_POWERPC; static const enum target_cpu build_cpu = CPU_POWERPC;
#elif defined(__arm__) #elif defined(__arm__)
static const enum target_cpu build_cpu = CPU_ARM; static const enum target_cpu build_cpu = CPU_ARM;
#elif defined(__aarch64__)
static const enum target_cpu build_cpu = CPU_ARM64;
#else #else
#error Unsupported CPU #error Unsupported CPU
#endif #endif
...@@ -344,10 +347,10 @@ static int check_platform( struct options *opts, const char *file ) ...@@ -344,10 +347,10 @@ static int check_platform( struct options *opts, const char *file )
{ {
if (header[4] == 2) /* 64-bit */ if (header[4] == 2) /* 64-bit */
ret = (opts->force_pointer_size == 8 || ret = (opts->force_pointer_size == 8 ||
(!opts->force_pointer_size && opts->target_cpu == CPU_x86_64)); (!opts->force_pointer_size && (opts->target_cpu == CPU_x86_64 || opts->target_cpu == CPU_ARM64)));
else else
ret = (opts->force_pointer_size == 4 || ret = (opts->force_pointer_size == 4 ||
(!opts->force_pointer_size && opts->target_cpu != CPU_x86_64)); (!opts->force_pointer_size && opts->target_cpu != CPU_x86_64 && opts->target_cpu != CPU_ARM64));
} }
} }
close( fd ); close( fd );
...@@ -370,13 +373,13 @@ static char *get_lib_dir( struct options *opts ) ...@@ -370,13 +373,13 @@ static char *get_lib_dir( struct options *opts )
strcpy( p, libwine ); strcpy( p, libwine );
if (check_platform( opts, buffer )) goto found; if (check_platform( opts, buffer )) goto found;
if (p > buffer + 2 && (!memcmp( p - 2, "32", 2 ) || !memcmp( p - 2, "64", 2 ))) p -= 2; if (p > buffer + 2 && (!memcmp( p - 2, "32", 2 ) || !memcmp( p - 2, "64", 2 ))) p -= 2;
if (opts->force_pointer_size == 4 || (!opts->force_pointer_size && opts->target_cpu != CPU_x86_64)) if (opts->force_pointer_size == 4 || (!opts->force_pointer_size && opts->target_cpu != CPU_x86_64 && opts->target_cpu != CPU_ARM64))
{ {
strcpy( p, "32" ); strcpy( p, "32" );
strcat( p, libwine ); strcat( p, libwine );
if (check_platform( opts, buffer )) goto found; if (check_platform( opts, buffer )) goto found;
} }
if (opts->force_pointer_size == 8 || (!opts->force_pointer_size && opts->target_cpu == CPU_x86_64)) if (opts->force_pointer_size == 8 || (!opts->force_pointer_size && (opts->target_cpu == CPU_x86_64 || opts->target_cpu == CPU_ARM64)))
{ {
strcpy( p, "64" ); strcpy( p, "64" );
strcat( p, libwine ); strcat( p, libwine );
...@@ -438,7 +441,7 @@ static void compile(struct options* opts, const char* lang) ...@@ -438,7 +441,7 @@ static void compile(struct options* opts, const char* lang)
strarray_addall(comp_args, strarray_fromstring(DLLFLAGS, " ")); strarray_addall(comp_args, strarray_fromstring(DLLFLAGS, " "));
} }
if (opts->target_cpu == CPU_x86_64) if (opts->target_cpu == CPU_x86_64 || opts->target_cpu == CPU_ARM64)
{ {
strarray_add(comp_args, "-DWIN64"); strarray_add(comp_args, "-DWIN64");
strarray_add(comp_args, "-D_WIN64"); strarray_add(comp_args, "-D_WIN64");
...@@ -505,7 +508,7 @@ static void compile(struct options* opts, const char* lang) ...@@ -505,7 +508,7 @@ static void compile(struct options* opts, const char* lang)
strarray_add(comp_args, "-D__int8=char"); strarray_add(comp_args, "-D__int8=char");
strarray_add(comp_args, "-D__int16=short"); strarray_add(comp_args, "-D__int16=short");
strarray_add(comp_args, "-D__int32=int"); strarray_add(comp_args, "-D__int32=int");
if (opts->target_cpu == CPU_x86_64) if (opts->target_cpu == CPU_x86_64 || opts->target_cpu == CPU_ARM64)
strarray_add(comp_args, "-D__int64=long"); strarray_add(comp_args, "-D__int64=long");
else else
strarray_add(comp_args, "-D__int64=long long"); strarray_add(comp_args, "-D__int64=long long");
...@@ -1399,6 +1402,8 @@ int main(int argc, char **argv) ...@@ -1399,6 +1402,8 @@ int main(int argc, char **argv)
{ {
if (opts.target_cpu == CPU_x86_64) if (opts.target_cpu == CPU_x86_64)
opts.target_cpu = CPU_x86; opts.target_cpu = CPU_x86;
else if (opts.target_cpu == CPU_ARM64)
opts.target_cpu = CPU_ARM;
opts.force_pointer_size = 4; opts.force_pointer_size = 4;
raw_linker_arg = 1; raw_linker_arg = 1;
} }
......
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