_end Symbol and Mac OS X

Pierre d'Herbemont stegefin at free.fr
Wed Nov 19 14:13:22 CST 2003


Hi!

Here is a patch which allows Mac OS X to build dlls' and programs' 
spec.c files. I don't know how you expect it to be, for example 
regarding #ifdef to be inside or outside (in winebuild) the spec.c 
file, or if you would like an other way of doing it (using libwine_port 
or something). So I have done the simplest way -  I think it is -, tell 
me if you'd like core modifications.

On Mac OS X There is no _end symbol. There is a convenience function 
get_end() to replace it, mainly because of the Mach-O file format. So 
we have to get the value of get_end at launch time and store it in the 
nt_header.

Thanks,

Pierre

ChangeLog:
Add Mach-O support for the "_end" symbol using Mac OS X's get_end() 
function
-------------- next part --------------
Index: winebuild/spec32.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.72
diff -u -r1.72 spec32.c
--- winebuild/spec32.c	3 Nov 2003 22:19:44 -0000	1.72
+++ winebuild/spec32.c	19 Nov 2003 20:11:37 -0000
@@ -529,7 +529,10 @@
     fprintf( outfile, "}\n" );
     fprintf( outfile, "#endif\n" );
 
+#ifndef __APPLE__
     fprintf( outfile, "extern char _end[];\n" );
+#endif
+    
     fprintf( outfile, "extern int __wine_spec_data_start[], __wine_spec_exports[];\n\n" );
 
 #ifdef __i386__
@@ -796,7 +799,11 @@
     fprintf( outfile, "    0, 0,\n" );                   /* Major/MinorImageVersion */
     fprintf( outfile, "    4, 0,\n" );                   /* Major/MinorSubsystemVersion */
     fprintf( outfile, "    0,\n" );                      /* Win32VersionValue */
+#ifdef __APPLE__
+    fprintf( outfile, "    0,\n" );
+#else
     fprintf( outfile, "    _end,\n" );                   /* SizeOfImage */
+#endif
     fprintf( outfile, "    %ld,\n", page_size );         /* SizeOfHeaders */
     fprintf( outfile, "    0,\n" );                      /* CheckSum */
     fprintf( outfile, "    0x%04x,\n", subsystem );      /* Subsystem */
@@ -826,6 +833,10 @@
              "{\n"
              "    extern void __wine_dll_register( const struct image_nt_headers *, const char * );\n"
              "    extern void *__wine_dbg_register( char * const *, int );\n"
+#ifdef __APPLE__
+             "    extern void *get_end();\n"
+             "    nt_header.OptionalHeader.SizeOfImage = get_end();\n"
+#endif
              "    __wine_dll_register( &nt_header, \"%s\" );\n"
              "}\n",
              constructor, dll_file_name );
-------------- next part --------------



More information about the wine-patches mailing list