From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-22.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E775EC3A5A1 for ; Wed, 28 Aug 2019 22:56:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B404D2339E for ; Wed, 28 Aug 2019 22:56:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ngR10Sh9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727447AbfH1W4Z (ORCPT ); Wed, 28 Aug 2019 18:56:25 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:57043 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727400AbfH1W4W (ORCPT ); Wed, 28 Aug 2019 18:56:22 -0400 Received: by mail-vk1-f202.google.com with SMTP id r17so490660vkd.23 for ; Wed, 28 Aug 2019 15:56:22 -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=helgrIKKAulT+KsUi/GFOUXK8QZ6n67xZn+iPINxEBU=; b=ngR10Sh95BLqDC0erJbnEzQJHXl2krXHymd0SWrk4V2luH2klpLvbRuYzeGiam/iN5 z0EJ3zNhjNEKGgSxY98naxS/lKhbqA8Khi+hXdS4lHEabYifPqn71kdC3D6+J+Viy622 B1bKIaAS+Wm+jJYCEftdGddEvh02BJaZGIPnlbZxEdwOjIT7Z8Y3LrnWtEZIIfMWvqIg Tv8ZbtyzseFNYo6V2yJ24Xsw/U1hW/Vik42lHi4UgSDouIjgw1SAuSE932nJSVboAyGv 6eG5ZWCpWGTkC0fysrYSZUh7ju8fTtfkVA9R3tpGKeN8xNS93Gvr0vpFxbXEDHh/V8HN 7YXA== 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=helgrIKKAulT+KsUi/GFOUXK8QZ6n67xZn+iPINxEBU=; b=rkIu2cOcpKxQa7BWi0NnN6lsT+TV+ggv7o8oltVSUa0Wr3Q3qoi0k5e2kCu+DtOpzK ItULWqKQsgyzmpQqkaI50Ud2t7ffBZvRZ/6UwWsLTvLCLxlf8pv0/nzilONrU7szvErJ +84M98Cbje5AGo40+RuCOkacUW45lnu1prVBpyeJwbc72kgkpZldKAYWcDx0dhmKkJf/ 1OlMwlJYaT5T80jrQhBVGp02SulscxZ/XJwMSMK0vyxWPybKB0HqxQyYCBaMTdlW7kzf Ma7ftJI+P+D7pYPZohx2Xc5fFcsgYYW2mXBlsXDoL6A7qdD6T03sfNf15xd6a7spOdlL Fa0w== X-Gm-Message-State: APjAAAWLRF26LmAqsnsTDzhDa1JrDf2dOXZBDn+kZvZWgGwL9Cj0g8HX ChY2iG1ffF9KQTLHtkgGVoyYqcX4j6ic3UyY60o= X-Google-Smtp-Source: APXvYqzl1M4Se25zKlWClHi+L2FnI8y7Wb9f3voC7siSalrfpQtRC+U+CVSfMf2qbB7lDpz3+xqLQHs+RX1acA2Qda0= X-Received: by 2002:a1f:94e:: with SMTP id 75mr3672763vkj.8.1567032981180; Wed, 28 Aug 2019 15:56:21 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:30 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-10-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190828225535.49592-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v3 09/14] powerpc: prefer __section and __printf from compiler_attributes.h From: Nick Desaulniers To: miguel.ojeda.sandonis@gmail.com Cc: sedat.dilek@gmail.com, will@kernel.org, jpoimboe@redhat.com, naveen.n.rao@linux.vnet.ibm.com, davem@davemloft.net, paul.burton@mips.com, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, Nick Desaulniers 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 GCC unescapes escaped string section names while Clang does not. Because __section uses the `#` stringification operator for the section name, it doesn't need to be escaped. Instead, we should: 1. Prefer __section(.section_name_no_quotes). 2. Only use __attribute__((__section__(".section"))) when creating the section name via C preprocessor (see the definition of __define_initcall in arch/um/include/shared/init.h). This antipattern was found with: $ grep -e __section\(\" -e __section__\(\" -r See the discussions in: Link: https://bugs.llvm.org/show_bug.cgi?id=42950 Link: https://marc.info/?l=linux-netdev&m=156412960619946&w=2 Link: https://github.com/ClangBuiltLinux/linux/issues/619 Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Signed-off-by: Nick Desaulniers --- arch/powerpc/boot/main.c | 3 +-- arch/powerpc/boot/ps3.c | 6 ++---- arch/powerpc/include/asm/cache.h | 2 +- arch/powerpc/kernel/btext.c | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c index 102cc546444d..3ccc84e06fc4 100644 --- a/arch/powerpc/boot/main.c +++ b/arch/powerpc/boot/main.c @@ -150,8 +150,7 @@ static struct addr_range prep_initrd(struct addr_range vmlinux, void *chosen, * edit the command line passed to vmlinux (by setting /chosen/bootargs). * The buffer is put in it's own section so that tools may locate it easier. */ -static char cmdline[BOOT_COMMAND_LINE_SIZE] - __attribute__((__section__("__builtin_cmdline"))); +static char cmdline[BOOT_COMMAND_LINE_SIZE] __section(__builtin_cmdline); static void prep_cmdline(void *chosen) { diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c index c52552a681c5..70b2ed82d2de 100644 --- a/arch/powerpc/boot/ps3.c +++ b/arch/powerpc/boot/ps3.c @@ -24,8 +24,7 @@ extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3, #ifdef DEBUG #define DBG(fmt...) printf(fmt) #else -static inline int __attribute__ ((format (printf, 1, 2))) DBG( - const char *fmt, ...) {return 0;} +static inline int __printf(1, 2) DBG(const char *fmt, ...) { return 0; } #endif BSS_STACK(4096); @@ -35,8 +34,7 @@ BSS_STACK(4096); * The buffer is put in it's own section so that tools may locate it easier. */ -static char cmdline[BOOT_COMMAND_LINE_SIZE] - __attribute__((__section__("__builtin_cmdline"))); +static char cmdline[BOOT_COMMAND_LINE_SIZE] __section(__builtin_cmdline); static void prep_cmdline(void *chosen) { diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h index 45e3137ccd71..9114495855eb 100644 --- a/arch/powerpc/include/asm/cache.h +++ b/arch/powerpc/include/asm/cache.h @@ -91,7 +91,7 @@ static inline u32 l1_cache_bytes(void) isync #else -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) +#define __read_mostly __section(.data..read_mostly) #ifdef CONFIG_PPC_BOOK3S_32 extern long _get_L2CR(void); diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 6dfceaa820e4..f57712a55815 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -26,7 +26,7 @@ static void scrollscreen(void); #endif -#define __force_data __attribute__((__section__(".data"))) +#define __force_data __section(.data) static int g_loc_X __force_data; static int g_loc_Y __force_data; -- 2.23.0.187.g17f5b7556c-goog