From patchwork Fri Aug 19 14:01:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:38f:b0:2d5:3c95:9e21 with SMTP id 15csp943973pxh; Fri, 19 Aug 2022 07:01:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR4HrnXSCfQgm64ZhyqSeDwh89En5AwaWuJUnSGG6cjfcQHsAKVxhC1wXluU2cydajxSZT2w X-Received: by 2002:a17:907:7dac:b0:739:8df9:3c16 with SMTP id oz44-20020a1709077dac00b007398df93c16mr5010678ejc.9.1660917716253; Fri, 19 Aug 2022 07:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660917716; cv=none; d=google.com; s=arc-20160816; b=tYzXeJy12/DHS7/ZGxgTdsZ3F9F7qQAZJmeTjqCoaxBhHxpv9IM7rVa0hqlbnh8uvj OFO9TndaKarEbaitxmiZgZITBojaGde8dXWPCkazH9S0wtWVxPz7Wui/n9P7gCP1BAhr jB2llXkYXyhxsBR6GzZcnRDy/vzDu+5qnvy+YFG714h0vDqgVmzJ7IK4AVTwKORgiyjr L48Gle61ToiNnKmCM0BQK51TufWTBqq7gf/f3+/IPGdYEWdbZwKdyQEVvZYmSEMMzzO2 e5FCHoDaEWirr5eePKl4zXHMrQVElnfylU/XWRX34C58A8z/D/DJfMAqK/7+vT4ktkXh JrjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:dmarc-filter:delivered-to; bh=ZWmLREcOmT8AVOxFAqkbSusMUYaX67ikCHiX2i3zGak=; b=zfjUx+Z6vdPsSuNPi2mON1glfNh5XLhIz8VtYWBn8kvpQPzPqyCS4Q60HFmfShXqvm /Yo38eRZIYRZ736M/2Qhv9rHh5B6UnqnNealnis68uJQ3SXDuuio9jdmz5kSlOHeG4kx 8rALr2NjeeIPFVWDtGpSVmGtT0IhOtbsgQJ+vryRkP/FPQ3gabGyOPUvzD3arxoEW9xr FMrTRAMal1Hptvh1nnyUVaA97M687KiYxy1nwrHb9k5QB+c9b+pQJ4L5/uyz9h07R2wf 82OuqqX+GeemAktmmqIT65Lf2B0ZEEUntN4iWWEqxcPQrv+HgZ7BxeAP1ycpPM7CkO+o RXlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id qk6-20020a1709077f8600b00730d3423ed6si3208998ejc.974.2022.08.19.07.01.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 07:01:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5339E385801A for ; Fri, 19 Aug 2022 14:01:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 1F5D53858C83 for ; Fri, 19 Aug 2022 14:01:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F5D53858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,248,1654588800"; d="diff'?scan'208";a="84339017" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 19 Aug 2022 06:01:15 -0800 IronPort-SDR: fUz6qy9wECK4shHytDksXOaAjDGY/FoLpKHQYuinqfn3Hh+s1KEwFvQtbRnxQEQiMxunQhXulB WY0wQEXudug0c9hcablQJOK5XUT9yGyU0ETd7iqRD4MtiVFzc/eo8/LJR4aT5j/T5CIVKtyp1B KwN3/dk0HUeRgxebnJSSZ/XHWsCXlaWn0I1TCdLvIJuUeXy5HIpMAy60KrvMbCVkumnkOq1pkQ rf8e3BRKW9iTOv7aVSOEtDi6iaIDVzahrx+CWP65A8hmNv2SpfVfHqIoabkmJFIqYCMowZ88om j7E= Message-ID: <8623b1a3-ef98-1ebb-1abc-194b646288a7@codesourcery.com> Date: Fri, 19 Aug 2022 16:01:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Content-Language: en-US To: Jakub Jelinek , gcc-patches , Andrew Stubbs From: Tobias Burnus Subject: [Patch] mkoffload: Cleanup temporary omp_requires_file X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741598455191658976?= X-GMAIL-MSGID: =?utf-8?q?1741598455191658976?= Rather obvious, once found. I forgot to add some cleanup, cluttering /tmp with ".mkoffload.omp_requires". The same issue exists for GCN also for ".mkoffload.dbg" OK for mainline? – For the dbg issue, OK also for GCC 11 and 12 backport? Follow-up to the 'OpenMP: Move omp requires checks to libgomp" commit https://gcc.gnu.org/r13-1458-g683f11843974f0bdf42f79cdcbb0c2b43c7b81b0 For GCN, the issues exists since https://gcc.gnu.org/r11-6683-g505caa7295b93ecdec8ac9b31595eb34dbd48c9f Tobias PS: In case you wonder why it is also added with -save-temps: The internally called maybe_unlink removed the file, unless -save-temps. For the latter, with verbose flag, it also shows them as '[Leaving %s]'. PPS: If you see some ...target.o files in /tmp, that's because of https://gcc.gnu.org/PR106686 ----------------- 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 mkoffload: Cleanup temporary omp_requires_file The file (suffix ".mkoffload.omp_requires") used to save the 'omp requires' data has to be passed to maybe_unlink for cleanup or -v -save-temps stderr diagnostic. That was missed before. - For GCN, the same has to be done for the files with suffix ".mkoffload.dbg.o". gcc/ChangeLog: * config/gcn/mkoffload.cc (main): Add omp_requires_file and dbgobj to files_to_cleanup. * config/i386/intelmic-mkoffload.cc (prepare_target_image): Add omp_requires_file to temp_files. * config/nvptx/mkoffload.cc (omp_requires_file): New global static var. (main): Remove local omp_requires_file var. (tool_cleanup): Handle omp_requires_file. diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index d2464332275..4206448703a 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -1030,6 +1030,7 @@ main (int argc, char **argv) } else dbgobj = make_temp_file (".mkoffload.dbg.o"); + obstack_ptr_grow (&files_to_cleanup, dbgobj); /* If the copy fails then just ignore it. */ if (copy_early_debug_info (argv[ix], dbgobj)) @@ -1085,6 +1086,7 @@ main (int argc, char **argv) omp_requires_file = concat (dumppfx, ".mkoffload.omp_requires", NULL); else omp_requires_file = make_temp_file (".mkoffload.omp_requires"); + obstack_ptr_grow (&files_to_cleanup, omp_requires_file); /* Run the compiler pass. */ xputenv (concat ("GCC_OFFLOAD_OMP_REQUIRES_FILE=", omp_requires_file, NULL)); diff --git a/gcc/config/i386/intelmic-mkoffload.cc b/gcc/config/i386/intelmic-mkoffload.cc index 596f6f107b8..5deddff6ca2 100644 --- a/gcc/config/i386/intelmic-mkoffload.cc +++ b/gcc/config/i386/intelmic-mkoffload.cc @@ -526,6 +526,7 @@ prepare_target_image (const char *target_compiler, int argc, char **argv, uint32 omp_requires_file = concat (dumppfx, ".mkoffload.omp_requires", NULL); else omp_requires_file = make_temp_file (".mkoffload.omp_requires"); + temp_files[num_temps++] = omp_requires_file; xputenv (concat ("GCC_OFFLOAD_OMP_REQUIRES_FILE=", omp_requires_file, NULL)); compile_for_target (&argv_obstack); diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc index 0fa5f4423bf..7557681ad07 100644 --- a/gcc/config/nvptx/mkoffload.cc +++ b/gcc/config/nvptx/mkoffload.cc @@ -55,6 +55,7 @@ static id_map *var_ids, **vars_tail = &var_ids; /* Files to unlink. */ static const char *ptx_name; static const char *ptx_cfile_name; +static const char *omp_requires_file; static const char *ptx_dumpbase; enum offload_abi offload_abi = OFFLOAD_ABI_UNSET; @@ -68,6 +69,8 @@ tool_cleanup (bool from_signal ATTRIBUTE_UNUSED) maybe_unlink (ptx_cfile_name); if (ptx_name) maybe_unlink (ptx_name); + if (omp_requires_file) + maybe_unlink (omp_requires_file); } static void @@ -571,7 +689,6 @@ main (int argc, char **argv) unsetenv ("COMPILER_PATH"); unsetenv ("LIBRARY_PATH"); - char *omp_requires_file; if (save_temps) omp_requires_file = concat (dumppfx, ".mkoffload.omp_requires", NULL); else