From patchwork Tue Oct 13 11:30:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1381505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C9YJp0RPCz9sTs for ; Tue, 13 Oct 2020 22:31:05 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E62BB3850429; Tue, 13 Oct 2020 11:31:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id AF0823858001 for ; Tue, 13 Oct 2020 11:30:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AF0823858001 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: 1/KrJ99ZmuKTacY6fbI3xc3DmH/qzD2wk3bLT4zHfyvG+Iu8Cr9IADkSGhfGX8CaNx8v3ue83o bpwqp9RCyRMYVfQNs7rjK9jBn5ZJPEuQZ1X5UtGYsvPbGQ6GfuJuTKCVWOTufuh6yIAPEOiJwu QwL66rR3+inu5yy17XLXFXhT+vENBA5s+c7QOJrj35mENRq6IlkiO9hm87oVjtjm2pwAYw0U5w QXpf8qeIAO6ZgEpGklpTp3fSjoDKpxlxqxYY1k+RtPgIyPNnBg1nDKbS2S+7IW/f0CBISyE9OQ KDo= X-IronPort-AV: E=Sophos;i="5.77,370,1596528000"; d="diff'?scan'208";a="53856702" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 13 Oct 2020 03:30:58 -0800 IronPort-SDR: af/lwAcFuU2YHrTJCN8VwIRzg8avuJ8AxTX68GoyyAihFLvcBGjhFHruErw+XrgxWMBaE7fRNR QKat+F3syOeXhBvCwlJzB9UpoNfXNlLk7fIxo9T9RR5gO0WhtMkpC3TZ3Z+vIwLI99C7dZC/xD 8/MEMMCQfdxIIQv4iVxfMVgbNFGFm6A7SeBPq6L6y+PFF8ir92DdGPKhQucG+btfwaJk+96QSi oNoIYtPqZFQQzT3XTznTmF8EMVfKSKj0O897d5ag8qz9BryfOxXyX/tBxsHXjuN6TvV6TaXstq rCw= To: gcc-patches , Richard Biener From: Tobias Burnus Subject: [Patch] lto-wrapper: Use nontemp filename with -save-temps Message-ID: Date: Tue, 13 Oct 2020 13:30:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" There are still some @cc... files under /tmp, but at lease another file is now at the proper place. This patch generates (for a.out and -save-temps) the file a.crtoffloadtable.o. (I have not fully digested the LTO calls, but I think this file is only created once and not by concurrent lto-wrapper runs.) OK? Tobias PS: After this patch, there are still some @... files, e.g. ccKqLnBY.ofldlist (generated by lto-plugin/lto-plugin.c) and those generated by collect-utils.c's fork_execute, invoked by config/nvptx/mkoffload.c, config/gcn/mkoffload.c, and lto-wrapper.c (with use_atfile = true). ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter lto-wrapper: Use nontemp filename with -save-temps gcc/ChangeLog: * lto-wrapper.c (find_crtoffloadtable): With -save-temps, use non-temp file name utilizing the dump prefix. (run_gcc): Update call. diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 82cfa6bd67e..4d3cd7a56f2 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -1026,7 +1026,7 @@ copy_file (const char *dest, const char *src) the copy to the linker. */ static void -find_crtoffloadtable (void) +find_crtoffloadtable (int save_temps, const char *dumppfx) { char **paths = NULL; const char *library_path = getenv ("LIBRARY_PATH"); @@ -1039,7 +1039,11 @@ find_crtoffloadtable (void) if (access_check (paths[i], R_OK) == 0) { /* The linker will delete the filename we give it, so make a copy. */ - char *crtoffloadtable = make_temp_file (".crtoffloadtable.o"); + char *crtoffloadtable; + if (!save_temps) + crtoffloadtable = make_temp_file (".crtoffloadtable.o"); + else + crtoffloadtable = concat (dumppfx, "crtoffloadtable.o"); copy_file (crtoffloadtable, paths[i]); printf ("%s\n", crtoffloadtable); XDELETEVEC (crtoffloadtable); @@ -1698,7 +1702,7 @@ cont1: if (offload_names) { - find_crtoffloadtable (); + find_crtoffloadtable (save_temps, dumppfx); for (i = 0; offload_names[i]; i++) printf ("%s\n", offload_names[i]); free_array_of_ptrs ((void **) offload_names, i);