- Detection of .size instruction.

- Detection of the assembler name prefix.
This commit is contained in:
Pierre d'Herbemont 2004-06-18 19:36:26 +00:00 committed by Alexandre Julliard
parent c196f63a72
commit 68467db6c6
4 changed files with 96 additions and 7 deletions

65
configure vendored
View File

@ -13357,6 +13357,71 @@ _ACEOF
echo "$as_me:$LINENO: checking for .size in assembler" >&5
echo $ECHO_N "checking for .size in assembler... $ECHO_C" >&6
if test "${ac_cv_c_asm_size+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
void ac_asm(void) { asm(".globl _ac_test\n.size _ac_test, . - _ac_test"); }
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_asm_size="yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_asm_size="no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_asm_size" >&5
echo "${ECHO_T}$ac_cv_c_asm_size" >&6
if test "$ac_cv_c_asm_size" = "yes"
then
cat >>confdefs.h <<\_ACEOF
#define HAVE_ASM_DOT_SIZE 1
_ACEOF
fi
DLLEXT="" DLLEXT=""
DLLFLAGS="-D_REENTRANT" DLLFLAGS="-D_REENTRANT"

View File

@ -828,6 +828,17 @@ AC_CACHE_CHECK([for assembler keyword for word values], ac_cv_c_asm_short,
AC_DEFINE_UNQUOTED(__ASM_SHORT, ["$ac_cv_c_asm_short"], AC_DEFINE_UNQUOTED(__ASM_SHORT, ["$ac_cv_c_asm_short"],
[Define to the assembler keyword used to specify a word value]) [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(HAVE_ASM_DOT_SIZE, 1, [Define if the assembler keyword .size is accepted])
fi
dnl **** Check for working dll **** dnl **** Check for working dll ****
AC_SUBST(DLLEXT,"") AC_SUBST(DLLEXT,"")

View File

@ -35,6 +35,9 @@
/* Define if you have ARTS sound server */ /* Define if you have ARTS sound server */
#undef HAVE_ARTS #undef HAVE_ARTS
/* Define if the assembler keyword .size is accepted */
#undef HAVE_ASM_DOT_SIZE
/* Define to 1 if you have the <audio/audiolib.h> header file. */ /* Define to 1 if you have the <audio/audiolib.h> header file. */
#undef HAVE_AUDIO_AUDIOLIB_H #undef HAVE_AUDIO_AUDIOLIB_H

View File

@ -176,6 +176,13 @@ inline static void sort_symbols( char **table, int size )
qsort( table, size, sizeof(*table), name_cmp ); qsort( table, size, sizeof(*table), name_cmp );
} }
inline static void output_function_size( FILE *outfile, const char *name )
{
#ifdef HAVE_ASM_DOT_SIZE
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name);
#endif
}
/* free an import structure */ /* free an import structure */
static void free_imports( struct import *imp ) static void free_imports( struct import *imp )
{ {
@ -533,6 +540,8 @@ static const char *ldcombine_files( char **argv )
/* read in the list of undefined symbols */ /* read in the list of undefined symbols */
void read_undef_symbols( char **argv ) void read_undef_symbols( char **argv )
{ {
static const char name_prefix[] = __ASM_NAME("");
static const int prefix_len = sizeof(name_prefix) - 1;
FILE *f; FILE *f;
char buffer[1024]; char buffer[1024];
int err; int err;
@ -558,6 +567,7 @@ void read_undef_symbols( char **argv )
p = buffer; p = buffer;
while (*p == ' ') p++; while (*p == ' ') p++;
if (p[0] == 'U' && p[1] == ' ' && p[2]) p += 2; if (p[0] == 'U' && p[1] == ' ' && p[2]) p += 2;
if (prefix_len && !strncmp( p, name_prefix, prefix_len )) p += prefix_len;
add_undef_symbol( p ); add_undef_symbol( p );
} }
if ((err = pclose( f ))) warning( "nm -u %s error %d\n", name, err ); if ((err = pclose( f ))) warning( "nm -u %s error %d\n", name, err );
@ -740,11 +750,11 @@ static int output_immediate_imports( FILE *outfile )
#error You need to define import thunks for your architecture! #error You need to define import thunks for your architecture!
#endif #endif
fprintf( outfile, "\"\n" ); fprintf( outfile, "\"\n" );
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name); output_function_size( outfile, name );
} }
pos += 4; pos += 4;
} }
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", import_thunks, import_thunks); output_function_size( outfile, import_thunks );
fprintf( outfile, " \".text\");\n#ifndef __GNUC__\n}\n#endif\n\n" ); fprintf( outfile, " \".text\");\n#ifndef __GNUC__\n}\n#endif\n\n" );
done: done:
@ -936,7 +946,7 @@ static int output_delayed_imports( FILE *outfile, const DLLSPEC *spec )
#else #else
#error You need to defined delayed import thunks for your architecture! #error You need to defined delayed import thunks for your architecture!
#endif #endif
fprintf( outfile, " \"\\t.size " __ASM_NAME("__wine_delay_load_asm") ", . - " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n"); output_function_size( outfile, "__wine_delay_load_asm" );
for (i = idx = 0; i < nb_imports; i++) for (i = idx = 0; i < nb_imports; i++)
{ {
@ -965,11 +975,11 @@ static int output_delayed_imports( FILE *outfile, const DLLSPEC *spec )
#else #else
#error You need to defined delayed import thunks for your architecture! #error You need to defined delayed import thunks for your architecture!
#endif #endif
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name); output_function_size( outfile, name );
} }
idx++; idx++;
} }
fprintf( outfile, "\n \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", delayed_import_loaders, delayed_import_loaders); output_function_size( outfile, delayed_import_loaders );
fprintf( outfile, "\n \".data\\n\\t.align %d\\n\"\n", get_alignment(8) ); fprintf( outfile, "\n \".data\\n\\t.align %d\\n\"\n", get_alignment(8) );
fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", delayed_import_thunks); fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", delayed_import_thunks);
@ -1032,10 +1042,10 @@ static int output_delayed_imports( FILE *outfile, const DLLSPEC *spec )
#error You need to define delayed import thunks for your architecture! #error You need to define delayed import thunks for your architecture!
#endif #endif
fprintf( outfile, "\n" ); fprintf( outfile, "\n" );
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name); output_function_size( outfile, name );
} }
} }
fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", delayed_import_thunks, delayed_import_thunks); output_function_size( outfile, delayed_import_thunks );
fprintf( outfile, "\".text\");\n" ); fprintf( outfile, "\".text\");\n" );
fprintf( outfile, "#ifndef __GNUC__\n" ); fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" ); fprintf( outfile, "}\n" );