From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161576AbeEXV4h (ORCPT ); Thu, 24 May 2018 17:56:37 -0400 Received: from terminus.zytor.com ([198.137.202.136]:55693 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969755AbeEXV4g (ORCPT ); Thu, 24 May 2018 17:56:36 -0400 Subject: Re: [clang] stack protector and f1f029c7bf To: Nick Desaulniers Cc: Alistair Strachan , Manoj Gupta , Matthias Kaehlcke , Greg Hackmann , sedat.dilek@gmail.com, tstellar@redhat.com, LKML , Kees Cook References: From: "H. Peter Anvin" Message-ID: Date: Thu, 24 May 2018 14:56:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/24/18 14:27, Nick Desaulniers wrote: > https://godbolt.org/g/oku8ux > > Is there a more canonical way the kernel does feature detection that looks > better than: > Hm. I though we had, but it doesn't seem so. For cc we only seem to be able to detect flags. For as we have rules that can detect new instructions; something similar in Kbuild would be good. > diff --git a/arch/x86/include/asm/irqflags.h > b/arch/x86/include/asm/irqflags.h > index 89f08955fff7..90974b5d023c 100644 > --- a/arch/x86/include/asm/irqflags.h > +++ b/arch/x86/include/asm/irqflags.h > @@ -13,6 +13,8 @@ > * Interrupt control: > */ > > +#ifdef GCC_VERSION > +#if GCC_VERSION < 40900 We don't actually test if GCC_VERSION is defined anywhere in the kernel. We probably should explicitly define it to either 0 or some baseline version if it is undefined. (Clang defines __GNUC__ so it will define GCC_VERSION.) -hpa