Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp215134ybl; Mon, 12 Aug 2019 14:56:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx41lAza1n1z9YGZpn9NBOabmzSLhNde1J5gOhFNyRQ5xjz7BzOLaAeoibubCPJQCKqb3in X-Received: by 2002:a62:38d7:: with SMTP id f206mr13703710pfa.102.1565646969528; Mon, 12 Aug 2019 14:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565646969; cv=none; d=google.com; s=arc-20160816; b=zX+YWsNb/GCh0MDCSLJ0sQVMIcbcbWxuP0ybpJaT9p32wuFFiRwef2tX5iZDUebtAy W6CTAMT70oTJ2nG0qIKAigLJhL2PV4N5v/5ihrAygXxSd0uFbSTYUYLIbDhVWhFxwKVo Ugg+J+pLRL6RKRzZPOfMK55Ez8NIYTSCct0zTDa/AlrCCrXq+IEW0H5e5RjnCAke2orb f01T1co/elmLg98cerxDrUVHIia99PXq9l2QeqTX38T/dK0yaykq1ajgHmh8DO24QqEd 29DodvM8Ih9ldwdGs82PsA5a07YrGL0owLpQlhZNuWfPSkR49G60YQYRHrsLRxcfCMdR QlZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=bLIn7GLHipF5J2aM8u4yisb20ADo6gvdLQjWA3nqqto=; b=C6nZ1aUFth7Ga/gOgPq9Z0YvteiwEXwXxvTzvZrA8axvvdVSjcafhQB6irWde5lRp0 3FSeFLr2vm83Uof8nY2gymkHwgM73+pkGa7OwixfLe9tdi6PBrpIbpDGxJ4BYamCriv6 fu2P7BWzzPkC7hvb/fn+8RlBedEz9Fq6ZCKJKpJwszm5y6LwDNi/MF7ZsIxGmNFl8WUe GgF+xXKkDPTe27U2Pl1tFKUzUUvnO6eZMokszHUYuC7Lu/FF5ObsTYDiYGnO70XMz8q6 S6m4qamN6y6Pb8acGqk3TOJcqvGfxmvwjg3LdqZVI22wvoOgxpvLIUDH5e3NxISrQZYK /bXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oZgJljpX; 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 3si58343127plr.131.2019.08.12.14.55.53; Mon, 12 Aug 2019 14:56:09 -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=oZgJljpX; 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 S1727724AbfHLVxO (ORCPT + 99 others); Mon, 12 Aug 2019 17:53:14 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:33533 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728019AbfHLVxL (ORCPT ); Mon, 12 Aug 2019 17:53:11 -0400 Received: by mail-pf1-f201.google.com with SMTP id d190so67019699pfa.0 for ; Mon, 12 Aug 2019 14:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=bLIn7GLHipF5J2aM8u4yisb20ADo6gvdLQjWA3nqqto=; b=oZgJljpXQ94rk2zW18vXcsZCcgjkqaEK0PFChQqFNUt9eJvRqpG4FjIx2VGo1ax+1W 9LkZEFvnvQf02vEHwbNRr57CpoAZW18go0riE7ej7s/xKszlrapE+MB3qeBOdD41evqx DU/YJ3BMfUdNEQOHFc1G7SKXOnpMfO94pUpF3H4pDLqDZ0XeWgLwLDyFySqSY/dQVASg J0uwn4XLMvLP/6jEpQwjOMjhtDAFTa8TRYsI2q22JG9aSl4NCpQnF6uaDWBntIPKGNnk s7TFZyujRoUAZr7YPCUNvKLYOIrCxj6HqiLrCocg+2h8u1GCXmYVb8HRMIDn3qr+bKHb 9SHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=bLIn7GLHipF5J2aM8u4yisb20ADo6gvdLQjWA3nqqto=; b=CiOt4ZXNnPtznXjEDdBygb4Lbf8spnLiIk2EelMXDpWagK+nuSK3olmBT+njF+nbLj F0hc0C9BxAGA7Ev4S/ti3Do8WlnKPCn1kihgDP1IghEFphETlVrV960M9qLgRheObumB B+lLD5t58ayZ0M+dZwK77rvnNzF3jvP4ntufjKPs5AoQvIDSzC3Tg7ILavoRIblBZVm1 w3l0i1M35CW5/ox2WCck3aoIxU/cA7AouUz4fX39S/4DWVhdnhzzahfuu+9BWhY7mOSx vbI4aiLwXtPa8PZNIy5Fh/HH0nfEUoaZGagNFOwFZ9SdlcmmZxWP5UZrUB8rPVelWX07 BDBQ== X-Gm-Message-State: APjAAAVZLYrLZ0bM6OZfRxFK17vcQic42e5EkxeTIRkupNIdu+6bzWYo sMi08WpTd34T9PzxR66qr21AjlzSZInnlvzZ/vQ= X-Received: by 2002:a65:6093:: with SMTP id t19mr981443pgu.79.1565646790802; Mon, 12 Aug 2019 14:53:10 -0700 (PDT) Date: Mon, 12 Aug 2019 14:50:49 -0700 In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com> Message-Id: <20190812215052.71840-16-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190812215052.71840-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 16/16] compiler_attributes.h: add note about __section From: Nick Desaulniers To: akpm@linux-foundation.org Cc: sedat.dilek@gmail.com, jpoimboe@redhat.com, yhs@fb.com, miguel.ojeda.sandonis@gmail.com, clang-built-linux@googlegroups.com, Nick Desaulniers , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org 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 The antipattern described can be found with: $ grep -e __section\(\" -r -e __section__\(\" Link: https://bugs.llvm.org/show_bug.cgi?id=42950 Signed-off-by: Nick Desaulniers --- include/linux/compiler_attributes.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h index 6b318efd8a74..f8c008d7f616 100644 --- a/include/linux/compiler_attributes.h +++ b/include/linux/compiler_attributes.h @@ -225,6 +225,16 @@ #define __pure __attribute__((__pure__)) /* + * Note: Since this macro makes use of the "stringification operator" `#`, a + * quoted string literal should not be passed to it. eg. + * prefer: + * __section(.foo) + * to: + * __section(".foo") + * unless the section name is dynamically built up, in which case the + * verbose __attribute__((__section__(".foo" x))) should be preferred. + * See also: https://bugs.llvm.org/show_bug.cgi?id=42950 + * * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-section-function-attribute * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-section-variable-attribute * clang: https://clang.llvm.org/docs/AttributeReference.html#section-declspec-allocate -- 2.23.0.rc1.153.gdeed80330f-goog