Package: wine-dev
Version: 0.9.59-1
Severity: important
Tags: patch

Hi,

the attached patch makes winebuild use the correct mnemonic for branching
over a data area on powerpc. SPARC might need to be investigated, they
have both "jmp" and "b", and we probably want a relative jump here so
the resulting objects can be PIC, but I don't have the hardware to test
it here, so the patch does not change behaviour on SPARC.

   Simon

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.24-1-powerpc
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 85309ad..ebdd039 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -180,6 +180,7 @@ extern const char *get_asm_string_keyword(void);
 extern const char *get_asm_short_keyword(void);
 extern const char *get_asm_rodata_section(void);
 extern const char *get_asm_string_section(void);
+extern const char *get_asm_branch_mnemonic(void);
 extern void output_function_size( const char *name );
 extern void output_gnu_stack_note(void);
 
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 32a8299..49fafa9 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -368,7 +368,7 @@ void BuildSpec32File( DLLSPEC *spec )
     else
     {
         output( "\n\t.section \".init\",\"ax\"\n" );
-        output( "\tjmp 1f\n" );
+        output( "\t%s 1f\n", get_asm_branch_mnemonic() );
         output( "__wine_spec_pe_header:\n" );
         output( "\t.skip %u\n", 65536 + page_size );
         output( "1:\n" );
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 8f137d8..139ccb0 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -630,3 +630,20 @@ const char *get_asm_string_section(void)
     default:             return ".section .rodata";
     }
 }
+
+const char *get_asm_branch_mnemonic(void)
+{
+    switch(target_cpu)
+    {
+    case CPU_x86:
+    case CPU_x86_64:
+    case CPU_SPARC:
+    case CPU_ALPHA:
+        return "jmp";
+    case CPU_POWERPC:
+        return "b";
+    }
+    /* unreached */
+    assert(0);
+    return 0;
+}

Reply via email to