Commit 39f6ab55 authored by Alexandre Julliard's avatar Alexandre Julliard

winebuild: Add support for generating data-only DLLs.

parent 3eca3516
......@@ -283,6 +283,7 @@ extern void output_resources( DLLSPEC *spec );
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 load_res16_file( const char *name, DLLSPEC *spec );
extern void output_res16_data( DLLSPEC *spec );
......@@ -329,6 +330,7 @@ extern int use_msvcrt;
extern int unix_lib;
extern int safe_seh;
extern int prefer_native;
extern int data_only;
extern char *input_file_name;
extern char *spec_file_name;
......
......@@ -46,6 +46,7 @@ int use_msvcrt = 0;
int unix_lib = 0;
int safe_seh = 0;
int prefer_native = 0;
int data_only = 0;
struct target target = { 0 };
......@@ -198,6 +199,7 @@ static const char usage_str[] =
" -b, --target=TARGET Specify target CPU and platform for cross-compiling\n"
" -B PREFIX Look for build tools in the PREFIX directory\n"
" --cc-cmd=CC C compiler to use for assembling (default: fall back to --as-cmd)\n"
" --data-only Generate a data-only dll (i.e. without any executable code)\n"
" -d, --delay-lib=LIB Import the specified library in delayed mode\n"
" -D SYM Ignored for C flags compatibility\n"
" -e, --entry=FUNC Set the DLL entry point function (default: DllMain)\n"
......@@ -251,6 +253,7 @@ enum long_options_values
LONG_OPT_BUILTIN,
LONG_OPT_ASCMD,
LONG_OPT_CCCMD,
LONG_OPT_DATA_ONLY,
LONG_OPT_EXTERNAL_SYMS,
LONG_OPT_FAKE_MODULE,
LONG_OPT_FIXUP_CTORS,
......@@ -284,6 +287,7 @@ static const struct long_option long_options[] =
/* other long options */
{ "as-cmd", 1, LONG_OPT_ASCMD },
{ "cc-cmd", 1, LONG_OPT_CCCMD },
{ "data-only", 0, LONG_OPT_DATA_ONLY },
{ "external-symbols", 0, LONG_OPT_EXTERNAL_SYMS },
{ "fake-module", 0, LONG_OPT_FAKE_MODULE },
{ "large-address-aware", 0, LONG_OPT_LARGE_ADDRESS_AWARE },
......@@ -483,6 +487,9 @@ static void option_callback( int optc, char *optarg )
case LONG_OPT_CCCMD:
cc_command = strarray_fromstring( optarg, " " );
break;
case LONG_OPT_DATA_ONLY:
data_only = 1;
break;
case LONG_OPT_FAKE_MODULE:
fake_module = 1;
break;
......@@ -637,6 +644,11 @@ int main(int argc, char **argv)
output_fake_module( spec );
break;
}
if (data_only)
{
output_data_module( spec );
break;
}
if (!is_pe())
{
files = load_import_libs( files );
......
......@@ -628,6 +628,12 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec )
return 1;
}
if (data_only && !(odp->flags & FLAG_FORWARD))
{
error( "Only forwarded entry points are allowed in data-only mode\n" );
goto error;
}
if (ordinal != -1)
{
if (!ordinal)
......
......@@ -644,7 +644,7 @@ DLLSPEC *alloc_dll_spec(void)
spec->type = SPEC_WIN32;
spec->base = MAX_ORDINALS;
spec->characteristics = IMAGE_FILE_EXECUTABLE_IMAGE;
spec->subsystem = 0;
spec->subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
spec->subsystem_major = 4;
spec->subsystem_minor = 0;
spec->syscall_table = 0;
......
......@@ -89,6 +89,11 @@ like \fBas\fR, \fBnm\fR and \fBld\fR.
Specify the C compiler to use to compile assembly files; the default
is to instead use the assembler specified with \fB--as-cmd\fR.
.TP
.B \--data-only
Build a module that contains only data and resources, and no
executable code. With this option, \fBwinebuild\fR directly outputs a
PE file, instead of an assembly or object file.
.TP
.BI \-d,\ --delay-lib= name
Set the delayed import mode for the specified library, which must be
one of the libraries imported with the \fB-l\fR option. Delayed mode
......
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