From patchwork Tue Aug 9 12:00:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:20da:b0:2d3:3019:e567 with SMTP id n26csp2466404pxc; Tue, 9 Aug 2022 05:02:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6fqnJEKQ615b/pVgOCm2wk5pAglXNi3Mn9ZfsWgDS4gA06igWp9qdbPntJOde7s9eqEOh6 X-Received: by 2002:a17:907:2719:b0:730:a5e7:9da7 with SMTP id w25-20020a170907271900b00730a5e79da7mr17716952ejk.26.1660046530067; Tue, 09 Aug 2022 05:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660046530; cv=none; d=google.com; s=arc-20160816; b=gMMxvk/GNpvGnZIGhkEteNcuv5rX0YGH4eSzHaTIqsx7hjRvViCaJBeuNFM85GrtqW r1CdObQbuDLg5cttRkp2ss8PcSqD7HLRZ6OyfmDMRO1UAhDzeRidrNqRU9uUeJcwymKb XLVytuUk59qDvp0sV/BMBsxaAUuj/K36o1vBBL7wAiFMp1+nXUKK9/zHebI+X3+HWcGL OQYdLplSZItRIgcirXr0FXeZFTN69CoC9/tSvVdoI5t2fvYx+ThxcHg1uuXsJ3Yj+3cw 6gfZLaRmUbvl3LnGK5lwzFv/MUWmm8oqbajWvsaPzVXb/w3AB0hAPhBRPWOwgmiejxac ukGQ== 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:content-transfer-encoding :in-reply-to:content-language:references:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature:dkim-signature :dmarc-filter:delivered-to; bh=lytcVulcSuWjTH56SdhfrMSHGjfwvP+tvGKJl/RnQD4=; b=ozP2v3MxCDsu3wtp1GwSpg8bi+Nj7gXh/wZnLdBmWPlCy3UAC5rQ3LNLj8f0YZ1pDB +T5xtUf6z43OxkipM1SwQJTj5oIaEAUIuZ4edzLjF6qvmBjF1hup92Ecjxge3bY4n6FA WxPRQR/8OHvptfCNeyx54KdQHIjQSDBTQshEG/IWJ2yOgCx5ZkoHM8nY0Z0hsG+kQrp+ LiK3VzuW+vBYWLLwqkDElLWDMzojQlMUYiQKmdDXtNmbIad5OA2Mq5DErytKl8xFZJTz 4s/vIwfEjzS1tKd1Sz2iyTse4VSHNb+NLWN7R+GIZEWXLZvv5++kskYZJCnhsukqyc62 74Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=aX93UQB7; dkim=neutral (no key) header.i=@gcc.gnu.org header.s=susede2_ed25519 header.b=aeSfiDIM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id gt18-20020a1709072d9200b0073096092e31si2273499ejc.537.2022.08.09.05.02.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 05:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=aX93UQB7; dkim=neutral (no key) header.i=@gcc.gnu.org header.s=susede2_ed25519 header.b=aeSfiDIM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 D012E3856958 for ; Tue, 9 Aug 2022 12:01:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id CA9F03856092 for ; Tue, 9 Aug 2022 12:00:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA9F03856092 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D59F720134 for ; Tue, 9 Aug 2022 12:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1660046437; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lytcVulcSuWjTH56SdhfrMSHGjfwvP+tvGKJl/RnQD4=; b=aX93UQB7ZnOAdnSNoviFTudkDe+e3svfZERyMPT/k13qLWjqdl2bf+YGotXCmFMUH5KmZz W7iyXonj0W92UjVlKfC+NN7sI8kh1EJtBXvbTfIgNqEu6+/h/O/k0q861i+BGEPN8c7Nqo pAreZhUGdNYFO/8OkujNdJyZF/8/Ppw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1660046437; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lytcVulcSuWjTH56SdhfrMSHGjfwvP+tvGKJl/RnQD4=; b=aeSfiDIM77L1me0bZlEDy1TxOXYWfhsdQ3RGqBXVM0yOEI89AXB6nyueS28dF8fpMw276t Hpw1OExTdbHt2hDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C810213A9D for ; Tue, 9 Aug 2022 12:00:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id z0nKL2VM8mLhAwAAMHmgww (envelope-from ) for ; Tue, 09 Aug 2022 12:00:37 +0000 Message-ID: <62cc745a-052a-fbde-7a8e-bccacf249bb8@suse.cz> Date: Tue, 9 Aug 2022 14:00:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH 2/3] lto: support --jobserver-style=fifo for recent GNU make To: gcc-patches@gcc.gnu.org References: <95d2ec7222d50c8ca1e6535cb8c272d47abbb08d.1660046383.git.mliska@suse.cz> Content-Language: en-US In-Reply-To: <95d2ec7222d50c8ca1e6535cb8c272d47abbb08d.1660046383.git.mliska@suse.cz> X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_SOFTFAIL, 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?1740684950573676945?= X-GMAIL-MSGID: =?utf-8?q?1740684950573676945?= Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: * jobserver.h (jobserver_info::jobserver_info): Parse FIFO format of --jobserver-auth. --- gcc/jobserver.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gcc/jobserver.h b/gcc/jobserver.h index 85453dd3c79..856e326ddfc 100644 --- a/gcc/jobserver.h +++ b/gcc/jobserver.h @@ -39,14 +39,22 @@ struct jobserver_info int rfd = -1; /* File descriptor for writing used for jobserver communication. */ int wfd = -1; + /* Named pipe path. */ + string pipe_path = ""; /* Return true if jobserver is active. */ bool is_active = false; }; jobserver_info::jobserver_info () { + /* Traditionally, GNU make uses opened pipes for jobserver-auth, + e.g. --jobserver-auth=3,4. + Starting with GNU make 4.4, one can use --jobserver-style=fifo + and then named pipe is used: --jobserver-auth=fifo:/tmp/hcsparta. */ + /* Detect jobserver and drop it if it's not working. */ string js_needle = "--jobserver-auth="; + string fifo_prefix = "fifo:"; const char *envval = getenv ("MAKEFLAGS"); if (envval != NULL) @@ -55,8 +63,15 @@ jobserver_info::jobserver_info () size_t n = makeflags.rfind (js_needle); if (n != string::npos) { - if (sscanf (makeflags.c_str () + n + js_needle.size (), - "%d,%d", &rfd, &wfd) == 2 + string ending = makeflags.substr (n + js_needle.size ()); + if (ending.find (fifo_prefix) == 0) + { + ending = ending.substr (fifo_prefix.size ()); + pipe_path = ending.substr (0, ending.find (' ')); + is_active = true; + } + else if (sscanf (makeflags.c_str () + n + js_needle.size (), + "%d,%d", &rfd, &wfd) == 2 && rfd > 0 && wfd > 0 && is_valid_fd (rfd)