winegcc: Add support for -Wl,-delayload argument.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jacek Caban 2019-11-11 19:56:49 +01:00 committed by Alexandre Julliard
parent 0e1720813c
commit 9180dec0b7
1 changed files with 19 additions and 0 deletions

View File

@ -226,6 +226,7 @@ struct options
strarray* compiler_args;
strarray* winebuild_args;
strarray* files;
strarray* delayimports;
};
#ifdef __i386__
@ -1164,6 +1165,12 @@ static void build(struct options* opts)
for ( j = 0 ; j < opts->winebuild_args->size ; j++ )
strarray_add(spec_args, opts->winebuild_args->base[j]);
if (!is_pe)
{
for (j = 0; j < opts->delayimports->size; j++)
strarray_add(spec_args, strmake("-d%s", opts->delayimports->base[j]));
}
/* add resource files */
for ( j = 0; j < files->size; j++ )
if (files->base[j][1] == 'r') strarray_add(spec_args, files->base[j]);
@ -1203,6 +1210,12 @@ static void build(struct options* opts)
strarray_add(link_args, spec_o_name);
if (is_pe)
{
for (j = 0; j < opts->delayimports->size; j++)
strarray_add(spec_args, strmake("-Wl,-delayload,%s", opts->delayimports->base[j]));
}
for ( j = 0; j < files->size; j++ )
{
const char* name = files->base[j] + 2;
@ -1423,6 +1436,7 @@ int main(int argc, char **argv)
opts.linker_args = strarray_alloc();
opts.compiler_args = strarray_alloc();
opts.winebuild_args = strarray_alloc();
opts.delayimports = strarray_alloc();
opts.pic = 1;
/* determine the processor type */
@ -1672,6 +1686,11 @@ int main(int argc, char **argv)
opts.subsystem = strdup( Wl->base[++j] );
continue;
}
if (!strcmp(Wl->base[j], "-delayload") && j < Wl->size - 1)
{
strarray_add( opts.delayimports, Wl->base[++j] );
continue;
}
if (!strcmp(Wl->base[j], "-static")) linking = -1;
strarray_add(opts.linker_args, strmake("-Wl,%s",Wl->base[j]));
}