lto-plugin: Honor link_output_name for -foffload-objects file name
Commit Message
This patch removes the last(?) -save-temps file that is still written to /tmp.
Thus, instead of
.../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=/tmp/ccyXiCap.ofldlist
.../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=/tmp/ccyXiCap.ofldlist
[Leaving LTRANS /tmp/ccyXiCap.ofldlist]
the result is now
.../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=a.ofldlist
.../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=a.ofldlist
[Leaving LTRANS a.ofldlist]
OK for mainline? (Stage1?)
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
Comments
On Fri, Mar 11, 2022 at 12:44 PM Tobias Burnus <tobias@codesourcery.com> wrote:
>
> This patch removes the last(?) -save-temps file that is still written to /tmp.
>
> Thus, instead of
>
> .../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=/tmp/ccyXiCap.ofldlist
> .../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=/tmp/ccyXiCap.ofldlist
> [Leaving LTRANS /tmp/ccyXiCap.ofldlist]
>
> the result is now
>
> .../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=a.ofldlist
> .../12.0.1/lto-wrapper -fresolution=a.res -flinker-output=exec -foffload-objects=a.ofldlist
> [Leaving LTRANS a.ofldlist]
>
>
> OK for mainline? (Stage1?)
Ok for trunk.
>
> Tobias
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
lto-plugin: Honor link_output_name for -foffload-objects file name
lto-plugin/ChangeLog:
* lto-plugin.c (all_symbols_read_handler): With -save-temps, use
link_output_name for -foffload-objects's file name, if available.
lto-plugin/lto-plugin.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
@@ -799,8 +799,15 @@ all_symbols_read_handler (void)
char *arg;
char *offload_objects_file_name;
struct plugin_offload_file *ofld;
+ const char *suffix = ".ofldlist";
- offload_objects_file_name = make_temp_file (".ofldlist");
+ if (save_temps && link_output_name)
+ {
+ suffix += skip_in_suffix;
+ offload_objects_file_name = concat (link_output_name, suffix, NULL);
+ }
+ else
+ offload_objects_file_name = make_temp_file (suffix);
check (offload_objects_file_name, LDPL_FATAL,
"Failed to generate a temporary file name");
f = fopen (offload_objects_file_name, "w");