Commit 29060f3d authored by Alexandre Julliard's avatar Alexandre Julliard

winebuild: Add a helper function to output a thunk data pointer.

parent d406de18
......@@ -252,6 +252,8 @@ extern void output_cfi( const char *format, ... )
__attribute__ ((__format__ (__printf__, 1, 2)));
extern void output_rva( const char *format, ... )
__attribute__ ((__format__ (__printf__, 1, 2)));
extern void output_thunk_rva( int ordinal, const char *format, ... )
__attribute__ ((__format__ (__printf__, 2, 3)));
extern void spawn( struct strarray array );
extern struct strarray find_tool( const char *name, const char * const *names );
extern struct strarray find_link_tool(void);
......
......@@ -869,16 +869,8 @@ static void output_immediate_imports(void)
if (func->name) output( "__imp_%s:\n", asm_name( func->name ));
else if (func->export_name) output( "__imp_%s:\n", asm_name( func->export_name ));
}
if (func->name)
output( "\t%s .L__wine_spec_import_data_%s_%s-.L__wine_spec_rva_base\n",
get_asm_ptr_keyword(), import->c_name, func->name );
else
{
if (get_ptr_size() == 8)
output( "\t.quad 0x800000000000%04x\n", func->ordinal );
else
output( "\t.long 0x8000%04x\n", func->ordinal );
}
output_thunk_rva( func->name ? -1 : func->ordinal,
".L__wine_spec_import_data_%s_%s", import->c_name, func->name );
}
output( "\t%s 0\n", get_asm_ptr_keyword() );
}
......@@ -1861,31 +1853,14 @@ static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struc
}
output( "\n\t.section \".idata$4\"\n" );
if (by_name)
{
output_rva( ".L__wine_import_name" );
if (get_ptr_size() == 8) output( "\t.long 0\n" );
}
else
{
if (get_ptr_size() == 4) output( "\t.long 0x8000%04x\n", odp->ordinal );
else output( "\t.quad 0x800000000000%04x\n", odp->ordinal );
}
output_thunk_rva( by_name ? -1 : odp->ordinal, ".L__wine_import_name" );
output( "\n\t.section \".idata$5\"\n" );
output( "%s\n", asm_globl( imp_name ) );
if (is_delay)
output( "\t%s .L__wine_delay_import\n", get_asm_ptr_keyword() );
else if (by_name)
{
output_rva( ".L__wine_import_name" );
if (get_ptr_size() == 8) output( "\t.long 0\n" );
}
else
{
if (get_ptr_size() == 4) output( "\t.long 0x8000%04x\n", odp->ordinal );
else output( "\t.quad 0x800000000000%04x\n", odp->ordinal );
}
output_thunk_rva( by_name ? -1 : odp->ordinal, ".L__wine_import_name" );
if (by_name)
{
......
......@@ -984,6 +984,38 @@ void output_rva( const char *format, ... )
va_end( valist );
}
/* output an RVA pointer or ordinal for a function thunk */
void output_thunk_rva( int ordinal, const char *format, ... )
{
if (ordinal == -1)
{
va_list valist;
va_start( valist, format );
switch (target.platform)
{
case PLATFORM_MINGW:
case PLATFORM_WINDOWS:
output( "\t.rva " );
vfprintf( output_file, format, valist );
fputc( '\n', output_file );
if (get_ptr_size() == 8) output( "\t.long 0\n" );
break;
default:
output( "\t%s ", get_asm_ptr_keyword() );
vfprintf( output_file, format, valist );
output( " - .L__wine_spec_rva_base\n" );
break;
}
va_end( valist );
}
else
{
if (get_ptr_size() == 4) output( "\t.long 0x8000%04x\n", ordinal );
else output( "\t.quad 0x800000000000%04x\n", ordinal );
}
}
/* output the GNU note for non-exec stack */
void output_gnu_stack_note(void)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment