SPARC assembly won't compile, problems with NT headers

Eric Frias efrias at syncad.com
Thu Dec 22 07:43:39 CST 2005


Troy Rollo wrote:

>winegcc from the current WineHQ produces assembly output for SPARC systems 
>that cannot be processed by the assembler.
>  
>
I've attached the patches we're using for winebuild on SPARC.  This 
fixes both of the problems you're encountering.  I'm not sure if the fix 
is the right one, but it works quite nicely :-)  We use gcc/gas.

Eric
-------------- next part --------------
Index: import.c
===================================================================
--- import.c	(.../vendor/wine/current/tools/winebuild)	(revision 31841)
+++ import.c	(.../trunk/wine/tools/winebuild)	(revision 31841)
@@ -314,7 +314,7 @@
         if (odp->flags & FLAG_PRIVATE) continue;
         imp->exports[imp->nb_exports++] = odp;
     }
-    imp->exports = xrealloc( imp->exports, imp->nb_exports * sizeof(*imp->exports) );
+    imp->exports = xrealloc( imp->exports, imp->nb_exports ? (imp->nb_exports * sizeof(*imp->exports)) : 1);
     if (imp->nb_exports)
         qsort( imp->exports, imp->nb_exports, sizeof(*imp->exports), func_cmp );
     return 1;
@@ -835,7 +835,10 @@
     if (!nb_imm) return;
 
     fprintf( outfile, "\n/* immediate import thunks */\n\n" );
-    fprintf( outfile, "\t.text\n" );
+    if (target_cpu == CPU_SPARC)
+        fprintf( outfile, "\t.data\n" );
+    else
+        fprintf( outfile, "\t.text\n" );
     fprintf( outfile, "\t.align %d\n", get_alignment(8) );
     fprintf( outfile, "%s:\n", asm_name(import_thunks));
 
@@ -959,7 +962,10 @@
     if (!nb_delayed) return;
 
     fprintf( outfile, "\n/* delayed import thunks */\n\n" );
-    fprintf( outfile, "\t.text\n" );
+    if (target_cpu == CPU_SPARC)
+        fprintf( outfile, "\t.data\n" );
+    else
+        fprintf( outfile, "\t.text\n" );
     fprintf( outfile, "\t.align %d\n", get_alignment(8) );
     fprintf( outfile, "%s:\n", asm_name(delayed_import_loaders));
     fprintf( outfile, "\t%s\n", func_declaration("__wine_delay_load_asm") );
@@ -1147,7 +1153,10 @@
     for (i = 0; i < ext_link_imports.count; i++)
         fprintf( outfile, "\t%s %s\n", get_asm_ptr_keyword(), asm_name(ext_link_imports.names[i]) );
 
-    fprintf( outfile, "\n\t.text\n" );
+    if (target_cpu == CPU_SPARC)
+        fprintf( outfile, "\t.data\n" );
+    else
+        fprintf( outfile, "\t.text\n" );
     fprintf( outfile, "\t.align %d\n", get_alignment(get_ptr_size()) );
     fprintf( outfile, "%s:\n", asm_name("__wine_spec_external_link_thunks") );
 
@@ -1239,6 +1248,15 @@
     output_delayed_imports( outfile, spec );
     output_immediate_import_thunks( outfile );
     output_delayed_import_thunks( outfile, spec );
+
+    if (target_cpu == CPU_SPARC)
+        {
+        /* DJANKOV Q&D */
+        fprintf( outfile, "\n\t.data\n" );
+        fprintf( outfile, "\t.align %d\n", get_alignment(4) );
+        fprintf( outfile, "%s:\n", asm_name("_end") );
+        fprintf( outfile, "\t.long 0\n" );
+        }
     output_external_link_imports( outfile, spec );
     if (nb_imports || ext_link_imports.count || has_stubs(spec)) output_get_pc_thunk( outfile );
 }


More information about the wine-devel mailing list