From patchwork Wed Aug 1 13:25:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw \(lists\)" X-Patchwork-Id: 143287 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp872147ljj; Wed, 1 Aug 2018 06:25:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeH8/fxk45XtR0KzokchkZabhtQ64MUczg5tqt2uuUwSuGSbq2R8ol4hFmB/Dr4PATS3Ugy X-Received: by 2002:a62:234d:: with SMTP id j74-v6mr3035216pfj.106.1533129952448; Wed, 01 Aug 2018 06:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533129952; cv=none; d=google.com; s=arc-20160816; b=BwltJMi3y3SiRzOfRUzsOqmrPI8YR9bHo62vtH9ZdSysAjP6Yvusz6LE/v9to5uU68 bQ49iOsWMujn1AFE33R0NuiqYSBmEJBhs6XYvPhOsdjqyqS6e+iwg9sY1/jDRm+Rgjrn QfxcW+7fdUWYxZ3AZeg8E8sm3i7iD2/hNM4fRRV6eBTDEkxhMBcOOs4XMDzBjAe4T2oN lwOABCY2tk+AxuJj86UtR1xCw9DkV9Hw8B9MqpTNBAv9/btOYjoI75bD7TQkx56SrOcS 9MBy/OFd6FcgZp6ahgJxVT4TER6SHw9X9sI74EGoih9PDGW794xnU4iTt+IvKHx6OoL/ 4/YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:date:message-id:openpgp:subject:from:to :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=+sR4gVlu7O8GJMlJFbYAYl4qVWlCmf7NxCDc0uJk9Gs=; b=FD/w9bSp0WV5rpfYiKmISZgoJAR2yB5tVRwqipDMgjx8BcPgRrrwIrYQHQ9zHDlN6N +Pm8RZhiAgWFvs+BaA+p5LtBWvHK171R9kuG3XqhQhxOFbgg4GJ+uQQk4FQB0DeFOb0/ TUB8oTk2OZombbhMQrINCLHmrjIEFjmxf65IFw2b7z8B/lJGy6PmMLVYXR0y0GV2Nzri phZ2ChoGIoSIM+/PeVkmveG1OlU4fOFWaHJu7fbgeoE3Zn10yBsvTHFdhCe5yhjl3EKd NUsGJE7rZu/Q4q4pvmf/xj6tcBxR8roe0GTL72x1nlGVnLu8ChDJQB9bkx8CNgyveTr9 Hb5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="gpEDcM/8"; spf=pass (google.com: domain of binutils-return-102821-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-102821-patch=linaro.org@sourceware.org" Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id p5-v6si14939661pgl.516.2018.08.01.06.25.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 06:25:52 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-102821-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="gpEDcM/8"; spf=pass (google.com: domain of binutils-return-102821-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-102821-patch=linaro.org@sourceware.org" DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=fMTo/KW730T/VGiud9Fnwnq8lI0ey 1d/cgNFdWT+ChGJSU+EVQL5ZmuYVxuIy96xkz2ZUZUKosFOYFbdfg8HdlTWsvxDW J3GZjW20awauopvcHMGOlL17J4ZTtlFoTreYDPh1G8th/8fSUSnk8zkMRMEVaV5v Z7Uv+M3Ew9aXVc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=kIotxlgIsMPpcPQN5mkJeyvmwyg=; b=gpE DcM/8k8frQmNkpYp+7VhDGdkB7IWab5I8ZVUH07HGZls5+Ur+/d6u3c9g1qF8JRA r4giJXO6atIAeCr38+BZS2anFKsXyQJDHZ1h/DFPtHksKFRwACRHKEZvh6wk/2nO lGCR/lxDOANmwCPkZZWbOOUSVBaemPREEnw3dTzQ= Received: (qmail 52803 invoked by alias); 1 Aug 2018 13:25:39 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 52755 invoked by uid 89); 1 Aug 2018 13:25:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Aug 2018 13:25:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E9A5E7A9; Wed, 1 Aug 2018 06:25:31 -0700 (PDT) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.207.74]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4CF3F3F5B3; Wed, 1 Aug 2018 06:25:31 -0700 (PDT) To: gdb-patches@sourceware.org, binutils@sourceware.org From: "Richard Earnshaw (lists)" Subject: Propagate from gcc: Add linker_output as prefix for LTO temps Openpgp: preference=signencrypt Message-ID: <7502e318-8569-1792-da0f-0e6ca50bbf57@arm.com> Date: Wed, 1 Aug 2018 14:25:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 I've ported the attached patch over from GCC's libiberty. Committed as obvious. R. >From d6d40cc1a5de4d58e1aa35fbb3dbf44b8e28c988 Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 26 Jul 2018 12:13:14 +0000 Subject: [PATCH] Add linker_output as prefix for LTO temps (PR lto/86548). MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.7.4" This is a multi-part message in MIME format. --------------2.7.4 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit 2018-07-26 Martin Liska PR lto/86548 * libiberty.h (make_temp_file_with_prefix): New function. 2018-07-26 Martin Liska PR lto/86548 * make-temp-file.c (TEMP_FILE): Remove leading 'cc'. (make_temp_file): Call make_temp_file_with_prefix with first argument set to NULL. (make_temp_file_with_prefix): Support also prefix. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262999 138bc75d-0d04-0410-961f-82ee72b054a4 --- include/ChangeLog | 5 +++++ include/libiberty.h | 5 +++++ libiberty/ChangeLog | 8 ++++++++ libiberty/make-temp-file.c | 24 ++++++++++++++++++------ 6 files changed, 55 insertions(+), 7 deletions(-) --------------2.7.4 Content-Type: text/x-patch; name="0001-Add-linker_output-as-prefix-for-LTO-temps-PR-lto-865.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-Add-linker_output-as-prefix-for-LTO-temps-PR-lto-865.patch" diff --git a/include/libiberty.h b/include/libiberty.h index dc09e79..0823614 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -239,6 +239,11 @@ extern char *choose_temp_base (void) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; extern char *make_temp_file (const char *) ATTRIBUTE_MALLOC; +/* Return a temporary file name with given PREFIX and SUFFIX + or NULL if unable to create one. */ + +extern char *make_temp_file_with_prefix (const char *, const char *) ATTRIBUTE_MALLOC; + /* Remove a link to a file unless it is special. */ extern int unlink_if_ordinary (const char *); diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c index 89faed7..21b0545 100644 --- a/libiberty/make-temp-file.c +++ b/libiberty/make-temp-file.c @@ -56,7 +56,7 @@ extern int mkstemps (char *, int); /* Name of temporary file. mktemp requires 6 trailing X's. */ -#define TEMP_FILE "ccXXXXXX" +#define TEMP_FILE "XXXXXX" #define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1) #if !defined(_WIN32) || defined(__CYGWIN__) @@ -181,25 +181,31 @@ string is @code{malloc}ed, and the temporary file has been created. */ char * -make_temp_file (const char *suffix) +make_temp_file_with_prefix (const char *prefix, const char *suffix) { const char *base = choose_tmpdir (); char *temp_filename; - int base_len, suffix_len; + int base_len, suffix_len, prefix_len; int fd; + if (prefix == 0) + prefix = "cc"; + if (suffix == 0) suffix = ""; base_len = strlen (base); + prefix_len = strlen (prefix); suffix_len = strlen (suffix); temp_filename = XNEWVEC (char, base_len + TEMP_FILE_LEN - + suffix_len + 1); + + suffix_len + + prefix_len + 1); strcpy (temp_filename, base); - strcpy (temp_filename + base_len, TEMP_FILE); - strcpy (temp_filename + base_len + TEMP_FILE_LEN, suffix); + strcpy (temp_filename + base_len, prefix); + strcpy (temp_filename + base_len + prefix_len, TEMP_FILE); + strcpy (temp_filename + base_len + prefix_len + TEMP_FILE_LEN, suffix); fd = mkstemps (temp_filename, suffix_len); /* Mkstemps failed. It may be EPERM, ENOSPC etc. */ @@ -214,3 +220,9 @@ make_temp_file (const char *suffix) abort (); return temp_filename; } + +char * +make_temp_file (const char *suffix) +{ + return make_temp_file_with_prefix (NULL, suffix); +} --------------2.7.4--