From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id B45E33858282 for ; Tue, 19 Dec 2023 23:53:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B45E33858282 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 B45E33858282 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703030007; cv=none; b=lT9tbSSanaZ7V2eJ8YTXky0Iyn171F/7qRi7oNh0+19xrLJfXmpsErhd8OKzV+DZCsXXW9CwLs7IERL+r21AWmllE4WvRltwxz7bU+e5sfmDV4e/GmHHAODYD3Fw6oOWvgvOkXOh3O7yNeMC/PZImxMO2ta6ciyBb3SfQNvna9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703030007; c=relaxed/simple; bh=CZ46st3J5xV2Unav3uK9kaK5PAsnOAv7rjRUiUX10NA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dKWhA2wQIuOSvbWYpkgJKyIdzXDVVi49wyG4YPe+idkp150GP6R/eTffIlYeyxtO+RUCtgm8y6VOzV6xNmP0EAp+rzF9Kkfj6o2oeC0gy+kXII9p7nu/7otgkCl5bZ+3uuN5loYOkAvK/3m8WLgOCrYe9HwsP6VLM906OH1eLzQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1d3aa0321b5so27615965ad.2 for ; Tue, 19 Dec 2023 15:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1703030005; x=1703634805; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=j24twkpMgQ4lvrEwWi1LTyTAc5jEqnq4uV48pek2YcE=; b=laSM0LYQlxScCN5l+Cuk3mOIGRYwVF0L0gJCtlE0so54rS5x3YqpI/x68YPnZ+/KeJ 3OgcIyldMctLwF7ZvoIS6NQ4nMoRjp6cCaudZDeNU7vaDvWxjKNIhB+feKfaXTveworG LAGe4Cnyu9S+6apYLmwFxXIVhnbhapH5NYfENe6ATMKU9xHtdCJgXlKgX1FXViW58Z8i 8LKUoBTAzUZ1Nb+1w79QaWuPYl7XJOVqPt198SM+IKLdwrfj60hWt/oFjMwxDzyCsuZq 7ZjUqdYXMZphBtZBfozCHKyyajnU0MqFEFkNFA6UCTA7bbi/S7sy7L8GFwbtht62nQGg HZrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703030005; x=1703634805; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j24twkpMgQ4lvrEwWi1LTyTAc5jEqnq4uV48pek2YcE=; b=MfsgT38T7un/T6aiSRyewsTG7RAUKhOu4oOkD1Y8mTM1YCEBI+VMRG+pu+B9Zq/lja kE32vx/Zhlgi+hv13xnGpGW2L85PuA+kxhywyEufDp6P3PgzO347dvw90su93Sed9WEf WmTSlclVtBla2moy/bnn4d4lIwuq0oonqgZRFHtqift11xqhh7CYo+tdv43AXJ6806BG Kquu4+1cD4THvL81keirlpNYlyWv1e0M6Fh7mcU1XTA+LcvmyZC/N3evdqVe3zydD0XJ g8MB98cxUJtpS5mA8tRdIUTjk0oZdccndS8hZbY3BTuf5QqbGDFFN3MxPz7n4oIMncip NAYQ== X-Gm-Message-State: AOJu0Yy/OedfSzJeaUnb+FdMr1ZOXLFmRdCfpwmgeL+a1+fhG65twxrE wKjMQBLemsmxnHa7Fy3o22X5lg== X-Google-Smtp-Source: AGHT+IF3YqhPSPXszXWCZ+O+clvo8I0l2+aIDMAJaXzeP1fkNoSrF4a1mpSzOW1cHExUBh4GuxZPwQ== X-Received: by 2002:a17:902:dacf:b0:1d3:d72e:ce33 with SMTP id q15-20020a170902dacf00b001d3d72ece33mr3740970plx.107.1703030004735; Tue, 19 Dec 2023 15:53:24 -0800 (PST) Received: from free.home ([2804:7f1:2080:dd67:1c01:ac85:7bb4:256d]) by smtp.gmail.com with ESMTPSA id jv21-20020a170903059500b001d3e6471e12sm1174493plb.30.2023.12.19.15.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 15:53:24 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 3BJNrF80670078 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 19 Dec 2023 20:53:15 -0300 From: Alexandre Oliva To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] strub: avoid lto inlining Organization: Free thinker, does not speak for AdaCore References: Date: Tue, 19 Dec 2023 20:53:15 -0300 In-Reply-To: (Richard Biener's message of "Fri, 15 Dec 2023 08:00:23 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-11.9 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 List-Id: On Dec 15, 2023, Richard Biener wrote: > I think __noipa__ is more complete and will make the libgcc functions appear > as black boxes to callers. I was hesitant to use __noipa__ because I thought it might disable relevant optimizations even when not using LTO, but it is likely safer in the long run to use it, so I've added it, thanks. > OK your or this way. Here's what I'm checking in shortly. Regstrapped on x86_64-linux-gnu. strub: avoid lto inlining 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. 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..3b7cc26b3d8f0 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__, __noipa__)) + +#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) { } -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive