From patchwork Wed Aug 28 22:55:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172498 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395941ily; Wed, 28 Aug 2019 15:56:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxTNU5f1nMZpCCZm6SacLF4yDC5bRPnb3GGzkMyEQSn+dZUqPaKEt5cf/ACOJ05R4Er23x X-Received: by 2002:a17:90a:1cb:: with SMTP id 11mr6693254pjd.109.1567032986879; Wed, 28 Aug 2019 15:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032986; cv=none; d=google.com; s=arc-20160816; b=cmvDlDzMynYLZrcn6N+ki3Yy4dApmPJaVzVF24Lofx4H6wSJx1QMwGteEFoVG26H1P lusJnHiDd7l8EuVzNJ6EeJDmhPu5MEORxbfOt3xIqKp4G9JttutTXLyBeFjKe+WuLrB/ IOyoGqTZJ51KA/iJdMygDSTycOtEN4J/jtsuLzsuqg09Wnp3CU3cEU3Z92RmI1DYdoHY pKzab3/5UKq+TASIcfNminNssXxfVERw0E0DpJYgndXhyh3WeVgRRrWovMW6Ft/+w34K iqGAewmNo4MWZvT9zF1NqusO57WrhJfZE46/1Vsmc2iYZxgNvGbGp08pH/u/BOxYE/O0 fNZg== 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=helgrIKKAulT+KsUi/GFOUXK8QZ6n67xZn+iPINxEBU=; b=uwiimI9vFvpDANwfxNaW44zluam85FZeT0HxOtb/mlZ+Dpr0VR+pCh0yU+sOgGSgLd 65uHAUcBbuURQvAB9mb64+pdkEI7HRGnZn/FZa0z3WKBQyQdwuxMer1FoNb5gi1k8WOH RmOfpmOhXZIzGf+8R8PxZWE2SS7zLMCYdVJNTL/jt7Y8WD+89nZArGCLYaFSc3TudYLy /4A/OOMSMhPSAboPcWZKzif0zJR07NUD4qUdLoxvzpo0fK8ALlePq/uVnmH3/RGoA1Wd tISahItF3uA0PJloH+sWk8aeC9IRGsICH0CMh+kTYGgXPVXo1tphCyTWFKnutuU1pLZc Ve6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ngR10Sh9; 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 a63si259312pla.381.2019.08.28.15.56.26; Wed, 28 Aug 2019 15:56:26 -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=ngR10Sh9; 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 S1727447AbfH1W4Z (ORCPT + 28 others); 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-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 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(-) -- 2.23.0.187.g17f5b7556c-goog 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;