Alexandre Julliard : winegcc: Add support for building native subsystem libraries.
Alexandre Julliard
julliard at winehq.org
Tue May 1 15:15:45 CDT 2018
Module: wine
Branch: master
Commit: 470bd0c2fa988721ba1cb17bb12e164cb6f9bee9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=470bd0c2fa988721ba1cb17bb12e164cb6f9bee9
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue May 1 12:57:54 2018 +0200
winegcc: Add support for building native subsystem libraries.
Based on a patch by Zebediah Figura.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winegcc/winegcc.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 4be35d5..5d604d2 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -210,6 +210,7 @@ struct options
const char* image_base;
const char* section_align;
const char* lib_suffix;
+ const char* subsystem;
strarray* prefix;
strarray* lib_dirs;
strarray* linker_args;
@@ -913,7 +914,19 @@ static void build(struct options* opts)
else
{
strarray_add(link_args, opts->gui_app ? "-mwindows" : "-mconsole");
- if (opts->nodefaultlibs) strarray_add(link_args, "-nodefaultlibs");
+ }
+
+ if (opts->nodefaultlibs) strarray_add(link_args, "-nodefaultlibs");
+ if (opts->nostartfiles) strarray_add(link_args, "-nostartfiles" );
+
+ if (opts->subsystem)
+ {
+ strarray_add(link_args, strmake("-Wl,--subsystem,%s", opts->subsystem));
+ if (!strcmp( opts->subsystem, "native" ))
+ {
+ const char *entry = opts->target_cpu == CPU_x86 ? "_DriverEntry at 8" : "DriverEntry";
+ strarray_add(link_args, strmake( "-Wl,--entry,%s", entry ));
+ }
}
for ( j = 0 ; j < opts->linker_args->size ; j++ )
@@ -1070,6 +1083,12 @@ static void build(struct options* opts)
if (opts->large_address_aware) strarray_add( spec_args, "--large-address-aware" );
}
+ if (opts->subsystem)
+ {
+ strarray_add(spec_args, "--subsystem");
+ strarray_add(spec_args, opts->subsystem);
+ }
+
for ( j = 0; j < lib_dirs->size; j++ )
strarray_add(spec_args, strmake("-L%s", lib_dirs->base[j]));
@@ -1211,19 +1230,11 @@ static void forward(int argc, char **argv, struct options* opts)
strarray_free (args);
}
-/*
- * Linker Options
- * object-file-name -llibrary -nostartfiles -nodefaultlibs
- * -nostdlib -s -static -static-libgcc -shared -shared-libgcc
- * -symbolic -Wl,option -Xlinker option -u symbol
- * -framework name
- */
static int is_linker_arg(const char* arg)
{
static const char* link_switches[] =
{
- "-nostartfiles", "-nostdlib", "-s",
- "-static", "-static-libgcc", "-shared", "-shared-libgcc", "-symbolic",
+ "-nostdlib", "-s", "-static", "-static-libgcc", "-shared", "-shared-libgcc", "-symbolic",
"-framework", "--coverage", "-fprofile-generate", "-fprofile-use"
};
unsigned int j;
@@ -1600,6 +1611,11 @@ int main(int argc, char **argv)
opts.large_address_aware = 1;
continue;
}
+ if (!strcmp(Wl->base[j], "--subsystem") && j < Wl->size - 1)
+ {
+ opts.subsystem = strdup( Wl->base[++j] );
+ continue;
+ }
if (!strcmp(Wl->base[j], "-static")) linking = -1;
strarray_add(opts.linker_args, strmake("-Wl,%s",Wl->base[j]));
}
More information about the wine-cvs
mailing list