WineBuild Fixes for x86 on Mac OS X [file attached]

Pierre d'Herbemont stegefin at free.fr
Thu Jun 9 15:49:35 CDT 2005


The files is attached this time.

On 9 juin 05, at 22:46, Pierre d'Herbemont wrote:

> Hi,
>
> Those are easy fixes for Mac OS X/i386, as it is highly fashionable  
> theses days. Although untested.
>
> Pierre.
>
>

ChangeLog
Use .mod_*_func sections on Mac OS X/i386 instead of the elf  
constructor/destructor.

-------------- next part --------------
Index: tools/winebuild/spec32.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.91
diff -u -r1.91 spec32.c
--- tools/winebuild/spec32.c	6 Jun 2005 15:59:50 -0000	1.91
+++ tools/winebuild/spec32.c	9 Jun 2005 20:42:07 -0000
@@ -397,6 +397,23 @@
 void output_dll_init( FILE *outfile, const char *constructor, const char *destructor )
 {
 #if defined(__i386__)
+# ifdef __APPLE__
+/* Mach-O doesn't have an init section */
+    if (constructor)
+    {
+        fprintf( outfile, "asm(\"\\t.mod_init_func\\n\"\n" );
+        fprintf( outfile, "    \"\\t.align 2\\n\"\n" );
+        fprintf( outfile, "    \"\\t.long " __ASM_NAME("%s") "\\n\"\n", constructor );
+        fprintf( outfile, "    \"\\t.text\\n\");\n" );
+    }
+    if (destructor)
+    {
+        fprintf( outfile, "asm(\"\\t.mod_term_func\\n\"\n" );
+        fprintf( outfile, "    \"\\t.align 2\\n\"\n" );
+        fprintf( outfile, "    \"\\t.long " __ASM_NAME("%s") "\\n\"\n", destructor );
+        fprintf( outfile, "    \"\\t.text\\n\");\n" );
+    }
+# else /* __APPLE__ */
     if (constructor)
     {
         fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
@@ -409,6 +426,7 @@
         fprintf( outfile, "    \"\\tcall " __ASM_NAME("%s") "\\n\"\n", destructor );
         fprintf( outfile, "    \"\\t.section\\t\\\".text\\\"\\n\");\n" );
     }
+# endif /* __APPLE__ */
 #elif defined(__sparc__)
     if (constructor)
     {
@@ -937,11 +955,22 @@
              prefix, prefix );
 
 #if defined(__i386__)
+# ifdef __APPLE__
+	fprintf( outfile, "asm(\"\\t.mod_init_func\\n\"\n" );
+	fprintf( outfile, "    \"\\t.align 2\\n\"\n" );
+	fprintf( outfile, "    \"\\t.long " __ASM_NAME("__wine_dbg_%s_init") "\\n\"\n", prefix );
+	fprintf( outfile, "    \"\\t.text\\n\");\n" );
+	fprintf( outfile, "asm(\"\\t.mod_term_func\\n\"\n" );
+	fprintf( outfile, "    \"\\t.align 2\\n\"\n" );
+	fprintf( outfile, "    \"\\t.long " __ASM_NAME("__wine_dbg_%s_fini") "\\n\"\n", prefix );
+	fprintf( outfile, "    \"\\t.text\\n\");\n" );
+# else
     fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
     fprintf( outfile, "    \"\\tcall " __ASM_NAME("__wine_dbg_%s_init") "\\n\"\n", prefix );
     fprintf( outfile, "    \"\\t.section\\t\\\".fini\\\" ,\\\"ax\\\"\\n\"\n" );
     fprintf( outfile, "    \"\\tcall " __ASM_NAME("__wine_dbg_%s_fini") "\\n\"\n", prefix );
     fprintf( outfile, "    \"\\t.section\\t\\\".text\\\"\\n\");\n" );
+# endif
 #elif defined(__sparc__)
     fprintf( outfile, "asm(\"\\t.section\\t\\\".init\\\" ,\\\"ax\\\"\\n\"\n" );
     fprintf( outfile, "    \"\\tcall " __ASM_NAME("__wine_dbg_%s_init") "\\n\"\n", prefix );
-------------- next part --------------




More information about the wine-patches mailing list