From 61e210f1967a4237d07f5c791433b99f49e78113 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 17 Nov 2021 21:32:45 +0100 Subject: [PATCH] winebuild: Get rid of PowerPC support. Signed-off-by: Alexandre Julliard --- tools/winebuild/build.h | 2 +- tools/winebuild/import.c | 105 +-------------------------------------- tools/winebuild/main.c | 2 - tools/winebuild/parser.c | 5 -- tools/winebuild/spec32.c | 7 --- tools/winebuild/utils.c | 26 ++-------- 6 files changed, 5 insertions(+), 142 deletions(-) diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index ad893225265..ad81d671c88 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -137,7 +137,7 @@ typedef struct enum target_cpu { - CPU_x86, CPU_x86_64, CPU_POWERPC, CPU_ARM, CPU_ARM64, CPU_LAST = CPU_ARM64 + CPU_x86, CPU_x86_64, CPU_ARM, CPU_ARM64, CPU_LAST = CPU_ARM64 }; enum target_platform diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index ab15e01b53c..bde4b53f7e0 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -154,16 +154,6 @@ static struct strarray as_files; static const char import_func_prefix[] = "__wine$func$"; static const char import_ord_prefix[] = "__wine$ord$"; -static inline const char *ppc_reg( int reg ) -{ - static const char * const ppc_regs[32] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10","r11","r12","r13","r14","r15", - "r16","r17","r18","r19","r20","r21","r22","r23", - "r24","r25","r26","r27","r28","r29","r30","r31" }; - if (target_platform == PLATFORM_APPLE) return ppc_regs[reg]; - return ppc_regs[reg] + 1; /* skip the 'r' */ -} - /* compare function names; helper for resolve_imports */ static int name_cmp( const char **name, const char **entry ) { @@ -826,23 +816,6 @@ static void output_import_thunk( const char *name, const char *table, int pos ) output( "\tldr x16, [x16, #%u]\n", pos & 0x7fff ); output( "\tbr x16\n" ); break; - case CPU_POWERPC: - output( "\tmr %s, %s\n", ppc_reg(0), ppc_reg(31) ); - if (target_platform == PLATFORM_APPLE) - { - output( "\tlis %s, ha16(%s+%d+32768)\n", ppc_reg(31), table, pos ); - output( "\tla %s, lo16(%s+%d)(%s)\n", ppc_reg(31), table, pos, ppc_reg(31) ); - } - else - { - output( "\tlis %s, (%s+%d+32768)@h\n", ppc_reg(31), table, pos ); - output( "\tla %s, (%s+%d)@l(%s)\n", ppc_reg(31), table, pos, ppc_reg(31) ); - } - output( "\tlwz %s, 0(%s)\n", ppc_reg(31), ppc_reg(31) ); - output( "\tmtctr %s\n", ppc_reg(31) ); - output( "\tmr %s, %s\n", ppc_reg(31), ppc_reg(0) ); - output( "\tbctr\n" ); - break; } output_cfi( ".cfi_endproc" ); output_function_size( name ); @@ -1063,7 +1036,7 @@ static void output_delayed_imports( const DLLSPEC *spec ) /* output the delayed import thunks of a Win32 module */ static void output_delayed_import_thunks( const DLLSPEC *spec ) { - int idx, j, pos, extra_stack_storage = 0; + int idx, j, pos; struct import *import; static const char delayed_import_loaders[] = "__wine_spec_delayed_import_loaders"; static const char delayed_import_thunks[] = "__wine_spec_delayed_import_thunks"; @@ -1148,55 +1121,6 @@ static void output_delayed_import_thunks( const DLLSPEC *spec ) output( "\tldp x29, x30, [sp],#80\n" ); output( "\tbr x16\n" ); break; - case CPU_POWERPC: - if (target_platform == PLATFORM_APPLE) extra_stack_storage = 56; - - /* Save all callee saved registers into a stackframe. */ - output( "\tstwu %s, -%d(%s)\n",ppc_reg(1), 48+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(3), 4+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(4), 8+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(5), 12+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(6), 16+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(7), 20+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(8), 24+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(9), 28+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(10),32+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(11),36+extra_stack_storage, ppc_reg(1)); - output( "\tstw %s, %d(%s)\n", ppc_reg(12),40+extra_stack_storage, ppc_reg(1)); - - /* r0 -> r3 (arg1) */ - output( "\tmr %s, %s\n", ppc_reg(3), ppc_reg(0)); - - /* save return address */ - output( "\tmflr %s\n", ppc_reg(0)); - output( "\tstw %s, %d(%s)\n", ppc_reg(0), 44+extra_stack_storage, ppc_reg(1)); - - /* Call the __wine_delay_load function, arg1 is arg1. */ - output( "\tbl %s\n", asm_name("__wine_spec_delay_load") ); - - /* Load return value from call into ctr register */ - output( "\tmtctr %s\n", ppc_reg(3)); - - /* restore all saved registers and drop stackframe. */ - output( "\tlwz %s, %d(%s)\n", ppc_reg(3), 4+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(4), 8+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(5), 12+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(6), 16+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(7), 20+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(8), 24+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(9), 28+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(10),32+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(11),36+extra_stack_storage, ppc_reg(1)); - output( "\tlwz %s, %d(%s)\n", ppc_reg(12),40+extra_stack_storage, ppc_reg(1)); - - /* Load return value from call into return register */ - output( "\tlwz %s, %d(%s)\n", ppc_reg(0), 44+extra_stack_storage, ppc_reg(1)); - output( "\tmtlr %s\n", ppc_reg(0)); - output( "\taddi %s, %s, %d\n", ppc_reg(1), ppc_reg(1), 48+extra_stack_storage); - - /* branch to ctr register. */ - output( "\tbctr\n"); - break; } output_cfi( ".cfi_endproc" ); output_function_size( "__wine_delay_load_asm" ); @@ -1234,33 +1158,6 @@ static void output_delayed_import_thunks( const DLLSPEC *spec ) else output( "\tmov x16, #0x%x\n", j ); output( "\tb %s\n", asm_name("__wine_delay_load_asm") ); break; - case CPU_POWERPC: - switch(target_platform) - { - case PLATFORM_APPLE: - /* On Darwin we can use r0 and r2 */ - /* Upper part in r2 */ - output( "\tlis %s, %d\n", ppc_reg(2), idx); - /* Lower part + r2 -> r0, Note we can't use r0 directly */ - output( "\taddi %s, %s, %d\n", ppc_reg(0), ppc_reg(2), j); - output( "\tb %s\n", asm_name("__wine_delay_load_asm") ); - break; - default: - /* On linux we can't use r2 since r2 is not a scratch register (hold the TOC) */ - /* Save r13 on the stack */ - output( "\taddi %s, %s, -0x4\n", ppc_reg(1), ppc_reg(1)); - output( "\tstw %s, 0(%s)\n", ppc_reg(13), ppc_reg(1)); - /* Upper part in r13 */ - output( "\tlis %s, %d\n", ppc_reg(13), idx); - /* Lower part + r13 -> r0, Note we can't use r0 directly */ - output( "\taddi %s, %s, %d\n", ppc_reg(0), ppc_reg(13), j); - /* Restore r13 */ - output( "\tstw %s, 0(%s)\n", ppc_reg(13), ppc_reg(1)); - output( "\taddic %s, %s, 0x4\n", ppc_reg(1), ppc_reg(1)); - output( "\tb %s\n", asm_name("__wine_delay_load_asm") ); - break; - } - break; } output_cfi( ".cfi_endproc" ); } diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index 1a9be3c7ae7..8b3c0f0a285 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -51,8 +51,6 @@ int prefer_native = 0; enum target_cpu target_cpu = CPU_x86; #elif defined(__x86_64__) enum target_cpu target_cpu = CPU_x86_64; -#elif defined(__powerpc__) -enum target_cpu target_cpu = CPU_POWERPC; #elif defined(__arm__) enum target_cpu target_cpu = CPU_ARM; #elif defined(__aarch64__) diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index c9a9f1b09f3..53b44ea8e4a 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -429,11 +429,6 @@ static int parse_spec_stub( ORDDEF *odp, DLLSPEC *spec ) { odp->u.func.nb_args = -1; odp->link_name = xstrdup(""); - /* don't bother generating stubs for Winelib */ - if (odp->flags & FLAG_CPU_MASK) - odp->flags &= FLAG_CPU(CPU_x86) | FLAG_CPU(CPU_x86_64) | FLAG_CPU(CPU_ARM) | FLAG_CPU(CPU_ARM64); - else - odp->flags |= FLAG_CPU(CPU_x86) | FLAG_CPU(CPU_x86_64) | FLAG_CPU(CPU_ARM) | FLAG_CPU(CPU_ARM64); return parse_spec_arguments( odp, spec, 1 ); } diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 36df296b9c1..963268d57b0 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -98,10 +98,6 @@ static int has_relays( DLLSPEC *spec ) { int i; - if (target_cpu != CPU_x86 && target_cpu != CPU_x86_64 && - target_cpu != CPU_ARM && target_cpu != CPU_ARM64) - return 0; - for (i = spec->base; i <= spec->limit; i++) { ORDDEF *odp = spec->ordinals[i]; @@ -656,7 +652,6 @@ void output_module( DLLSPEC *spec ) output( "\tb 1f\n" ); break; case CPU_ARM64: - case CPU_POWERPC: output( "\n\t.section \".init\",\"ax\"\n" ); output( "\tb 1f\n" ); break; @@ -680,7 +675,6 @@ void output_module( DLLSPEC *spec ) { case CPU_x86: machine = IMAGE_FILE_MACHINE_I386; break; case CPU_x86_64: machine = IMAGE_FILE_MACHINE_AMD64; break; - case CPU_POWERPC: machine = IMAGE_FILE_MACHINE_POWERPC; break; case CPU_ARM: machine = IMAGE_FILE_MACHINE_ARMNT; break; case CPU_ARM64: machine = IMAGE_FILE_MACHINE_ARM64; break; } @@ -974,7 +968,6 @@ void output_fake_module( DLLSPEC *spec ) { case CPU_x86: put_word( IMAGE_FILE_MACHINE_I386 ); break; case CPU_x86_64: put_word( IMAGE_FILE_MACHINE_AMD64 ); break; - case CPU_POWERPC: put_word( IMAGE_FILE_MACHINE_POWERPC ); break; case CPU_ARM: put_word( IMAGE_FILE_MACHINE_ARMNT ); break; case CPU_ARM64: put_word( IMAGE_FILE_MACHINE_ARM64 ); break; } diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 07acb80eb8a..30e2375988c 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -45,7 +45,6 @@ static const struct { "i786", CPU_x86 }, { "amd64", CPU_x86_64 }, { "x86_64", CPU_x86_64 }, - { "powerpc", CPU_POWERPC }, { "arm", CPU_ARM }, { "armv5", CPU_ARM }, { "armv6", CPU_ARM }, @@ -346,15 +345,7 @@ struct strarray get_as_command(void) strarray_add( &args, (force_pointer_size == 8) ? "x86_64" : "i386" ); break; default: - switch(target_cpu) - { - case CPU_POWERPC: - strarray_add( &args, (force_pointer_size == 8) ? "-a64" : "-a32" ); - break; - default: - strarray_add( &args, (force_pointer_size == 8) ? "--64" : "--32" ); - break; - } + strarray_add( &args, (force_pointer_size == 8) ? "--64" : "--32" ); break; } } @@ -394,17 +385,8 @@ struct strarray get_ld_command(void) strarray_add( &args, (force_pointer_size == 8) ? "i386pep" : "i386pe" ); break; default: - switch(target_cpu) - { - case CPU_POWERPC: - strarray_add( &args, "-m" ); - strarray_add( &args, (force_pointer_size == 8) ? "elf64ppc" : "elf32ppc" ); - break; - default: - strarray_add( &args, "-m" ); - strarray_add( &args, (force_pointer_size == 8) ? "elf_x86_64" : "elf_i386" ); - break; - } + strarray_add( &args, "-m" ); + strarray_add( &args, (force_pointer_size == 8) ? "elf_x86_64" : "elf_i386" ); break; } } @@ -941,7 +923,6 @@ unsigned int get_alignment(unsigned int align) case CPU_x86_64: if (target_platform != PLATFORM_APPLE) return align; /* fall through */ - case CPU_POWERPC: case CPU_ARM: case CPU_ARM64: n = 0; @@ -965,7 +946,6 @@ unsigned int get_ptr_size(void) switch(target_cpu) { case CPU_x86: - case CPU_POWERPC: case CPU_ARM: return 4; case CPU_x86_64: