PATCH: attribute used for dllname

Marcus Meissner marcus at jet.franken.de
Mon Jul 28 00:57:01 CDT 2003


Hi,

When used with -funit-at-a-time optimization, "static const char foo[];" 
is optimized away without reference in the file.

Since without stub functions the only reference is within an asm() statement
the compiler thinks it is used and throws it away.

Ciao, Marcus

Changelog:
	Used __attribute__((used)) on dllname, or newer gcc optimizations
	throw dllname away.

Index: tools/winebuild/spec32.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.65
diff -u -r1.65 spec32.c
--- tools/winebuild/spec32.c	3 Apr 2003 18:05:17 -0000	1.65
+++ tools/winebuild/spec32.c	28 Jul 2003 05:54:57 -0000
@@ -496,7 +496,11 @@
     fprintf( outfile, "}\n" );
     fprintf( outfile, "#endif\n" );
 
+    fprintf( outfile, "#ifdef __GNUC__\n" );
+    fprintf( outfile, "static const char __attribute__((used)) dllname[] = \"%s\";\n\n", dll_file_name );
+    fprintf( outfile, "#else\n" );
     fprintf( outfile, "static const char dllname[] = \"%s\";\n\n", dll_file_name );
+    fprintf( outfile, "#endif\n" );
     fprintf( outfile, "extern int __wine_spec_exports[];\n\n" );
 
 #ifdef __i386__



More information about the wine-patches mailing list