From patchwork Thu Dec 14 19:52:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 178888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8807370dys; Thu, 14 Dec 2023 11:53:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9PkxAhiPxDFhbhojjyi0xzuUzDrNMXNU9RwIphJeij+3YaRdRKsc42ppysBMOhOlBGx4t X-Received: by 2002:a05:620a:210c:b0:77e:fba3:a79f with SMTP id l12-20020a05620a210c00b0077efba3a79fmr8072004qkl.125.1702583584448; Thu, 14 Dec 2023 11:53:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702583584; cv=pass; d=google.com; s=arc-20160816; b=o8/8vZhPpyDPYwWmtt6PMcBrhc6V1XPCWj+QiSCqwO5xZ/qJhoKGRMBSCPZYTULHoZ 9K9uNGD1ZjraiJ1lIGL4G905r7Dznr/vLhDnvnM6dq3wRSfB3Qw3yZhJLXESpQHge1tU YBx8Gna7CKs8YOj2Qq2mvhit2Sd5QXpVpYQSj9Op+Cu5YFXppiiC/v0rLShAPhgjZSrW +5OWNDSw6Ew1duk5NSGCgVnLLFFKHK+YXQNg2iCoIkEe8fOwTDGMOaqNH4rXlsshDdLy GDKXCjbfjtpnjWl/y0BAM3FtSQhwkXfuTl9jiP6UlVOoC/7sYMxlfzwvCEyEAl4qeEvY 5c2w== 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:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=UjJ7X28QIBlNkGyUtg6bM7qHkfohvvvIT7hX9aTz8AI=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=Z/4JAxS5ETiLBPk/GJRd+QcEnOOaNLipq8BFELFdBLHdLwE3skqSXhg2N0jtdjPzA5 yCvH1Y32xfCkpVcSr5M3Rsz9zUDYd4fR+zvRDO4hTrYrmdvzPAOCcOFZVWvgJOirqmmQ XP2vaU4yILU/llbdjmza7qyWB3oV96GXbIAyCg8yHAhW2d/s33LpJIYwsrnWUtG6kmTU KlM7MPuoBo3P3fvhUZCOd1ndkWZLGFU3JHXaZFwc7WDBukiaohQwIwtF4Shy9/oF4pfB 84+WJz7juGJM22E6nDDqDd+4hzp6zsfjdwCbdzKmKbuDWMUQRBsFyKURJuhBOOKFVoEc CYgg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=CbE3fGv1; 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 w8-20020a05620a424800b00767e30f501asi2034928qko.402.2023.12.14.11.53.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 11:53:04 -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=CbE3fGv1; 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 2F7DC385DC2B for ; Thu, 14 Dec 2023 19:53:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id D7A603858C2C for ; Thu, 14 Dec 2023 19:52:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7A603858C2C 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 D7A603858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702583561; cv=none; b=nZFURkdvkKamyYdPh1t0eYMPaafc1FWeHWh14RUK/Uch5+Cctao3AGhVJjVCs2dAD2oYug6srjug3nD/Lj3L0MCGZ4KG2BQhLbqfeZ7WIC7car3jCYn1FCY7nJVE7MJuDYQfah9DECw7yDJ0jJ/k+AYs+69euKcCYqkuaPIHWlU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702583561; c=relaxed/simple; bh=YldtUyy+fifWSaK92yfeGputOYyWzSIbOuOUcAdvKn4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=i+9vG0F4ra/Xkq1YScF7yTva1GnVhMmy4Ly/vCw2JFrklE3L96k277CrMv9G/UJrTQFK2ocW37WgcC4CpJHrnWxwTOCnJfZUueoXbjlhYwWVPmCtRwwsCIRgxEeCfclKgxvG2JrI7Ru9/YCRP0MD2iHnfyrVIgrJ0jzK5Qj3tZ8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6ceba6c4b8dso7352734b3a.1 for ; Thu, 14 Dec 2023 11:52:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702583559; x=1703188359; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:date:organization:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UjJ7X28QIBlNkGyUtg6bM7qHkfohvvvIT7hX9aTz8AI=; b=CbE3fGv1r6jNB8oAsncxuz+RVvZankhwr8xFxknk9emfd3kBaPwu3vaask5L+WUl9H rw/c4DwoW5D4GbesZaAllK/u/d6XVikKrXGa7qXWtBnHog0P6zRHW4c8TviYU63Mndk9 Qmx+zYcDKnqkOO08SnwYeRa7SO/3Jtk/7AsyKiBtvMyuTMydT6RXXKwVfGBR0xH3Uk7+ oLzAox86A2BkCXao96IxCbbQhEFWK2eCZ/ZA+5Ym+IkAWu+2/A9NTy1Y+ggpjHSC1hlZ BpSXUzmy38iW9MkMt60qnWNYWZwH51GCeKTc7YwzxoZ0DlhPg3mjdD2WmBuzcjXsXA41 8KRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702583559; x=1703188359; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UjJ7X28QIBlNkGyUtg6bM7qHkfohvvvIT7hX9aTz8AI=; b=eaB5MiNq4U/Lh5QVFRWp87Comm9rxgA8rfFvyv0m7EbuMH3KBhn5a9+9o/GxHl6y2a WZhz5dEf9XKI7nIv77y5C2zWCE59dx9J4NJi0i5K9ZveqDP4VKH5VlVYVqTtBmZlkPlu tn8f7pQgOX94xFcLoxuzrJOPqnVKZIspDLI2qe2chPmHcyPrS07q5/w0sYoovBi30CTb oh+SzLr9vYgT6VaGWjH7tyd0m2HQcLcKbyotlttF1SXoKmVlOvutO2sCY3XZMoWNminV KmEnyxzlzuj0Qv5DrIc8Lz3aYbadiO1JCIxeGBYFcFfDJIX+XWOGJq0nlBfbZysWjZb9 X40Q== X-Gm-Message-State: AOJu0YxdE3KEFrZ/k9RDv6XdkOBfH72Ug2qWeJK9aTXNGYdbjFz75Lgu mhd4MDhHbuC9tiCMnB11na2R+7IwY5X3av9v5zRM/w== X-Received: by 2002:a05:6a00:10c1:b0:6cb:a1fe:5217 with SMTP id d1-20020a056a0010c100b006cba1fe5217mr10953831pfu.16.1702583558800; Thu, 14 Dec 2023 11:52:38 -0800 (PST) Received: from free.home ([2804:7f1:2080:cecc:5977:530e:86b5:e7be]) by smtp.gmail.com with ESMTPSA id kq9-20020a056a004b0900b006cef5e5a968sm9886205pfb.201.2023.12.14.11.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 11:52:38 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 3BEJqTea488836 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 16:52:29 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: [PATCH] strub: avoid lto inlining Organization: Free thinker, does not speak for AdaCore Date: Thu, 14 Dec 2023 16:52:29 -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: 1785288284745316110 X-GMAIL-MSGID: 1785288284745316110 The strub builtins are not suited for cross-unit inlining, they should only be inlined by the builtin expanders, if at all. While testing on sparc64, it occurred to me that, if libgcc was built with LTO enabled, lto1 might inline them, and that would likely break things. So, make sure they're clearly marked as not inlinable. Regstrapped on x86_64-linux-gnu, also testing on sparc-solaris2.11.3. Ok to install? for libgcc/ChangeLog * strub.c (ATTRIBUTE_NOINLINE): New. (ATTRIBUTE_STRUB_CALLABLE): Add it. (__strub_dummy_force_no_leaf): Drop it. --- libgcc/strub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libgcc/strub.c b/libgcc/strub.c index b0f990d9deebb..5062554d0e1e6 100644 --- a/libgcc/strub.c +++ b/libgcc/strub.c @@ -36,7 +36,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # define TOPS < #endif -#define ATTRIBUTE_STRUB_CALLABLE __attribute__ ((__strub__ ("callable"))) +/* Make sure these builtins won't be inlined, even with LTO. */ +#define ATTRIBUTE_NOINLINE \ + __attribute__ ((__noinline__, __noclone__)) + +#define ATTRIBUTE_STRUB_CALLABLE \ + __attribute__ ((__strub__ ("callable"))) ATTRIBUTE_NOINLINE /* Enter a stack scrubbing context, initializing the watermark to the caller's stack address. */ @@ -72,7 +77,6 @@ __strub_update (void **watermark) /* Dummy function, called to force the caller to not be a leaf function, so that it can't use the red zone. */ static void ATTRIBUTE_STRUB_CALLABLE -__attribute__ ((__noinline__, __noipa__)) __strub_dummy_force_no_leaf (void) { }