Detection of asm prefix and .size instruction
Pierre d'Herbemont
stegefin at free.fr
Thu Jun 17 12:45:01 CDT 2004
Hi!
This patch contains too changes. The first part creates a macro, if the
assembler adds a prefix to function name, in order to support the
different nm -u output. The second part check for the .size
instruction, and disables all related code if the .size instruction is
not present. I didn't test the .size test on a host which provides
support for .size.
Pierre
ChangeLog:
- Detection of .size instruction
- Detection of the assembler name prefix
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.281
diff -u -r1.281 configure.ac
--- configure.ac 16 Jun 2004 20:06:27 -0000 1.281
+++ configure.ac 17 Jun 2004 17:25:18 -0000
@@ -802,6 +802,7 @@
AH_TEMPLATE(__ASM_NAME,[Define to a macro to generate an assembly name from a C symbol])
if test "$ac_cv_c_extern_prefix" = "yes"
then
+ AC_DEFINE(__ASM_NAME_HAS_PREFIX, 1, [Define if assembly names have an underscore prefix])
AC_DEFINE([__ASM_NAME(name)], ["_" name])
else
AC_DEFINE([__ASM_NAME(name)], [name])
@@ -827,6 +828,17 @@
AC_DEFINE_UNQUOTED(__ASM_SHORT, ["$ac_cv_c_asm_short"],
[Define to the assembler keyword used to specify a word value])
+
+dnl **** Check for .size in assembler ****
+
+AC_CACHE_CHECK([for .size in assembler], ac_cv_c_asm_size,
+ WINE_TRY_ASM_LINK([".globl _ac_test\n.size _ac_test, . - _ac_test"],,,
+ ac_cv_c_asm_size="yes",ac_cv_c_asm_size="no"))
+
+if test "$ac_cv_c_asm_size" = "yes"
+then
+ AC_DEFINE(__ASM_HAS_SIZE, 1, [Define if the assembler keyword .size is accepted])
+fi
dnl **** Check for working dll ****
Index: tools/winebuild/import.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/import.c,v
retrieving revision 1.64
diff -u -r1.64 import.c
--- tools/winebuild/import.c 18 May 2004 21:27:44 -0000 1.64
+++ tools/winebuild/import.c 17 Jun 2004 17:25:22 -0000
@@ -558,6 +558,9 @@
p = buffer;
while (*p == ' ') p++;
if (p[0] == 'U' && p[1] == ' ' && p[2]) p += 2;
+#ifdef __ASM_NAME_HAS_PREFIX
+ if (p[0]=='_' && p[1]) p+=1;
+#endif
add_undef_symbol( p );
}
if ((err = pclose( f ))) warning( "nm -u %s error %d\n", name, err );
@@ -740,11 +743,15 @@
#error You need to define import thunks for your architecture!
#endif
fprintf( outfile, "\"\n" );
+#ifdef __ASM_HAS_SIZE
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name);
- }
+#endif
+ }
pos += 4;
}
+#ifdef __ASM_HAS_SIZE
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", import_thunks, import_thunks);
+#endif
fprintf( outfile, " \".text\");\n#ifndef __GNUC__\n}\n#endif\n\n" );
done:
@@ -936,7 +943,9 @@
#else
#error You need to defined delayed import thunks for your architecture!
#endif
+#ifdef __ASM_HAS_SIZE
fprintf( outfile, " \"\\t.size " __ASM_NAME("__wine_delay_load_asm") ", . - " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n");
+#endif
for (i = idx = 0; i < nb_imports; i++)
{
@@ -965,11 +974,15 @@
#else
#error You need to defined delayed import thunks for your architecture!
#endif
+#ifdef __ASM_HAS_SIZE
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name);
+#endif
}
idx++;
}
+#ifdef __ASM_HAS_SIZE
fprintf( outfile, "\n \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", delayed_import_loaders, delayed_import_loaders);
+#endif
fprintf( outfile, "\n \".data\\n\\t.align %d\\n\"\n", get_alignment(8) );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", delayed_import_thunks);
@@ -1032,10 +1045,14 @@
#error You need to define delayed import thunks for your architecture!
#endif
fprintf( outfile, "\n" );
+#ifdef __ASM_HAS_SIZE
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name);
+#endif
}
}
+#ifdef __ASM_HAS_SIZE
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", delayed_import_thunks, delayed_import_thunks);
+#endif
fprintf( outfile, "\".text\");\n" );
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
-------------- next part --------------
More information about the wine-patches
mailing list