Merge branch 'tools-lto' into 'master'

tools: Fix support for Link-Time Optimization (LTO).

See merge request wine/wine!4908
This commit is contained in:
Gabriel Ivăncescu 2024-11-18 23:03:10 +00:00
commit 26fb0570cd
3 changed files with 12 additions and 3 deletions

View file

@ -1352,7 +1352,8 @@ void output_static_lib( const char *output_name, struct strarray files, int crea
if (!create || target.platform != PLATFORM_WINDOWS)
{
args = find_tool( "ar", NULL );
static const char * const commands[] = { "gcc-ar", "ar", NULL };
args = find_tool( "ar", commands );
strarray_add( &args, create ? "rc" : "r" );
strarray_add( &args, output_name );
}
@ -1370,7 +1371,8 @@ void output_static_lib( const char *output_name, struct strarray files, int crea
if (target.platform != PLATFORM_WINDOWS)
{
struct strarray ranlib = find_tool( "ranlib", NULL );
static const char * const commands[] = { "gcc-ranlib", "ranlib", NULL };
struct strarray ranlib = find_tool( "ranlib", commands );
strarray_add( &ranlib, output_name );
spawn( ranlib );
}

View file

@ -380,7 +380,7 @@ const char *get_nm_command(void)
{
if (!nm_command.count)
{
static const char * const commands[] = { "nm", "gnm", NULL };
static const char * const commands[] = { "gcc-nm", "nm", "gnm", NULL };
nm_command = find_tool( "nm", commands );
}
if (nm_command.count > 1)

View file

@ -1647,6 +1647,13 @@ int main(int argc, char **argv)
opts.pic = 1;
else if (!strcmp("-fno-PIC", opts.args.str[i]) || !strcmp("-fno-pic", opts.args.str[i]))
opts.pic = 0;
/* LTO options are available for both the compiler and the linker */
else if ((!strncmp("-flto", opts.args.str[i], 5) && (!opts.args.str[i][5] || opts.args.str[i][5] == '=')) || !strcmp("-fno-lto", opts.args.str[i]))
raw_linker_arg = 1;
else if (!strncmp("-flto-partition=", opts.args.str[i], 16))
raw_linker_arg = 1;
else if (!strcmp("-fuse-linker-plugin", opts.args.str[i]) || !strcmp("-fno-use-linker-plugin", opts.args.str[i]))
raw_linker_arg = 1;
break;
case 'i':
if (!strcmp( "-isysroot", opts.args.str[i] )) opts.isysroot = opts.args.str[i + 1];