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 783823858417 for ; Wed, 10 Apr 2024 17:54:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 783823858417 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 783823858417 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=1712771663; cv=none; b=hLSzV8jsuJigKRqrDshzbb4kTvK3r51G7QQTJfI7iygSWkYYmmRAjo4IyCbYVVef5Q9gkkpn++s6pmLw+L+15d3joTBEaCuONC7tjiPJfZ8/B1CYhNA2Kmf8AtzktMdiMdRX3HtUb4wlmXvmn76cN0SO3jDn3T0svipTzzuwQZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712771663; c=relaxed/simple; bh=DwE7QNS0gspcE6BMWX7ukhrvygFHduVmeCRf5eQhbQ0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=fEeD9f2I0xCPoLTd0JPILLj9lauGSzJgClNPfENVq7feN9xHa0SfbwKSrBr7q+OhYuIpYQ0v+m4IKk4wFnrEou/wnz05CZcBPFuhvNqOy3eRA4XsVhtO2aaGk5cCYNJAoX0xVfH9vu9iEh62Fds6gQjIXqsx/E2nHdD09NMqinw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712771651; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=TjQaEgJbyjHj7k6Novc5qTJw3ycxvap1w6H5iqb2tPQ=; b=Lwds3eA4Rg1A8mUtv996lQRKmp6WPjJ1gIUFxkXJoP0JbooInsFo2zbsNEI6YhkgceNhxh s8jgyrgxOabwRIc+e5t3s0qhdzbZKKs+wBtdwB8ocZeFYN3/DJACMrQPTowL8M3bCuMAz6 zlLb8LCUszzAtt0+MI4QBEarNZrkdFk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-KQftn8miN1qmuhgC2Jg4cw-1; Wed, 10 Apr 2024 13:54:09 -0400 X-MC-Unique: KQftn8miN1qmuhgC2Jg4cw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C83F21C02D4B for ; Wed, 10 Apr 2024 17:54:07 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5520D47F; Wed, 10 Apr 2024 17:54:07 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 43AHrjhN114050 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 10 Apr 2024 19:53:45 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 43AHrjEJ114049; Wed, 10 Apr 2024 19:53:45 +0200 Date: Wed, 10 Apr 2024 19:53:45 +0200 From: Jakub Jelinek To: Marek Polacek Cc: GCC Patches Subject: Re: [PATCH v2] target: missing -Whardened with -fcf-protection=none [PR114606] Message-ID: Reply-To: Jakub Jelinek References: <20240405182218.55288-1-polacek@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP 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 Fri, Apr 05, 2024 at 02:37:08PM -0400, Marek Polacek wrote: > > This function is passed explicit opts and opts_set arguments, so it > > shouldn't be using flag_something macros nor OPTION_SET_P, as the former > > use global_options.x_flag_something rather than opts->x_flag_something > > and the latter uses global_options_set.x_flag_something. > > Ah right, so the other uses of OPTION_SET_P in ix86_option_override_internal > are also wrong? Most likely yes. > > So, I think you want to use if (!opts_set->x_flag_cf_protection) > > instead. > > Fixed below, thanks. > > New tests passed on x86_64-pc-linux-gnu, ok for trunk? Ok, thanks. > > -- >8 -- > -Whardened warns when -fhardened couldn't enable a hardening option > because that option was disabled on the command line, e.g.: > > $ ./cc1plus -quiet g.C -fhardened -O2 -fstack-protector > cc1plus: warning: '-fstack-protector-strong' is not enabled by '-fhardened' because it was specified on the command line [-Whardened] > > but it doesn't work as expected with -fcf-protection=none: > > $ ./cc1plus -quiet g.C -fhardened -O2 -fcf-protection=none > > because we're checking == CF_NONE which doesn't distinguish between nothing > and -fcf-protection=none. I should have used opts_set, like below. > > PR target/114606 > > gcc/ChangeLog: > > * config/i386/i386-options.cc (ix86_option_override_internal): Use > opts_set rather than checking == CF_NONE. > > gcc/testsuite/ChangeLog: > > * gcc.target/i386/fhardened-1.c: New test. > * gcc.target/i386/fhardened-2.c: New test. Jakub