winebuild: Support the --main-module option for stand-alone 16-bit modules.
This commit is contained in:
parent
fda642d075
commit
a82ce66048
|
@ -89,6 +89,7 @@ typedef struct
|
|||
char *file_name; /* file name of the dll */
|
||||
char *dll_name; /* internal name of the dll */
|
||||
char *init_func; /* initialization routine */
|
||||
char *main_module; /* main Win32 module for Win16 specs */
|
||||
SPEC_TYPE type; /* type of dll (Win16/Win32) */
|
||||
int base; /* ordinal base */
|
||||
int limit; /* ordinal limit */
|
||||
|
|
|
@ -82,7 +82,6 @@ char *spec_file_name = NULL;
|
|||
FILE *output_file = NULL;
|
||||
const char *output_file_name = NULL;
|
||||
static const char *output_file_source_name;
|
||||
static char *main_module; /* FIXME: to be removed */
|
||||
|
||||
char *as_command = NULL;
|
||||
char *ld_command = NULL;
|
||||
|
@ -360,8 +359,7 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
|
|||
else force_pointer_size = 8;
|
||||
break;
|
||||
case 'M':
|
||||
spec->type = SPEC_WIN16;
|
||||
main_module = xstrdup( optarg );
|
||||
spec->main_module = xstrdup( optarg );
|
||||
break;
|
||||
case 'N':
|
||||
spec->dll_name = xstrdup( optarg );
|
||||
|
@ -586,24 +584,25 @@ int main(int argc, char **argv)
|
|||
if (spec->subsystem != IMAGE_SUBSYSTEM_NATIVE)
|
||||
spec->characteristics |= IMAGE_FILE_DLL;
|
||||
if (!spec_file_name) fatal_error( "missing .spec file\n" );
|
||||
if (spec->type == SPEC_WIN32 && spec->main_module) /* embedded 16-bit module */
|
||||
{
|
||||
spec->type = SPEC_WIN16;
|
||||
load_resources( argv, spec );
|
||||
if (parse_input_file( spec )) BuildSpec16File( spec );
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case MODE_EXE:
|
||||
load_resources( argv, spec );
|
||||
load_import_libs( argv );
|
||||
if (spec_file_name && !parse_input_file( spec )) break;
|
||||
read_undef_symbols( spec, argv );
|
||||
switch (spec->type)
|
||||
{
|
||||
case SPEC_WIN16:
|
||||
if (!main_module)
|
||||
{
|
||||
read_undef_symbols( spec, argv );
|
||||
output_spec16_file( spec );
|
||||
}
|
||||
else
|
||||
BuildSpec16File( spec );
|
||||
output_spec16_file( spec );
|
||||
break;
|
||||
case SPEC_WIN32:
|
||||
read_undef_symbols( spec, argv );
|
||||
BuildSpec32File( spec );
|
||||
break;
|
||||
default: assert(0);
|
||||
|
|
|
@ -743,6 +743,16 @@ void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 )
|
|||
odp->ordinal = 1;
|
||||
odp->link_name = xstrdup( ".L__wine_spec_dos_header" );
|
||||
|
||||
if (spec16->main_module)
|
||||
{
|
||||
odp = add_entry_point( spec32 );
|
||||
odp->type = TYPE_EXTERN;
|
||||
odp->name = xstrdup( "__wine_spec_main_module" );
|
||||
odp->lineno = 0;
|
||||
odp->ordinal = 2;
|
||||
odp->link_name = xstrdup( ".L__wine_spec_main_module" );
|
||||
}
|
||||
|
||||
assign_names( spec32 );
|
||||
assign_ordinals( spec32 );
|
||||
}
|
||||
|
|
|
@ -875,6 +875,12 @@ void output_spec16_file( DLLSPEC *spec16 )
|
|||
output_exports( spec32 );
|
||||
output_imports( spec16 );
|
||||
output_resources( spec16 );
|
||||
if (spec16->main_module)
|
||||
{
|
||||
output( "\n\t%s\n", get_asm_string_section() );
|
||||
output( ".L__wine_spec_main_module:\n" );
|
||||
output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec16->main_module );
|
||||
}
|
||||
output_gnu_stack_note();
|
||||
free_dll_spec( spec32 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue