From patchwork Thu Dec 14 20:17:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 178894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8822098dys; Thu, 14 Dec 2023 12:17:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1xw/bm4zJN7Yza+f4GpnrS3en18vuPiR7u05aQoPGoxFdEnlxJcntc6tWHrZNXnql1zhG X-Received: by 2002:a05:6102:c47:b0:464:8f00:c5cf with SMTP id y7-20020a0561020c4700b004648f00c5cfmr8318559vss.19.1702585068001; Thu, 14 Dec 2023 12:17:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702585067; cv=pass; d=google.com; s=arc-20160816; b=J+0qb5FQ0Y3aubzXDdDFS7HD386JRLHH7kn/XF3vm5GKAhSAbrA6CzrKBs8rj8IiLt puexI9u4CfZY8UF92T8vJ3HrJgA0GXwQwao01R/s9v0CqQL04EdGFm42THW6XZkdkWbw VuybMTZ7BF/ARoTNN4W8s0aSCTtM3mcw22HqFVEEaUQUdU5x4sbffs2TCFmqpPz8Taya pH72aB7hru9UHM4Tu9KrccXFBbPu+pUHxdeb9/OPvYbS1zv23MNVzNHfaaX6fVJQWFAh PO4pkPeqNgrB/2RKwIpRrhXpZSclRhIpDR1btAZiVirlwcSo6Xd2y8XHjJanMxlXAMUO 8o8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:date:organization:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=+g39pkg0+b4qOyQXTKAmoorCcmrjZJANQfiuNm8iJLI=; fh=bNk5JXvdI7C6mAB7KZhcMA/BpQtA2n2NRbo91aS1Hts=; b=iecu6gTTUz2X1NAun/bxjSp2LugIFvhpCg40/7J80L9cyu4zdHue6QegqY0p3QjeC4 fUUzwmcQnLPYWQN5k2n53Jo5N6nwOaJ8N4Z5cmwyZ+mJWa99RnA5eayOvaMjTz+GLXIJ tacgyAZCjGItSioOxvVXACwaL3Zabgzg90FZnuOp0ys7VZ4Co9NCPQeLvO/j3XAs5JRj qZB1HWw8Rhfmv5M1HG6v4ZE0p+v9pV203tFMF8P04tNZxvRhWlX1E+dBgyJo6o6oAT2V WKiC8BDgY0fSVm945iu8uc9bF3nXv1ZjJjySiXBVKdDB8VFG8i7qNgOV8taJdQubXyOt FPUg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=cEeYNVMK; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u9-20020a67f509000000b0046487a3a429si3079305vsn.162.2023.12.14.12.17.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 12:17:47 -0800 (PST) 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=@adacore.com header.s=google header.b=cEeYNVMK; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACCB93861896 for ; Thu, 14 Dec 2023 20:17:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 0ADE53858D20 for ; Thu, 14 Dec 2023 20:17:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0ADE53858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0ADE53858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702585045; cv=none; b=ULXW6Sx1XaPSN0QQJKyCvwi5V+76EyeriwKOL45umEKJlpE/L8QdX8yeyPLK7QN/7IHbzbdM3PtcGDMovK/R80RqiUNc0vyWpQbwvvobix7/1PubZfDK1LaQfsNVhHFUZ+pyafM0g74fs8zIKvSFvxe/QpMHYYNB72OAdjwiPno= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702585045; c=relaxed/simple; bh=HsTrpCdEoSqi+UXRTdU0nDiOIv5iZpAJkhmhJ6lfDhc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AJ8TinNsf6X8qXhy8IxDjFELEVOn0Kcf8gWjK0Ep0MdSmVU9ptPTQpZwyeG2Ss+J+lufsC6KlAfTBz1znlp0edZ9m98jB9eTy5MtCCyEFwDnZP0U9OiAiutrNDCnU6n04yY3m5E1M+0BMsp0BuKypdZUronijKlRpbrAZG4SX+k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6cec976b197so5147842b3a.0 for ; Thu, 14 Dec 2023 12:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702585043; x=1703189843; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=+g39pkg0+b4qOyQXTKAmoorCcmrjZJANQfiuNm8iJLI=; b=cEeYNVMK37clH6tLBmjiFVq9DES0adzMk2EkFpCtZU1+/GHgOxAmugMd4EJ9Y8S7ev 3AHkMyv/jKI4eML+tothAQk6vVIYssYdC0yTuTDiWHOY88fDryIQc36fSRmpujq76VV4 anw6zaSFuJC0IFjf4OrtNrGFZE6n0IybawVPy/XVNcgjLroFPMYPGqXwxQhh6/iGxmQL KxzhbF4vroPHfEpfTYE+A5PgZod7wTWZPBBCKelfr62fOSx7+24JBRxk/ndlSbJpjZ5M 5FJhvPznYJt9I7riAMrUQN24I9iVS28QTsd/wY0ZGrxcGCF6QgGpl+f9OnqqTM7sdBuS hACw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702585043; x=1703189843; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+g39pkg0+b4qOyQXTKAmoorCcmrjZJANQfiuNm8iJLI=; b=kGjN9JC2uoHa+Qdh9+6dQv/18ptMrLaza9GsgtGkMmApMLGofZtmSlFzgIvsRBakNU /9iGsw6AR2sIEUZL3UvvMGwdbyFqQQzZFJRUEk+nTewxurSBxZKX4wO5zKuLPnIemW/F sVUFxwLA4EUQKd1/QCSBu8X2eoVu+5RG+BfzgfWFLVzQEthFqr7zwAXyA7rJT4S/+++j 9fcuL4i6QVHaNEpBIolE4i82cAvIn0TcPRFsUJ83E/Ye664a3YPezsi4xNsS45FDaNCF 4wQVv8wd73eItsFM86s4DN3lnfDZ8hV2jUmU0OJk6Ro8esJhX65XhkJ+ezpmwXi2R5P5 1V2g== X-Gm-Message-State: AOJu0YziNK19WQoPiOS7SXg1jAFR5lBcl/ban6tzG2Oq/+QMXc4ugOiP d0rYfec/e7UENIqBt2zEMEew6GEMy090u9aF8NWOTw== X-Received: by 2002:a05:6a00:1acc:b0:6ce:55b1:caf2 with SMTP id f12-20020a056a001acc00b006ce55b1caf2mr6934875pfv.3.1702585043049; Thu, 14 Dec 2023 12:17:23 -0800 (PST) Received: from free.home ([2804:7f1:2080:cecc:5977:530e:86b5:e7be]) by smtp.gmail.com with ESMTPSA id h17-20020aa786d1000000b006ce7ed5ba42sm12524051pfo.171.2023.12.14.12.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 12:17:22 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 3BEKHAk1489854 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 17:17:10 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Rainer Orth , Jakub Jelinek , "David S. Miller" , Eric Botcazou Subject: [PATCH #1/2] strub: sparc: omit frame in strub_leave [PR112917] Organization: Free thinker, does not speak for AdaCore Date: Thu, 14 Dec 2023 17:17:09 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_QUOTING 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785289840027653025 X-GMAIL-MSGID: 1785289840027653025 If we allow __strub_leave to allocate a frame on sparc, it will overlap with a lot of the stack range we're supposed to scrub, because of the large fixed-size outgoing args and register save area. Unfortunately, setting up the PIC register seems to prevent the frame pointer from being omitted. Since the strub runtime doesn't issue calls or use global variables, at least on sparc, disabling PIC to compile strub.c seems to do the right thing. Regstrapped on x86_64-linux-gnu, also testing on sparc-solaris2.11.3. (but it will likely take forever on the cfarm machine; if someone with faster sparc machines could give this a spin and confirm, that would be appreciated.) Ok to install? IIRC this patch gets 32-bit sparc to pass all strub tests, but sparc64 still fails many of them; there's another one for sparc64 that fixes them, and that will improve sparc -m32 as well. for libgcc/ChangeLog PR middle-end/112917 * config.host (sparc, sparc64): Enable... * config/sparc/t-sparc: ... this new fragment. --- libgcc/config.host | 2 ++ libgcc/config/sparc/t-sparc | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 libgcc/config/sparc/t-sparc diff --git a/libgcc/config.host b/libgcc/config.host index 694e3e9f54cad..54d06978a5d2c 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -199,9 +199,11 @@ riscv*-*-*) ;; sparc64*-*-*) cpu_type=sparc + tmake_file="${tmake_file} sparc/t-sparc" ;; sparc*-*-*) cpu_type=sparc + tmake_file="${tmake_file} sparc/t-sparc" ;; s390*-*-*) cpu_type=s390 diff --git a/libgcc/config/sparc/t-sparc b/libgcc/config/sparc/t-sparc new file mode 100644 index 0000000000000..fb1bf1fc29cc4 --- /dev/null +++ b/libgcc/config/sparc/t-sparc @@ -0,0 +1,4 @@ +# This is needed for __strub_leave to omit the frame pointer, without +# which it will allocate a register save area on the stack and leave +# it unscrubbed and most likely unused, because it's a leaf function. +CFLAGS-strub.c += -fno-PIC -fomit-frame-pointer