From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 60CDA3858D28 for ; Tue, 14 Nov 2023 16:00:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60CDA3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 60CDA3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699977645; cv=none; b=OMKlbHnZl0vdR9GzQ2tfZex1o+NczRNzsDV2MPvgs8efgnyAxd9+4nGeDpiyrD9j6N6qNt91C+PeAdcJgQRmLteZV4vh411l7jCpH8Vvai17i8Ufo2prtQnm7ybLSFxtdgbt56xGdCkXNOJTL+hB8deTmyminFNpt1dTuY2ETws= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699977645; c=relaxed/simple; bh=mXb4rrxyof8tbqoPeHvw6Mz0rScB0dJnADNvm2lt+og=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=cs+QZwQMUxVMyPVAqkbdVFYkCWSPagRpKFhRSkSC1hrVzF0WURzHVdQ3uFSGlf3Rk4r4TdN3uvzTTrKaMxhm2zq8nEc3OIGYDBhZQSeaPRxZ7OFi7VOuS42VSI5yC4UQQr2BBqGKs5yEwjT9s5PkHsqrRfHcQ5WdwLxmWsb1tWA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699977644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PrVxhwYCHfiI8c0xhLxayIKMvswHli6x7rjJUP5OBH4=; b=NvlT32sToX+RbXtsFVbifGfd2rYV4jse4F8RBjmk/yQR3xdKx5g265JMmIZfanWPlfp9zD hSJCQhSXqOVQKUgVq5E0/nrOuqMfVXJuPQC3IM/L2Kk1DvGBn4a7DiRx/Qo7iBma2KxOD1 87YYvYgUtRhJzadIkry9hFJxzPlWE0U= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-245-5FwXbib0Nrq_HOT9zlreZQ-1; Tue, 14 Nov 2023 11:00:42 -0500 X-MC-Unique: 5FwXbib0Nrq_HOT9zlreZQ-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-670237ba89aso99796016d6.0 for ; Tue, 14 Nov 2023 08:00:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699977642; x=1700582442; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PrVxhwYCHfiI8c0xhLxayIKMvswHli6x7rjJUP5OBH4=; b=krQMQrEHe6TqOpNy7KOloIALHGZzKE40rh9/mslGPdL+BbZQo9B6zrBZOWS0FCwMVf PZ//TtojWUtEjy49cqVpKOEATSD/r13QFP8S2/8AUhmrR8ZP89yAH1ec5Pa9zo2QedxM Kbd6OH2oO41njU4Atqj9vEa0XGVZ1eXQl8bXPj30iXU5leljxJ3E8x4GCNLj6vWaLvdE NhDjFJe/cPOIlr7yg7j5jAOlDoa4YkaXVQxfWKnlNDnh7hkaPmIRPxIYzDJqcAa299TY Jn7TCR0VZFz4xOp/mlZzSYTAI3NUIlkVfgxESZ7JWmyp9n3T/WoOwJhx2eqKyRWv4SjC Z+UA== X-Gm-Message-State: AOJu0Yyp2jBqSRE+Kp/TNrTIiSPgVXTxyID5S7+hBtwAU4APbtIYGTT5 J6akckZj6BM7pXWg7e6nk85IAAgaGkdaqGA2dW1Wzi7cYc0ZeZCV+bkbhaPabR8g7QPzr9puN4N QDgb/7A3r8SyI2v5FzE78aY7Pqg== X-Received: by 2002:a0c:f9c7:0:b0:66d:8e17:5645 with SMTP id j7-20020a0cf9c7000000b0066d8e175645mr3971268qvo.29.1699977641932; Tue, 14 Nov 2023 08:00:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8UVn91DDpi3tHhj6iZL0y6LdrDpWCqvYtIyQyHxOLO4mtsLMkXd+sT/XlvyspOX5yEkpueQ== X-Received: by 2002:a0c:f9c7:0:b0:66d:8e17:5645 with SMTP id j7-20020a0cf9c7000000b0066d8e175645mr3971235qvo.29.1699977641655; Tue, 14 Nov 2023 08:00:41 -0800 (PST) Received: from redhat.com (2603-7000-9500-34a5-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:34a5::1db4]) by smtp.gmail.com with ESMTPSA id ee11-20020a0562140a4b00b0066d0ab215b5sm3038150qvb.13.2023.11.14.08.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 08:00:41 -0800 (PST) Date: Tue, 14 Nov 2023 11:00:39 -0500 From: Marek Polacek To: Richard Biener Cc: iain@sandoe.co.uk, GCC Patches Subject: Re: [PATCH v4] gcc: Introduce -fhardened Message-ID: References: <8A3E5AA3-0785-4C2E-B75B-9388B703FFEA@gmail.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.9 (2022-11-12) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Tue, Nov 14, 2023 at 08:46:16AM +0100, Richard Biener wrote: > On Fri, Nov 3, 2023 at 11:51 PM Marek Polacek wrote: > > > > On Thu, Oct 26, 2023 at 05:55:56PM +0200, Richard Biener wrote: > > > > > > > > > > Am 24.10.2023 um 21:09 schrieb Marek Polacek : > > > > > > > > On Tue, Oct 24, 2023 at 09:22:25AM +0200, Richard Biener wrote: > > > >>> On Mon, Oct 23, 2023 at 9:26 PM Marek Polacek wrote: > > > >>> > > > >>> On Thu, Oct 19, 2023 at 02:24:11PM +0200, Richard Biener wrote: > > > >>>> Can you see how our > > > >>>> primary and secondary targets (+ host OS) behave here? > > > >>> > > > >>> That's very reasonable. I tried to build gcc on Compile Farm 119 (AIX) but > > > >>> that fails with: > > > >>> > > > >>> ar -X64 x ../ppc64/libgcc/libgcc_s.a shr.o > > > >>> ar: 0707-100 ../ppc64/libgcc/libgcc_s.a does not exist. > > > >>> make[2]: *** [/home/polacek/gcc/libgcc/config/rs6000/t-slibgcc-aix:98: all] Error 1 > > > >>> make[2]: Leaving directory '/home/polacek/x/trunk/powerpc-ibm-aix7.3.1.0/libgcc' > > > >>> > > > >>> and I tried Darwin (104) and that fails with > > > >>> > > > >>> *** Configuration aarch64-apple-darwin21.6.0 not supported > > > >>> > > > >>> Is anyone else able to build gcc on those machines, or test the attached > > > >>> patch? > > > >>> > > > >>>> I think the > > > >>>> documentation should elaborate a bit on expectations for non-Linux/GNU > > > >>>> targets, specifically I think the default configuration for a target should > > > >>>> with -fhardened _not_ have any -Whardened diagnostics. Maybe we can > > > >>>> have a testcase for this? > > > >>> > > > >>> Sorry, I'm not sure how to test that. I suppose if -fhardened enables > > > >>> something not supported on those systems, and it's something for which > > > >>> we have a configure test, then we shouldn't warn. This is already the > > > >>> case for -pie, -z relro, and -z now. > > > >> > > > >> I was thinking of > > > >> > > > >> /* { dg-do compile } */ > > > >> /* { dg-additional-options "-fhardened -Whardened" } */ > > > >> > > > >> int main () {} > > > >> > > > >> and excess errors should catch "misconfigurations"? > > > > > > > > I see. fhardened-3.c is basically just like this (-Whardened is on by default). > > > > > > > >>> Should the docs say something like the following for features without > > > >>> configure checks? > > > >>> > > > >>> @option{-fhardened} can, on certain systems, attempt to enable features > > > >>> not supported on that particular system. In that case, it's possible to > > > >>> prevent the warning using the @option{-Wno-hardened} option. > > > >> > > > >> Yeah, but ideally > > > >> > > > >> @option{-fhardened} can, on certain systems, not enable features not > > > >> available on those systems and @option{-Whardened} will not diagnose > > > >> those as missing. > > > >> > > > >> But I understand it doesn't work like that? > > > > > > > > Right. It will not diagnose missing features if they have a configure > > > > check, otherwise it will. And I don't know if we want a configure check > > > > for every feature. Maybe we can add them in the future if the current > > > > patch turns out to be problematical in practice? > > > > > > Maybe we can have a switch on known target triples and statically configure based > > > On that, eventually even not support -fhardened for targets not listed. That’s certainly easier than detecting the target system features (think of cross compilers) > > > > You mean like the following? The only difference is the addition of > > HAVE_FHARDENED_SUPPORT and updating the tests to only run on gnu/linux > > targets. If other OSs want to use -fhardened, they need to update the > > configure test. Thanks, > > Yes, something like this. IMHO we should aim to at least support all > our primary platforms (and maybe secondary if they have a relevant > host OS part). That sounds good. Do you want to see any other changes in this patch or are you fine with it as-is (provided that someone else also acks it)? Thanks, Marek