From patchwork Wed Aug 28 22:55:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172495 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395881ily; Wed, 28 Aug 2019 15:56:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBCChT+4KngLEwevp8+o0got4SgJIRU6f9DJ9LF6nYpnOKu8RGFFUIYCOCpc6+wjjdiJ5x X-Received: by 2002:a63:5941:: with SMTP id j1mr3554733pgm.319.1567032980031; Wed, 28 Aug 2019 15:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032980; cv=none; d=google.com; s=arc-20160816; b=QhPc/1ipPz136ELe0SF+zF4sosHc5rByJMOS2cUr1ejXo5YUgOrnW0KWCuCBE8RT+j SYu4En4ovpeTnvShE03yzgvOYcXndidiWV1D3evMg3NPmhfODdT1xMXDkErksxyWOdXT d8Yvqhjqwqpi7TsQNUVZoyMfofFEPFXgL2Y/WI1ikENIQGTFOL1OVZjbj2q72Ch7A/41 cHnmsUqlYeTcIdAIsAxjixzt2xD+vVwSulrYCvYdGFZuIETsFHJNLR8NK+nK+29bFWYT FmeTR0eJt7D7YvpIaOF1cSUmjvRtHLXld8xqR34oxJnh7wt9SID0/HE/5lw0KQoOoMza Tamg== 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=9sn2Js9Jk/bJ5Zg7h20L566WLWmk48WwAynvNmd3FH0=; b=QxFarcqFYiPQvvApq1kkgxcLTyZ4M0JVmTkK8JRZ6hgISnWbHWAoVlXHrFj+HEor+9 R/b59sXWiRziklLDYu/woxWS8u62ldQUOk/r23DC6O2/bjMCN2Sm9etk+MLA1PCM4XeI PevW/1nqXsko0vscoyeFkvaK3bqdpTKPllCjt4G2cDSwqsT+FExPgxJdrqMM+KPFj486 8dsBnXlnEl16q4LPGX1KJS2xdIPKrfGcZpEWIyF1R3aIV3wALpeoQIMFLqJDUyaYroGq 6zlafQ2VpCpsmTBMv2MNAXPWYFQVS5AeFUu5R2642N8/yCO1J1qOLE5aZNtzju+tfhOw VIFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tYltaOcX; 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 q19si533951pjp.10.2019.08.28.15.56.19; Wed, 28 Aug 2019 15:56:20 -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=tYltaOcX; 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 S1727014AbfH1W4S (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:18 -0400 Received: from mail-yw1-f74.google.com ([209.85.161.74]:57091 "EHLO mail-yw1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727281AbfH1W4O (ORCPT ); Wed, 28 Aug 2019 18:56:14 -0400 Received: by mail-yw1-f74.google.com with SMTP id x20so1044420ywg.23 for ; Wed, 28 Aug 2019 15:56:13 -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=9sn2Js9Jk/bJ5Zg7h20L566WLWmk48WwAynvNmd3FH0=; b=tYltaOcXAE1Pk0+XWSPCxkgkn4DA8pkE8EZAGttEN1oDBLIzf0BNTyu+945ulEISPq rBAq8NTnpvqGlOZ/BEdwqoxU/Vkvr4MxH0mbzwbtCXbr90JtfwCO5LZe0+i7fq5KeZ4c gzXGaQBqsehZ/wx0X7zTnPe9JczuFwG4sx8nZkGMbKkOKh3Dw0voX02SmgMMmfvi3HEO 3IbHAWJa/7sewAZmKYL78GA0dBir4bO6etEVF1VvnF3mgIDfZKOakkWXcOLs0ydxdvFi ChH2MNi9fQzHNDuUSpJf7P/+nYtv7jJy6fLKFYewdkcBAYn9AT51ylcMFlj+pldnfa0c Fl7A== 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=9sn2Js9Jk/bJ5Zg7h20L566WLWmk48WwAynvNmd3FH0=; b=jOPo5f8RiseWcBMMxAbGH8yuHB3sKd1D2wvW5zu9FDx6v/q0/t3XGG+6i8u+BPf9M3 BYOM4SjWGq8ID34mXU7bNSLFL+U0aLvB7SZPxee2iMNm3eyMQ/1c8cdxElN/XijSDCHG FiLYMbZLoGMIF+39gQUYiUWLsXqYV9X8Se4fNqfr9E6GIvJQAE+mURyWwzWodIsNCwXS y8E++mDTMUxrFWYPvRmdydF9m0ArT7m6liQ5QSkatHcc3VXY+nCF20DejiG7ELN5MwbR 3BqKzc06jCVi9nIZQ5+4RVsnQZBN2HS7R5G+147S+Bimqw9Aj2nQmxjyZFuqHojI9KAq 5BgQ== X-Gm-Message-State: APjAAAUEhUQpplYtnSe5xogvKGrd+YGXuf+/dGQNrfvbO/XL/F1M1/Ve EIEEe+wsajyo+zOX0X0coZcZyrOyOB/PSk1BjVE= X-Received: by 2002:a81:2d46:: with SMTP id t67mr4917695ywt.512.1567032973325; Wed, 28 Aug 2019 15:56:13 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:27 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-7-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 06/14] arm: prefer __section 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/arm/include/asm/cache.h | 2 +- arch/arm/include/asm/mach/arch.h | 4 ++-- arch/arm/include/asm/setup.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/arm/include/asm/cache.h b/arch/arm/include/asm/cache.h index 1d65ed3a2755..cc06079600e0 100644 --- a/arch/arm/include/asm/cache.h +++ b/arch/arm/include/asm/cache.h @@ -24,6 +24,6 @@ #define ARCH_SLAB_MINALIGN 8 #endif -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) +#define __read_mostly __section(.data..read_mostly) #endif diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index e7df5a822cab..2986f6b4862d 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -81,7 +81,7 @@ extern const struct machine_desc __arch_info_begin[], __arch_info_end[]; #define MACHINE_START(_type,_name) \ static const struct machine_desc __mach_desc_##_type \ __used \ - __attribute__((__section__(".arch.info.init"))) = { \ + __section(.arch.info.init) = { \ .nr = MACH_TYPE_##_type, \ .name = _name, @@ -91,7 +91,7 @@ static const struct machine_desc __mach_desc_##_type \ #define DT_MACHINE_START(_name, _namestr) \ static const struct machine_desc __mach_desc_##_name \ __used \ - __attribute__((__section__(".arch.info.init"))) = { \ + __section(.arch.info.init) = { \ .nr = ~0, \ .name = _namestr, diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 67d20712cb48..00190f1f0574 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -14,7 +14,7 @@ #include -#define __tag __used __attribute__((__section__(".taglist.init"))) +#define __tag __used __section(.taglist.init) #define __tagtable(tag, fn) \ static const struct tagtable __tagtable_##fn __tag = { tag, fn }