Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1189754imm; Tue, 5 Jun 2018 10:24:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIvi2sFBoV5HUEFMOQBFBbBZ1gk6fFKx2DIr549dIv1FcM4Nv1tpv986vqvL0e1KdaGeRVB X-Received: by 2002:a65:4aca:: with SMTP id c10-v6mr13140508pgu.244.1528219465164; Tue, 05 Jun 2018 10:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528219465; cv=none; d=google.com; s=arc-20160816; b=j87tMHxuSj6cQi1pmqapBnlusTRMC+a1JUX3b226NPOxdLamP1Rxaa0sbEaWptljpU giv3oxQ34R5RSN6dcFHgWlb1pwx+7zJ3EiUtC76Q77aMGwaZPaEglS7SwLamRyfVaXmb SGb1BLTDU3UPanuSS/d20vxCbntGQWatWk1Yhj7iD36oxu7l8VFpo2yAOZ1LIJ6ajnHo VmGkFy3+FkhF3ClRgWAnsC1JNniqzUyA2r5h8jMXtsv+xZUypH1Z7YYy/y9nHhts4DD1 N/nnsCScv/hqxHmEdFwFvU4dy5CB02f0XMt8ogmFUj3T7RTmqyHU/MXNG/X+ICXvXZMD Q94g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=2EyZMzfQ7EyiY+g9I9DoUrpknmCU4LqZIkzmryaYW0A=; b=FT71SiM85Ssq1IFqr/neiX4OylD8NHtmbWifk3bEoMRKX2+jE+4ezq22ojQcBfw0Cu kKq8uWk6jSUA+tNgNDznNlTMz8J1OqNAuCJCS4WSAnjENmmvQwP5oc+5gLCGIsZvud3+ v/y/EDsUsiZCnuwzVrtKPlFjtMYS5GLwax4iMcC603PK8BzPlgWTSuWrf87kMrClf55v dkZeeWkeiwBX4+ogIVE3RG65w/KUxN5Hutt2XXnO/2SlQzJS0UdYiSGT5gJ5aJeHJL7v K0H0fzKAdf9Tg152CagfVjwfnIq6wG0dd1g28JvSHucaNSwvv2/1D9SmS4DVzrfAKf3Q 0s7g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10-v6si2814471pfk.14.2018.06.05.10.24.11; Tue, 05 Jun 2018 10:24:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752271AbeFERXv (ORCPT + 99 others); Tue, 5 Jun 2018 13:23:51 -0400 Received: from smtprelay0055.hostedemail.com ([216.40.44.55]:59289 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751786AbeFERXt (ORCPT ); Tue, 5 Jun 2018 13:23:49 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 45CED181D12FD; Tue, 5 Jun 2018 17:23:48 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: X-HE-Tag: curve42_3d7667ba1630c X-Filterd-Recvd-Size: 4486 Received: from XPS-9350.home (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA; Tue, 5 Jun 2018 17:23:42 +0000 (UTC) Message-ID: <202492204c2d5bd5ca27307cbca5e44673b739ed.camel@perches.com> Subject: Re: [PATCH v2 1/2] compiler-gcc.h: add gnu_inline to all inline declarations From: Joe Perches To: Nick Desaulniers , akpm@linux-foundation.org, ard.biesheuvel@linaro.org, aryabinin@virtuozzo.com, akataria@vmware.com, boris.ostrovsky@oracle.com, brijesh.singh@amd.com, caoj.fnst@cn.fujitsu.com, gregkh@linuxfoundation.org, hpa@zytor.com, jan.kiszka@siemens.com, jarkko.sakkinen@linux.intel.com, jgross@suse.com, jpoimboe@redhat.com, kirill.shutemov@linux.intel.com, mingo@redhat.com, mjg59@google.com, mka@chromium.org, pombredanne@nexb.com, rostedt@goodmis.org, tglx@linutronix.de, thomas.lendacky@amd.com, tweek@google.com Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, virtualization@lists.linux-foundation.org, astrachan@google.com, manojgupta@google.com, ghackmann@google.com, sedat.dilek@gmail.com, tstellar@redhat.com, keescook@google.com, yamada.masahiro@socionext.com, michal.lkml@markovi.net, linux-kbuild@vger.kernel.org, geert@linux-m68k.org, will.deacon@arm.com, mawilcox@microsoft.com, arnd@arndb.de, rientjes@google.com Date: Tue, 05 Jun 2018 10:23:40 -0700 In-Reply-To: <20180605170532.170361-2-ndesaulniers@google.com> References: <20180605170532.170361-1-ndesaulniers@google.com> <20180605170532.170361-2-ndesaulniers@google.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > #else > /* A lot of inline functions can cause havoc with function tracing */ > -#define inline inline __attribute__((unused)) notrace > -#define __inline__ __inline__ __attribute__((unused)) notrace > -#define __inline __inline __attribute__((unused)) notrace > +#define inline inline __attribute__((unused, gnu_inline)) notrace > +#define __inline__ __inline__ __attribute__((unused, gnu_inline)) notrace > +#define __inline __inline __attribute__((unused, gnu_inline)) notrace > #endif And only set once along with: > #define __always_inline inline __attribute__((always_inline)) And perhaps this __always_inline should be updated with gnu_inline as well