Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2523689imm; Thu, 7 Jun 2018 12:05:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKINw9tHKAwDp7QbU9cNbA4m8SplNC7UluvPu+Cqm9XFaoH8IlikyS5FrqBTQDdlKhspXtgw X-Received: by 2002:a65:5b8b:: with SMTP id i11-v6mr2570866pgr.225.1528398346872; Thu, 07 Jun 2018 12:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398346; cv=none; d=google.com; s=arc-20160816; b=EHA/yhwHd23V6bnnpDNn1qgUvzcz/qaggYFIuOt3lduNi0jIyjbu7Ysvwg0tutlMls E8VW3RATlZ/JpADI9yNnaFRz+EZSwkum0vFDnlo9+iVdJ3Kn3TzZbGCs3xQ11C/MVab2 y6Dhe6gLIWnGxLLrJHYUDzRUsfz9WK1CIBnqo6ZfPRYlW5oAYpDpDLaVl8ez1CRcrkPq TDuCQVJn/4AwRfb8d2sRkkk/qL0b+32gn73Z0oiHvOVPmreF59VvDYQ6TJB7DApkQ03E /OL6emg2kG1SeuWO6b/QORtnq9ww/LtUzeCb+Rw00zP+UUfaZyIpEchHl+0Oqjc6RSVN PCOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=hOqwRXQdwGNR/NVrDmZDDcJXxtMZYfMw4zUrQNsDD60=; b=pmp5uPrmPUYRXYxEJyU/u0RFLgu5H9VxaD11FGQ6gSbdulP/SRVjOhoHNIi0UhkBE3 wfZofE0OwVT/hAEvOeS7jSaWxCAkjjib5XIi6Y5LxuboOFPRZ9Ldxle4ykB/5Eq4uTVT P0simvO+Bda4KtKWMfuSlSGjj7KueLK9Gpc9mZT/UqV/BJk3OSNP9stqnHo8BPgdrr1n WMz81lOCnIZsG+u0kE5qiEYWEv3kwvoyIOc97SVYTPNiZLt3yZHuu48aHW2gDvfZXFCi isYBiYtTYiUoOD6ubRmXgaJkeFAbQCUnFxrFvH0/1FBFBJrNcmGV9QlSWYm0cTIFWntG hO4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M6g9QHoC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v38-v6si55981564plg.283.2018.06.07.12.05.32; Thu, 07 Jun 2018 12:05:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M6g9QHoC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933765AbeFGR30 (ORCPT + 99 others); Thu, 7 Jun 2018 13:29:26 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:47025 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933048AbeFGR3X (ORCPT ); Thu, 7 Jun 2018 13:29:23 -0400 Received: by mail-pg0-f66.google.com with SMTP id d2-v6so5067654pga.13 for ; Thu, 07 Jun 2018 10:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hOqwRXQdwGNR/NVrDmZDDcJXxtMZYfMw4zUrQNsDD60=; b=M6g9QHoCYpVyDji8IFFZREtYo0Ed8D7J8JgCmNQ95DRaxver3m3fy9c1CJVVp5kPjQ 4G0DJN6Kp8JEY5+A3kW7t74XJyvLbU9AN/VJU8TGOXN8SsEXby+2+bJtktDZ4afjtqxh RvboPtYvQJrDb6wleAACNqd92lmypLPIyrryGxSGkIiPTLM+NUe4A/KKsbXtqHLyAK+9 I+KXly1gX4195bSyBnXJgB41rbYcnS7cEycLpYVT3ZxGyvJzn1Q91+M+6OKiUev8/j0L zApNLv9FAucUcyklWdi7aw4mKYBacv3AHyIgKwlJk2HAi6P9i3525vtSVkukeNJz9y96 r73Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hOqwRXQdwGNR/NVrDmZDDcJXxtMZYfMw4zUrQNsDD60=; b=HUX8aZcgXHEhue6EJPo8KkKTFSyHZZmGlXGWKcPUQr5X000mvxzsHBXcr18YeXcOlx pjoV8KFbs89RKJNUaTxWvfkyKdrwWA2FJeMhtiL77bB02AxylyJlTjP2k+QqyhlVFWIX qH/UDmRu/LRPo2WWr6RdaP0/qxrNAgoFICG8vwi8mkoHp/qwxRCjdfH6RqeK8NRunwJl pE4f8dQegEEqrhcf4sSKwoj1cmPXKa+82ZTWyLN7JdFkigJfIOXyTP+BHi7TdDgNpXQD GqOvIwaDkazjEdWrM35dx2GFPxiAPZAZusvkV53MLTteEmvtU4+uhmdfTJezJMURvujI Dqgw== X-Gm-Message-State: APt69E2/RVmZK2vif96pAi9Fa1C45+u4Mqiyt40jVu4rHg7r1JXoCaNZ oeBwETWsqJX5QRjgZUC+HWRFfjFMZgIKSPg1/fDsEw== X-Received: by 2002:a62:a30e:: with SMTP id s14-v6mr2654951pfe.168.1528392562862; Thu, 07 Jun 2018 10:29:22 -0700 (PDT) MIME-Version: 1.0 References: <20180605170532.170361-1-ndesaulniers@google.com> <20180605170532.170361-2-ndesaulniers@google.com> <202492204c2d5bd5ca27307cbca5e44673b739ed.camel@perches.com> In-Reply-To: From: Nick Desaulniers Date: Thu, 7 Jun 2018 10:29:10 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] compiler-gcc.h: add gnu_inline to all inline declarations To: joe@perches.com Cc: Andrew Morton , Ard Biesheuvel , Andrey Ryabinin , akataria@vmware.com, boris.ostrovsky@oracle.com, brijesh.singh@amd.com, Cao jin , Greg KH , hpa@zytor.com, "J. Kiszka" , jarkko.sakkinen@linux.intel.com, jgross@suse.com, Josh Poimboeuf , kirill.shutemov@linux.intel.com, mingo@redhat.com, mjg59@google.com, Matthias Kaehlcke , Philippe Ombredanne , rostedt@goodmis.org, Thomas Gleixner , thomas.lendacky@amd.com, Thiebaud Weksteen , linux-efi@vger.kernel.org, LKML , x86@kernel.org, virtualization@lists.linux-foundation.org, Alistair Strachan , Manoj Gupta , Greg Hackmann , sedat.dilek@gmail.com, tstellar@redhat.com, Kees Cook , Masahiro Yamada , Michal Marek , Linux Kbuild mailing list , geert@linux-m68k.org, Will Deacon , mawilcox@microsoft.com, Arnd Bergmann , David Rientjes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 7, 2018 at 10:26 AM Nick Desaulniers wrote: > > On Tue, Jun 5, 2018 at 10:23 AM Joe Perches wrote: > > > > On Tue, 2018-06-05 at 10:05 -0700, Nick Desaulniers wrote: > > > Functions marked extern inline do not emit an externally visible > > > function when the gnu89 C standard is used. Some KBUILD Makefiles > > > overwrite KBUILD_CFLAGS. This is an issue for GCC 5.1+ users as without > > > an explicit C standard specified, the default is gnu11. Since c99, the > > > semantics of extern inline have changed such that an externally visible > > > function is always emitted. This can lead to multiple definition errors > > > of extern inline functions at link time of compilation units whose build > > > files have removed an explicit C standard compiler flag for users of GCC > > > 5.1+ or Clang. > > [] > > > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h > > [] > > > @@ -72,17 +72,24 @@ > > > * -Wunused-function. This turns out to avoid the need for complex #ifdef > > > * directives. Suppress the warning in clang as well by using "unused" > > > * function attribute, which is redundant but not harmful for gcc. > > > + * Prefer gnu_inline, so that extern inline functions do not emit an > > > + * externally visible function. This makes extern inline behave as per gnu89 > > > + * semantics rather than c99. This prevents multiple symbol definition errors > > > + * of extern inline functions at link time. > > > */ > > > #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ > > > !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) > > > -#define inline inline __attribute__((always_inline,unused)) notrace > > > -#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace > > > -#define __inline __inline __attribute__((always_inline,unused)) notrace > > > +#define inline \ > > > + inline __attribute__((always_inline, unused, gnu_inline)) notrace > > > +#define __inline__ \ > > > + __inline__ __attribute__((always_inline, unused, gnu_inline)) notrace > > > +#define __inline \ > > > + __inline __attribute__((always_inline, unused, gnu_inline)) notrace > > > > Perhaps these are simpler as > > > > #define __inline__ inline > > #define __inline inline > > Probably want: > > #define __inline__ __inline__ inline > #define __inline __inline inline Oh, never mind, if my changes to `inline` add the `inline` keyword, then we can remove the redefinition __inline__ and __inline. All that to say your original suggestion is better than my follow up. -- Thanks, ~Nick Desaulniers