From patchwork Mon Aug 12 21:50:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 171134 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp77324ily; Mon, 12 Aug 2019 14:53:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxa9HHZW3hHTmuPtBtHDf95IPmzQbi+Q2f/jgK6FBjlMOw4uIBqyiUK8FDgpp9o1ZTWQ48n X-Received: by 2002:a63:4404:: with SMTP id r4mr31365091pga.245.1565646797098; Mon, 12 Aug 2019 14:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565646797; cv=none; d=google.com; s=arc-20160816; b=jfEEMpEFe9aNBZ8toMfRYMn+6FCZQSf3me0PLr360rQ2zxTEHmg1Okq0poe9ig9kZY zE4SYWDhRn4i+kZcEkrHUEAMaGUfsnrT4JFR/Q/KO7TB2QpsiAwOxrVSqw8RV1gI+ChK 9VerIUID+YfbtcNNXpv+PX7YOOcrZojT7QeX/3HwXuX1GPVZP8Sqjn9dcmKfn8PF4Evt caaux02tE6Cf15bStSfL1Pblqz75jzlkd9MWA6OOWfNCUQdnnNazK0DLkGq2pUmB5JJg BYs4jhLR9kDpR9bjG4gTOg6T0eLS5GUfNK4XOS8QT5TVTT22oruiJTJ5obHHziz3PKl8 G6iw== 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 70si14490057ple.282.2019.08.12.14.53.16; Mon, 12 Aug 2019 14:53:17 -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 S1728044AbfHLVxO (ORCPT + 28 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 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(+) -- 2.23.0.rc1.153.gdeed80330f-goog Tested-by: Sedat Dilek [ Linux v5.3-rc5 ] 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