Commit 4243befc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winebuild: Add -marm64x option for generating hybrid ARM64X import libraries.

parent 6ad60648
......@@ -162,6 +162,7 @@ typedef struct
int unicode_app; /* default to unicode entry point */
ORDDEF *entry_points; /* spec entry points */
struct exports exports; /* dll exports */
struct exports native_exports; /* dll native exports */
struct resource *resources; /* array of dll resources (format differs between Win16/Win32) */
struct apiset apiset; /* list of defined api sets */
} DLLSPEC;
......@@ -327,7 +328,7 @@ extern void output_bin_resources( DLLSPEC *spec, unsigned int start_rva );
extern void output_spec32_file( DLLSPEC *spec );
extern void output_fake_module( DLLSPEC *spec );
extern void output_data_module( DLLSPEC *spec );
extern void output_def_file( DLLSPEC *spec, int import_only );
extern void output_def_file( DLLSPEC *spec, struct exports *exports, int import_only );
extern void output_apiset_lib( DLLSPEC *spec, const struct apiset *apiset );
extern void load_res16_file( const char *name, DLLSPEC *spec );
extern void output_res16_data( DLLSPEC *spec );
......@@ -372,6 +373,7 @@ extern int force_pointer_size;
extern int unwind_tables;
extern int use_dlltool;
extern int use_msvcrt;
extern int native_arch;
extern int safe_seh;
extern int prefer_native;
extern int data_only;
......
......@@ -1377,19 +1377,31 @@ void output_static_lib( const char *output_name, struct strarray files, int crea
/* create a Windows-style import library using dlltool */
static void build_dlltool_import_lib( const char *lib_name, DLLSPEC *spec, struct strarray files )
{
const char *def_file, *native_def_file = NULL;
struct strarray args;
char *def_file;
def_file = open_temp_output_file( ".def" );
output_def_file( spec, 1 );
output_def_file( spec, &spec->exports, 1 );
fclose( output_file );
if (native_arch != -1)
{
native_def_file = open_temp_output_file( ".def" );
output_def_file( spec, &spec->native_exports, 1 );
fclose( output_file );
}
args = find_tool( "dlltool", NULL );
strarray_add( &args, "-k" );
strarray_add( &args, strendswith( lib_name, ".delay.a" ) ? "-y" : "-l" );
strarray_add( &args, lib_name );
strarray_add( &args, "-d" );
strarray_add( &args, def_file );
if (native_def_file)
{
strarray_add( &args, "-N" );
strarray_add( &args, native_def_file );
}
switch (target.cpu)
{
......
......@@ -36,6 +36,7 @@
int UsePIC = 0;
int nb_errors = 0;
int display_warnings = 0;
int native_arch = -1;
int kill_at = 0;
int verbose = 0;
int link_ext_symbols = 0;
......@@ -386,6 +387,7 @@ static void option_callback( int optc, char *optarg )
else if (!strcmp( optarg, "64" )) force_pointer_size = 8;
else if (!strcmp( optarg, "no-cygwin" )) use_msvcrt = 1;
else if (!strcmp( optarg, "unicode" )) main_spec->unicode_app = 1;
else if (!strcmp( optarg, "arm64x" )) native_arch = CPU_ARM64;
else if (!strncmp( optarg, "cpu=", 4 )) cpu_option = xstrdup( optarg + 4 );
else if (!strncmp( optarg, "fpu=", 4 )) fpu_option = xstrdup( optarg + 4 );
else if (!strncmp( optarg, "arch=", 5 )) arch_option = xstrdup( optarg + 5 );
......@@ -648,7 +650,7 @@ int main(int argc, char **argv)
if (!spec_file_name) fatal_error( "missing .spec file\n" );
if (!parse_input_file( spec )) break;
open_output_file();
output_def_file( spec, 0 );
output_def_file( spec, &spec->exports, 0 );
close_output_file();
break;
case MODE_IMPLIB:
......
......@@ -943,16 +943,15 @@ static void assign_ordinals( struct exports *exports )
}
static void assign_exports( DLLSPEC *spec )
static void assign_exports( DLLSPEC *spec, unsigned int cpu, struct exports *exports )
{
struct exports *exports = &spec->exports;
unsigned int i;
exports->entry_points = xmalloc( spec->nb_entry_points * sizeof(*exports->entry_points) );
for (i = 0; i < spec->nb_entry_points; i++)
{
ORDDEF *entry = &spec->entry_points[i];
if ((entry->flags & FLAG_CPU_MASK) && !(entry->flags & FLAG_CPU(target.cpu)))
if ((entry->flags & FLAG_CPU_MASK) && !(entry->flags & FLAG_CPU(cpu)))
continue;
exports->entry_points[exports->nb_entry_points++] = entry;
}
......@@ -1018,7 +1017,7 @@ void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 )
odp->u.func.nb_args * sizeof(odp->u.func.args[0]) );
}
assign_exports( spec32 );
assign_exports( spec32, target.cpu, &spec32->exports );
}
......@@ -1061,7 +1060,8 @@ int parse_spec_file( FILE *file, DLLSPEC *spec )
}
current_line = 0; /* no longer parsing the input file */
assign_exports( spec );
assign_exports( spec, target.cpu, &spec->exports );
if (native_arch != -1) assign_exports( spec, native_arch, &spec->native_exports );
return !nb_errors;
}
......@@ -1303,6 +1303,6 @@ int parse_def_file( FILE *file, DLLSPEC *spec )
}
current_line = 0; /* no longer parsing the input file */
assign_exports( spec );
assign_exports( spec, target.cpu, &spec->exports );
return !nb_errors;
}
......@@ -1343,9 +1343,8 @@ void output_data_module( DLLSPEC *spec )
*
* Build a Win32 def file from a spec file.
*/
void output_def_file( DLLSPEC *spec, int import_only )
void output_def_file( DLLSPEC *spec, struct exports *exports, int import_only )
{
struct exports *exports;
DLLSPEC *spec32 = NULL;
const char *name;
int i, total;
......@@ -1355,8 +1354,8 @@ void output_def_file( DLLSPEC *spec, int import_only )
spec32 = alloc_dll_spec();
add_16bit_exports( spec32, spec );
spec = spec32;
}
exports = &spec->exports;
}
if (spec_file_name)
output( "; File generated automatically from %s; do not edit!\n\n",
......
......@@ -615,6 +615,7 @@ DLLSPEC *alloc_dll_spec(void)
spec->subsystem_minor = 0;
spec->dll_characteristics = IMAGE_DLLCHARACTERISTICS_NX_COMPAT | IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE;
spec->exports.base = MAX_ORDINALS;
spec->native_exports.base = MAX_ORDINALS;
return spec;
}
......@@ -644,6 +645,7 @@ void free_dll_spec( DLLSPEC *spec )
free( odp->link_name );
}
free_exports( &spec->exports );
free_exports( &spec->native_exports );
free( spec->file_name );
free( spec->dll_name );
free( spec->c_name );
......
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