Signed-off-by: Zebediah Figura z.figura12@gmail.com --- tools/winegcc/winegcc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index f628ff2..ce059b3 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -211,6 +211,7 @@ struct options const char* section_align; const char* lib_suffix; const char* subsystem; + const char* entry; strarray* prefix; strarray* lib_dirs; strarray* linker_args; @@ -923,6 +924,14 @@ static void build(struct options* opts) for ( j = 0 ; j < opts->linker_args->size ; j++ ) strarray_add(link_args, opts->linker_args->base[j]);
+ if (opts->entry) + { + if (opts->target_cpu == CPU_x86) + strarray_add(link_args, strmake("-Wl,--entry,_%s,--enable-stdcall-fixup", opts->entry)); + else + strarray_add(link_args, strmake("-Wl,--entry,%s", opts->entry)); + } + strarray_add(link_args, "-o"); strarray_add(link_args, output_file);
@@ -1080,6 +1089,12 @@ static void build(struct options* opts) strarray_add(spec_args, opts->subsystem); }
+ if (opts->entry) + { + strarray_add(spec_args, "--entry"); + strarray_add(spec_args, opts->entry); + } + for ( j = 0; j < lib_dirs->size; j++ ) strarray_add(spec_args, strmake("-L%s", lib_dirs->base[j]));
@@ -1615,6 +1630,12 @@ int main(int argc, char **argv) opts.subsystem = strdup( Wl->base[++j] ); continue; } + if ((!strcmp(Wl->base[j], "--entry") || !strcmp(Wl->base[j], "-e")) + && j < Wl->size - 1) + { + opts.entry = strdup( Wl->base[++j] ); + continue; + } if (!strcmp(Wl->base[j], "-static")) linking = -1; strarray_add(opts.linker_args, strmake("-Wl,%s",Wl->base[j])); }