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: 1145929 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="oZgJljpX"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 466qNF6kYJz9sN6 for ; Tue, 13 Aug 2019 07:53:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728036AbfHLVxO (ORCPT ); Mon, 12 Aug 2019 17:53:14 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:39617 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727724AbfHLVxM (ORCPT ); Mon, 12 Aug 2019 17:53:12 -0400 Received: by mail-pf1-f202.google.com with SMTP id 6so67098482pfi.6 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=rrVTAqQVJXPVLtWMdjMmjshNdKqwQe2RUl2DdxDkXXTyQJmbMs+In3ugxJ8LFSmiU9 jUIh5cvLOhqH/EYBhUjahMjb1Q+aYchEOyaPhGmtYbzNwEFgAp2IwJ+Y7in1xPIPmlez JCR3++uXbtsN9888eb3GXFSrbISTF9PILBXQfMocdVrB7HSilPQm2JJP/m9g2kYmO0yI dqDxehbYbrFVD7XxXcG2x9L4ug/plGhDFCb2s1rOkW00QLQjY8NCw0Jb4RJ+qndvNyQv vTZXiusAqELF/MTVSuAS2OZrjohEo5OhGwfX3ZlBkE8zpVKKRhxz0daJxTzsYRDnS1NK qQrQ== X-Gm-Message-State: APjAAAX+eKvdrO+t17bhttEvqFutcmzccIM3Ygm+zzhyVo0lKL5x3cGd qOFJsU0nEJDc+nDNNj7dmGfd9sFDzhxLPOL6DOE= X-Google-Smtp-Source: APXvYqw4GsYyT7mhjnCkdsxNxaVETRuyF5MdPuiPgtTE/mHJhvlyJgo0ZkJMKWtagGQzpcMCTnaLpGCyUdZCqpaIfbg= 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 Tested-by: Sedat Dilek [ Linux v5.3-rc5 ] --- 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