From patchwork Wed Aug 28 22:55:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172490 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395685ily; Wed, 28 Aug 2019 15:56:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYljRFa1dmhfvRoSLT52HHvIEH8yP1FlEyU3C6LBOqSqvWINIk9ktFXQIDn61x+gvIvvgd X-Received: by 2002:a17:90b:949:: with SMTP id dw9mr6734407pjb.49.1567032964498; Wed, 28 Aug 2019 15:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032964; cv=none; d=google.com; s=arc-20160816; b=zdEnlMfEJAmA+eed2G0M+b3w0Ee7yGpE1Wt/Jhr7w82wMEVmOCU2795FNNJRvFtgD8 Uv3TDowhNIkiyYIy10HFDx3Ore4ddvYbEC3RU2CHl6aDVnvP3LIdx6dkSVc4AUUfc/kc mhUjFUJhTwdlJKybRMpCk3gRNRqvs9z9/H/NeKD+Wr1wEHe2W4RUJEFmZKV1HRWjCMt8 wfw8E6ZhE8TRP12wJSru6iSSSdov9hjVQFaTEh88AR3HrvqLFmYCwChY8mq1lXFOX9KV AqzP8mQdDsiExBfvJ+gz3Da7ElbCBQi2WOq9iOReeHsoLrI3zTAXapLhRSjlVWFhsXdQ DUwQ== 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=Zg0X84lAW+jskRxv7RHMWautXvu8YhPHY9Jy+iSuQjU=; b=ifQN6bwmb2ZErCdOPrWS6UoHkYIiVY4LSuuf3Vhxr+9RU2nuTRzmrCdYg4921DlxMu iyutf+ehTNfueyjE185tCXYwnXdbgKOSYyc3VdtDQEOG1n3sWBBEY52wWYPQW990wbpQ EmdQHEtOohmHun48TPeNuqbKZYvrKIw5nPbxQTuyZvgeL1N3klZz5kmNDWnQbwwqxDpH lCHdMgBz0UEkfX6r0jlxGCsqFHDP+G84o/rVq4ZU156gh0TBWHEfoREJaVdR333W0Wku EfOvSduGgXztX0gzRcOz9S+55loYdAR3p7DBY64Oc3kI+PqhizBkQHvmQdwPZVU5WzgJ qzMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HX5fMmMu; 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 u9si371817pgm.167.2019.08.28.15.56.04; Wed, 28 Aug 2019 15:56:04 -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=HX5fMmMu; 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 S1727123AbfH1W4D (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:03 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:38894 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbfH1W4B (ORCPT ); Wed, 28 Aug 2019 18:56:01 -0400 Received: by mail-qk1-f201.google.com with SMTP id l64so1645183qkb.5 for ; Wed, 28 Aug 2019 15:56:01 -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=Zg0X84lAW+jskRxv7RHMWautXvu8YhPHY9Jy+iSuQjU=; b=HX5fMmMuEEYiCC+kRp4pc9Noj2nY0gtJookY+HnsuC0mXP+Kpmrhc51OO/nr8AbUBU 2JQeYXHoL+Q90dzJNfxKt1snDKKVrxKWTGVvY65zFmruqz8hJMR+8L0ijFwkTNGBOas+ ZhmuebpDc6CG/EHVSgNFTYDscfBzeKeHsYuNePRiKLlErztkDeVuqPxy/2KV8r9DBf2l m64FPQGSujdzeeeO1A+1r5G9PdHaNAwlZOrcwXDQH/QX1vzPQmBylP09k0Ply+xaQ9J/ KV/Acv/+IJICMJhT7i0vVWsqoooa2WlGa1IpXoIUKzLpwGn8rBQg8Hk6kOHhY5n5sKvZ h5Cg== 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=Zg0X84lAW+jskRxv7RHMWautXvu8YhPHY9Jy+iSuQjU=; b=CSnIIoYCf6p8BkQtlPIrKBMEqUw14jELymY0gZeMb8Cwq/Q8rwuQyWPuCmXF/akTX2 N0GBt0+qf9BUb+BDh69DuM8GkWEzE9hYOmbvzUm6Sl9MmtlxyIObksc7JD5JP04M31m7 U7kMoaUQcJltavpKqpwRvncDLOg7dJK87afLZOOSTcpwJ9R2JpLvBgCIsNN+K0giB9Fh Bpndjysmq/hk6JjB1RnNOpMlPTGcE3LKwIbb7oSGh6vxvYwWBAk/wlMtDeyc0YiDW8iw HFJqgzVzvgpX8Ha+h47TKi/ENYaUk3qMYWIzKalbk6rSAvlmEXcvXJdrdDLEo0y9kk1g eWIg== X-Gm-Message-State: APjAAAWizX30FjhNqTnK24ApcZfJ7eCdYwDmz1xW6MJFcJ40045LnxQm QwIffCFA8MfUtMLwn114MaH4B+1qRp8E6X7/mkQ= X-Received: by 2002:a0c:ea89:: with SMTP id d9mr4725816qvp.16.1567032960447; Wed, 28 Aug 2019 15:56:00 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:22 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-2-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 01/14] s390/boot: fix section name escaping 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/s390/boot/startup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index 7b0d05414618..26493c4ff04b 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -46,7 +46,7 @@ struct diag_ops __bootdata_preserved(diag_dma_ops) = { .diag0c = _diag0c_dma, .diag308_reset = _diag308_reset_dma }; -static struct diag210 _diag210_tmp_dma __section(".dma.data"); +static struct diag210 _diag210_tmp_dma __section(.dma.data); struct diag210 *__bootdata_preserved(__diag210_tmp_dma) = &_diag210_tmp_dma; void _swsusp_reset_dma(void); unsigned long __bootdata_preserved(__swsusp_reset_dma) = __pa(_swsusp_reset_dma); From patchwork Wed Aug 28 22:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172492 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395775ily; Wed, 28 Aug 2019 15:56:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRzg25AiigVRLVVnBapNFYrqOqTFUgmLfu2laCO2PgZt8m9kdZgrLWLzdA0WB+jSHC5U1X X-Received: by 2002:a63:f926:: with SMTP id h38mr5556999pgi.80.1567032971339; Wed, 28 Aug 2019 15:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032971; cv=none; d=google.com; s=arc-20160816; b=xJP8opajufmBiBhDhusqB2t4LbqFZcT9ky0oOP7g1wLFQjYVlsKbPTDInrtBx9Abi+ PTx55DQLXXr0tFUiq14qOUsnB6+vuh/5CEC1c92EoKgOqMpS/diUcd1o/kryB5xQCPBe B/hzULH5+aIUJrkMv9HasiWVbCBCfeeW4p/kTtan0xRMxRWfX60H9LouEvJ20lSOO8rB NmIixShiQMD06CQ5npJnnufwKrtlRoWXOLQn6hTjlgD2XrlMqJ+vu/ChtrAiwA0Av6lt rwedwyvw0ICwgyrSGAiYaSCEtAK+fX9dT4IgfkxK0OFD9fej6nJlwCqPsx0EpzpBbQQ7 ewhw== 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=ni9Z15V4bpyiJCDFN/QunD1NK4akeOXTvBvWzMWvbaw=; b=dyk4VagzE6LaTj/M80i9XKCNKp31p9r88FZKMwMPIUbmAQ4BdJyu9Z9BjsRh8f+pqI 9AByodf637iUJNTPpTfXtdir7hQDWGjUaEmP4Y7wFX/nLQs7WgH4wLuf3KsSyyAkRWd0 4TOnTaL1gInR3B+Y75L0q8aAx2HqhJM7omUE0enMjqLygaHUvEvdzb//CqxwsI6+lows E0ulru41VP1HZ/f3yFxzNzMBnVinwCTsmREJmMhhn7UAVSjcZCpEo8NntDw5HTc7KABL 0h0JV1hFE+8qyNfDjrHnVNivzxm9WzLxKHWZYFUdtk3r61jWRG7+HsokG7sxsIHRt1uZ alow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="j/b3RioC"; 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 g13si363254pgk.369.2019.08.28.15.56.11; Wed, 28 Aug 2019 15:56:11 -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="j/b3RioC"; 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 S1727222AbfH1W4J (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:09 -0400 Received: from mail-vs1-f73.google.com ([209.85.217.73]:51187 "EHLO mail-vs1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbfH1W4E (ORCPT ); Wed, 28 Aug 2019 18:56:04 -0400 Received: by mail-vs1-f73.google.com with SMTP id w12so69822vsl.17 for ; Wed, 28 Aug 2019 15:56:03 -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=ni9Z15V4bpyiJCDFN/QunD1NK4akeOXTvBvWzMWvbaw=; b=j/b3RioCgNl03gmcLdV5uQhb7+drpE5z7RZ5TEe94ITp7f0ZSQ4JkcmQ/bl4t2ehVf 1wi3GM2h9kFt7L68RWO88p6Q5PtIhnV3HCEfc3LPPZHsosgTEj5jdefFk+Qyf2J5e6wX oli9igakxc1XLUbPINMnqOOTRlDdZfdgIga5IOpmMjEEm6q9/nPA7ACW3VbO1fsKndci PpdZSC+1lJBhNMFvjfTeVijKwOGvauVZdHsjMOSHBhqDSGRMjwNgeh7cM/Khj1UQsXdy n1yXgLmzOozfiRk67eV8hA7vlZpElNeuEoVLxQFdHmJlWeASzaL63zyNETJ5IBUtnJ5N UqiQ== 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=ni9Z15V4bpyiJCDFN/QunD1NK4akeOXTvBvWzMWvbaw=; b=cnwmnnvGneTWsXCGrbyPntaH9LEiCsmeG5NwjNA553Oq6SL7fUE/oZFnKyMC0eVvQM qk6PwliMVncofAiN862QbOAZ/UJ7kCn/VfpKQfEec6NbE2pzjf91hjcgQxBVXOhU21TY Lj9sfa6+qnyoc4eslsfPHJdFfZm4uU5ml0g4VW+nfy0xgkn8LJg53Fy2NoEiY4GOgA7l 06Px7z9XD1mDxA93IryOrwPFmK0ed9sevswK/2Hl+/WSY8GYLnWAJw87CjAIRLMgGmo0 5VSKYwzdX4ZfqL5FtHWLekpvSYopfLhVmQ4SoGrSpJkGNT8dhvNdS+qCEO3RX/OBmq1c QPYQ== X-Gm-Message-State: APjAAAWJ842UteWphDPOds0/Is0s5/5Dncf7mBTv/IokEMMIv+tp+lhC v64/nR2wYLNxsmV08DzAE4gnfoK1U+QB/v1ix+c= X-Received: by 2002:a1f:880c:: with SMTP id k12mr3650843vkd.71.1567032962908; Wed, 28 Aug 2019 15:56:02 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:23 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-3-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 02/14] include/linux/compiler.h: 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. This fixes an Oops observed in distro's that use systemd and not net.core.bpf_jit_enable=1, when their kernels are compiled with Clang. 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 Acked-by: Will Deacon Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- include/linux/compiler.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/include/linux/compiler.h b/include/linux/compiler.h index f0fd5636fddb..5e88e7e33abe 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -24,7 +24,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, long ______r; \ static struct ftrace_likely_data \ __aligned(4) \ - __section("_ftrace_annotated_branch") \ + __section(_ftrace_annotated_branch) \ ______f = { \ .data.func = __func__, \ .data.file = __FILE__, \ @@ -60,7 +60,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, #define __trace_if_value(cond) ({ \ static struct ftrace_branch_data \ __aligned(4) \ - __section("_ftrace_branch") \ + __section(_ftrace_branch) \ __if_trace = { \ .func = __func__, \ .file = __FILE__, \ @@ -118,7 +118,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, ".popsection\n\t" /* Annotate a C jump table to allow objtool to follow the code flow */ -#define __annotate_jump_table __section(".rodata..c_jump_table") +#define __annotate_jump_table __section(.rodata..c_jump_table) #else #define annotate_reachable() @@ -298,7 +298,7 @@ unsigned long read_word_at_a_time(const void *addr) * visible to the compiler. */ #define __ADDRESSABLE(sym) \ - static void * __section(".discard.addressable") __used \ + static void * __section(.discard.addressable) __used \ __PASTE(__addressable_##sym, __LINE__) = (void *)&sym; /** From patchwork Wed Aug 28 22:55:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172491 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395752ily; Wed, 28 Aug 2019 15:56:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0hBbAQKts/memw4Opw6jmNgg4Cc856+eskCMsbRqEJ/B0aRaDMQFPdtiZ+GUESVfA2xdn X-Received: by 2002:a63:c442:: with SMTP id m2mr5687040pgg.286.1567032969925; Wed, 28 Aug 2019 15:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032969; cv=none; d=google.com; s=arc-20160816; b=XQenXTj+1niEp3RckIHBcNL2g04m4hZnKmLJbh6kFq9U13Gaaw8eZ82pbnCPgKvDqy MmMdSGSBxqeYfhycIcDvVSCozx1yzECyQq/0Bj/DHHcOYFy5gJDLsi69CRLDFaJrOfaI FsH/ud0w6LgxA6ncjn9PjSsVMk0WLasqhzvTpDbKuxDKwlMQnbsnkKAiDMqw8bV9l+6o iF/IR/258lbqoac8SVB7PrvoXICwMwktMoiEviSIax7WXZZUhNAWWBPGeKOmC6k0iZIp PhGh+xZzK0e5wGP1gE62YE4hUOKBX7RGEUQY8xLqF5eE4Fc2P8NDNLwk7xt91lmtjJYp 9xDg== 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=qtui76zbZDjBR4fv6nr88v7Tjsdi7Bt5xxDWhf7dUos=; b=jy2w5weRFFVB3/880b5wceoQttAM6E+lsy2nTh++rpqYKdYxlt36F5h3hDy0TRv9T3 0powJBiRq6lI6NTsCNCR/0ACa3ZuUaf6f7lkrcITsqZU3r/+TH0fbXYHmXWZPJ5AH0un kLZykFOffzvAkv4W+xZ/9Ce9WgnAlOfGQCogk7r6zjKZha+6iZI6Yv4ga+z65fEdQ1k3 8N+HGgvallKmL/g8TmDyLZOne4tmb4nVFlmtAQ13oz0xvMrWpcCfd2PspSmDtzZ0Qqns H3ty5lg6eT6LDSMCJ9BNd5K9Lz6rDnWKM78FoWtNzV6MH0DP+3GwXG8aH2dcLHfZB4yf Du9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hJ7AtSw7; 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 68si392463pgb.104.2019.08.28.15.56.09; Wed, 28 Aug 2019 15:56:09 -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=hJ7AtSw7; 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 S1727182AbfH1W4I (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:08 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:39682 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbfH1W4G (ORCPT ); Wed, 28 Aug 2019 18:56:06 -0400 Received: by mail-pg1-f202.google.com with SMTP id t19so774135pgh.6 for ; Wed, 28 Aug 2019 15:56:06 -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=qtui76zbZDjBR4fv6nr88v7Tjsdi7Bt5xxDWhf7dUos=; b=hJ7AtSw7RjbmYX/4R+147PAQ5c/xVAItZshRqnnBzQSOhDicW/bPFv8afrFf/d1GbS IKX+9zhUwUSqUKnOptDQ7uNuRc7loUh+PoppdolKnauSOl6afFZN+rECJ4kh2E3xymtD NB76hryMlcotA7rkZtbtd4CNoL79uGkF/5gLe1WjYhStWWppuWUG8T05Q0I35bLgI8MV PwpM6hhIu4pn0Q8JYY68lIQEh2KlBXC1y3rYsrkixwfa2XZPQ9WR4f64e+fhhsMGuqEb Tr0aQAtVcRIWLZYDklwU3hnLdDaufp7pohDsNKsHn2GVExBpyrJTExR/NVUyAkr1v4KY BNRQ== 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=qtui76zbZDjBR4fv6nr88v7Tjsdi7Bt5xxDWhf7dUos=; b=UnCMZ6bPdaF61gPFjkATNdd49NuNcoebTQLICF+ZPDX+LibtK37rj/n7p2Q77+MM/k qehYiHUhfJE4DlVZhcvWUugbhWAsAsWHtyI0qSJHX2CTD2v222o+RpSFHZeYbv1kRBHS NcTkL0Y275FjS3IjR9XC0x2iTZRT5Ya3UbrJvDK+EjZfWH8aO70zjoiN7nfvPiGUxmx8 UYAmpyJoCAeBio/KDKQgqGEUr31VJu0zT86LqFGV5V3XAcim9OJ1mI1lXSIaKXM4WqHM x524ZtOdwA02RFeaxT3aFWl82Mb/tFt07ahyIspC1O6sc4v/gfFE6nfpIxicRD1K41bj 87/w== X-Gm-Message-State: APjAAAVtPX+Zh3mELsidGktvDczXTg3eaJFj4u5PV3m/A/v/Rn+jIB7a Antn9xan9drx/vFu1vzG7/Obxhq4I38XnVU4XzI= X-Received: by 2002:a63:1020:: with SMTP id f32mr5719226pgl.203.1567032965505; Wed, 28 Aug 2019 15:56:05 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:24 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-4-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 03/14] parisc: 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/parisc/include/asm/cache.h | 2 +- arch/parisc/include/asm/ldcw.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/parisc/include/asm/cache.h b/arch/parisc/include/asm/cache.h index 73ca89a47f49..e5de3f897633 100644 --- a/arch/parisc/include/asm/cache.h +++ b/arch/parisc/include/asm/cache.h @@ -22,7 +22,7 @@ #define ARCH_DMA_MINALIGN L1_CACHE_BYTES -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) +#define __read_mostly __section(.data..read_mostly) void parisc_cache_init(void); /* initializes cache-flushing */ void disable_sr_hashing_asm(int); /* low level support for above */ diff --git a/arch/parisc/include/asm/ldcw.h b/arch/parisc/include/asm/ldcw.h index 3eb4bfc1fb36..e080143e79a3 100644 --- a/arch/parisc/include/asm/ldcw.h +++ b/arch/parisc/include/asm/ldcw.h @@ -52,7 +52,7 @@ }) #ifdef CONFIG_SMP -# define __lock_aligned __attribute__((__section__(".data..lock_aligned"))) +# define __lock_aligned __section(.data..lock_aligned) #endif #endif /* __PARISC_LDCW_H */ From patchwork Wed Aug 28 22:55:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172493 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395801ily; Wed, 28 Aug 2019 15:56:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqOu/zkI+ACKiB38tJfRSm4ZaGIB1evi0myBOeuWo8+QBzLDtbw+FNftGTs0zjbLoDHB26 X-Received: by 2002:a17:902:6b06:: with SMTP id o6mr6671880plk.33.1567032974097; Wed, 28 Aug 2019 15:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032974; cv=none; d=google.com; s=arc-20160816; b=fQlOp0JzXNUAgmDQrbfXJb9sAjPMFqGRXnjL/8vcYHj8SKCWQTNyT5dBdTXc7ps49Y CJB92mc34X1P+/kb0fhN92FgbvnIXujz/xPI2kvuSSBcVlfydBC6OqXFFG03GgH5MRer qM8RdxcCSvXLn5cX9SHnuEJ8MPwmJDJGxhznHRzdgv1dMao5cKBqx+3CpR+wzGEV3okW jTo5O4zc7HZ/FJ8LXF2IMYaFuNvQu9T+r71jnfkQzWcxkbHoAFseaR4Ji06Ti71TKnro gDPw2ypPF9LmtqGEFwP+xiQQ8Jbrq7BJiZnpGVwt2ikFy0O7IPXAwg5AStF6Wj4pyBWX m0ew== 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=uqPQg6B/bO6e2oO0RWU/9KfcrqEBl402Sr4PpXrmZmI=; b=aTUIJkt3mgZfOx/3ZZ8PD8+YgXEDzhl9ul05yojNT7XLUjbXBoYT6VEqAHbtme0mkE 64JKOsLCxiFoSDiAF5qMUnrpI59LMxihLUmWe06g+vw1gTzQcw4qXKhuEDM06MIbSg19 JRzL/8qFtki5TinQKtv2V346VwqaCKH70qCYspXOF9zVE0Rq0gFVU7UdkDAryA45HWtY qmu7wmD8qmOe8HRPyrQIm5Eei3FDJHlXhd95q76f2dQWJ0CFJWLIVwtYymWjYLhfId0w EF2EyECryFB4cYJY5ZKnZgw7wU7wonsoq7OxsIB/YzRtzyv0ZxjkuHVdniotBh1Hw74I 9AKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wMbU2OyP; 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 g13si363254pgk.369.2019.08.28.15.56.13; Wed, 28 Aug 2019 15:56:14 -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=wMbU2OyP; 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 S1727257AbfH1W4M (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:12 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:50111 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbfH1W4J (ORCPT ); Wed, 28 Aug 2019 18:56:09 -0400 Received: by mail-qk1-f201.google.com with SMTP id l14so1609847qke.16 for ; Wed, 28 Aug 2019 15:56:08 -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=uqPQg6B/bO6e2oO0RWU/9KfcrqEBl402Sr4PpXrmZmI=; b=wMbU2OyPf3rFonkJbQ0wnImMKCEnwBI6Fdc7hS1qKKi2qEZxBn80d7aA/5N5SpNbS6 kDYDXogL/j90hxIc0Nhh+DzSJ+yDX6GGzU396lafxavIFWPx2tCNAMrn75SidlcDcnhF PmrYj+yT3bXJHTxMey43cZL4vxPAeEMlt61ylLqPRtHKxEtP6EUOMGmh73hSyh+twaAt iOxHLhwoLPNYSw1kUsXwfR9BBlIe+UlbM/RgLS6kP6pOl5EVmssWclAvoiZQ486eyShj FtqUYKsQyBSNaE5HpfHNEGAT2k3TK8uAmRtFvMLQqVe3ZcFKOrzFGJBj8R8mZPrEfG8y kANQ== 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=uqPQg6B/bO6e2oO0RWU/9KfcrqEBl402Sr4PpXrmZmI=; b=W8uOdRGfNzWqaAjkZd4vtj+HPh/+11In2/9BiH4EOAGbvhpPL2gyYGSZvHKi/wDTyy yole5SGq3kJZx44Fr0C4iHAsVniotKRG+tbCMI2s52tBnhGaJiYokF7Uzuzw3ntmOmaW fYObc9mLmqKW3JK2xQVjXTazSqEHkXUO5jaI0zt1m/KL42yHN7NwVJOv43F1bTVGx4RE iDomRqInx9y80xIPNu8vzEiI+Pn9HkEYMTAWPPRAgNTYyjfRN+qOmpK1IZkCl5c31TdN oqstZxWWTsT2wFCUShlUp8RsZjhVYHYbHWUE51lerLBPJTyjMTjgTyLp1syv/2XBU2dT GgKg== X-Gm-Message-State: APjAAAWABKgLG4VkOVHjMp/M6iSPsiE12xial0/Yt7N+yGUjsefpRtSt zMFPGMsBvETAhFsALVYuXa7SsOb4dJqBob23KM0= X-Received: by 2002:ad4:4533:: with SMTP id l19mr4645199qvu.23.1567032968146; Wed, 28 Aug 2019 15:56:08 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:25 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-5-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 04/14] um: 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/um/kernel/um_arch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index a818ccef30ca..18e0287dd97e 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -52,9 +52,9 @@ struct cpuinfo_um boot_cpu_data = { .ipi_pipe = { -1, -1 } }; -union thread_union cpu0_irqstack - __attribute__((__section__(".data..init_irqstack"))) = - { .thread_info = INIT_THREAD_INFO(init_task) }; +union thread_union cpu0_irqstack __section(.data..init_irqstack) = { + .thread_info = INIT_THREAD_INFO(init_task) +}; /* Changed in setup_arch, which is called in early boot */ static char host_info[(__NEW_UTS_LEN + 1) * 5]; From patchwork Wed Aug 28 22:55:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172494 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395835ily; Wed, 28 Aug 2019 15:56:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/IY9KclEwpXatn9vT3XAak5fZciqlO12Qpfyf2cFeP06k4HVBvuZHDlH8c9y+e+ce+Me6 X-Received: by 2002:a17:90a:21c1:: with SMTP id q59mr6446911pjc.6.1567032976747; Wed, 28 Aug 2019 15:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032976; cv=none; d=google.com; s=arc-20160816; b=oRzJhYsLtaN1FNU3jk9nJqxyOGkVJ/NxLivUozsJkZ9A0YolvkTj3RvVaw+q5W68bk 10Ad+9gIRMvbUIlPIUceSNRuir4gyOG/rSLcr02KrmjrPmxVOpiyvnP6im5OIex+nwpU ZXCwfl0o0dEM1Rg1yKQht1dyxfcrOGj6DTrH3VojeAsQiDP5IqcfG3LDiaduTZGum1O3 Tb4IDueIx1/Bndns6714cL8TqlVNIzyJpSjkTnK9Khi0dtEmUBNzn9ugfM7ng/7e0yLE 8IiA3DMMTNSZQJLIwu8IQLGHivqivieRsdxijzUQrvGD4cs+2LWypam8HPauvit7zxAU 62TA== 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=2yoc1GXfYVLtZMNWi7ZECLQeadNDjorQFIKFDUAGhfE=; b=Mz+UdvY0uNzYn3ynHAaWGt/nmAQzocjrshgxF9cx8yf5PcZc6gsPAfY9vmKrLlfodm AUwH80S8ZL3BQG2TWmRZ5niovv79heY/zyPE2L8oN6/52AvoUTy9HLLOEjHPVfFg0+8V lgfi3DngONAjysnF8VwSwiFxE3BSF/LrRLhM+oBOzcLcIicU0FviWl5fUIUf0xrPCAc3 lfcEgIZV9v/d91Lijb5/0BEmsjU/DSqbzR24RmMq4Z08pRvtVe9x78wfUGacUDW+ruB4 QU/noYDIPtbHtAcG0I8tyL/6MQbuOrPYlJISpHnn/trnhbrWuGdznYUUUFs44d0Q28Du ZBRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DhOt2NbA; 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.16; Wed, 28 Aug 2019 15:56:16 -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=DhOt2NbA; 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 S1727314AbfH1W4P (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:15 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:43209 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727230AbfH1W4L (ORCPT ); Wed, 28 Aug 2019 18:56:11 -0400 Received: by mail-pf1-f202.google.com with SMTP id q67so857760pfc.10 for ; Wed, 28 Aug 2019 15:56: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=2yoc1GXfYVLtZMNWi7ZECLQeadNDjorQFIKFDUAGhfE=; b=DhOt2NbA0WCkAxiij5rqLx8+s6ImkZreZtvO53khZX4r8LiDrRXEaxcSqPrm+6A/wV RbvCPnS9TMGV9TgeEy/fod0EMRNImTnm+Z8InKr4nZuY9320QraIDLwfG4UeBPkoJrt6 0pFqqxLJ+UKjz/GwCbVbYgV0/aCJLnIOxL26dxi/tGPsNPutnUfdcF5dSm88dTInhfJI WMb1aaZKtKc48GMwRkbk1+xryLFSJ+NDPSaoJ4mUag2RWBqLeeO7m3FK/Vf8NYOSFvmB ozSXrEfdmPCTCafdWg3hEIT3lZosf2QMhxMfyopav00wNN/1TDGLXV7Q5wdCGgLZC4Cc NNOw== 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=2yoc1GXfYVLtZMNWi7ZECLQeadNDjorQFIKFDUAGhfE=; b=lzBlateSzIETjAMrGH1NIrGMvMhZDlnUItHb6NQLfwyHqO9vEYE7Q6isSI++x4A0A+ F6soiXaTSJLKPwCt8zPjzQQ8ojyQt3jqDcP/2WZVQ8WrB3k2QHezHPEuRX1lLdghgDfO DD7ebbDYkWEdDqag9pOmvLCH+8YQlNo5YdEvsF0//Ip9Uk+bm/z3Owo9Hl84ZIi3UfOQ wvo3Y+GrFecOr611WJnQQbwuF/DGdd5932nPINQi2ciV1/T4FIlMaQTyDMhkXoeYD1yE 2oYiWGvg8HPDBGL+1TiJ5ZNfDcpVCxZT/BH1j/LX5G3dyjU/8hQ6TczBlt0KjaNaM0RY +5LQ== X-Gm-Message-State: APjAAAWlwZaRtELOuONtLvHRkhqJcQ+zqp3llIsTFcQd9fTXpZmdDtMt nHBiIrRd2dKjSSHt2UPLUr7XlCr9J2txWNMHpOw= X-Received: by 2002:a65:56c1:: with SMTP id w1mr5392712pgs.395.1567032970530; Wed, 28 Aug 2019 15:56:10 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:26 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-6-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 05/14] ia64: 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/ia64/include/asm/cache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/ia64/include/asm/cache.h b/arch/ia64/include/asm/cache.h index 4eb6f742d14f..7decf91ca11a 100644 --- a/arch/ia64/include/asm/cache.h +++ b/arch/ia64/include/asm/cache.h @@ -25,6 +25,6 @@ # define SMP_CACHE_BYTES (1 << 3) #endif -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) +#define __read_mostly __section(.data..read_mostly) #endif /* _ASM_IA64_CACHE_H */ 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 } From patchwork Wed Aug 28 22:55:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172496 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395903ily; Wed, 28 Aug 2019 15:56:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMDWoBggVL1JgL7eOFP5Q/F+na0MagXdfDsDGMNFbzkcCzlG4zBUjJht42byxIMmMaxivX X-Received: by 2002:a17:90a:2629:: with SMTP id l38mr6825571pje.71.1567032982480; Wed, 28 Aug 2019 15:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032982; cv=none; d=google.com; s=arc-20160816; b=HMK5ujRuMVpdiqIudMakxT9Lw42e09Fl1HxvQ1wmS+HChtA6vXAySABCZGB8U7lrvP XpVFJU6YKGUKcXDDmhqKyTX6ZgwzevsGUXAkSQnfukvi32ZN/IRiLB6pcFyuQwPoazfX wovzUjdR9wRoseNX7b4NPnrSgHzjiaP0qBuRB3C4L9qPO6a05L9GOqO8MVvpDJYbo2Bd 01kfCiIz7DJNXTHrdiWY8JEsB12ZCJneHmzBC3iIwfORFw1pSRBaNP0wpV5RRJirKyJO +Am96A7erKJECJnVtlEbFFYLsF+Xp6zEZw1+OsybSFnLsZbjwoKiJgEXBtu0mXoAfeR4 u8ig== 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=iz1qiAOSCOnkxPsyI19LsO+D8x7BgqmfmJjcxn2Wo2I=; b=cH/DFnGX5KN9W0smXxR5RVEyvsF3E+J1CSpIet1ouC4r1lUhuqgf6PgRGzb3XCgKKf g1LG/piG+NfChozCEOkgFWNvdBLY9sAu4bi/1kgeEqHMPKK+mnkUCyLYn1vRCXEHQRKB 12IaRBibmV9zcdXJFO/3QCFLHN0yUejleJD7FA/ubqTSRse8mOjcKIzUbkxyzQy0pNRo 7Y3VoppDxg+dCYa8/AQbenGxxY8+XHVHizwvmivJQ5PIDQlo8bI6orCd0pTYCbj1ndlk u8717kFQAXxorgUXz9YrHJ0PzpsJyzHFDOiHTOiA0zapg3yJNtsl007nvV+ZXueCnoc0 uIqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="huvkYD/B"; 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.22; Wed, 28 Aug 2019 15:56:22 -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="huvkYD/B"; 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 S1727383AbfH1W4V (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:21 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:44078 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727230AbfH1W4R (ORCPT ); Wed, 28 Aug 2019 18:56:17 -0400 Received: by mail-qt1-f202.google.com with SMTP id x11so1390167qtm.11 for ; Wed, 28 Aug 2019 15:56:16 -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=iz1qiAOSCOnkxPsyI19LsO+D8x7BgqmfmJjcxn2Wo2I=; b=huvkYD/BTecsR5bt3x7yOO0jX2I8MRzU2PCbapB9Rim+i0TKFCJwFYfs1qv2+tW+8C ePsPA5CHhXt/ldTR0AtqySSNyHZeLffJl9ij4Xui4ZXnF3EV6t21ZK+K/gG1Po6veo+H IqdfrwTV0RYI/CPocgiP/yLLGeLZP0JlyfoEcyBdllfByszYgWtJAAAKOqvZuweLqxdn gFBzRStgyX3yg08SjM3FfQhMcMHWR7xHI2UD0XK22xJ/xLPYA5mZvXRrTzzYt4MMVnO5 QEuWiZ79jR4gvE6N/SZs7jP+R5d3s49LXIAHQDnYjiH1kXt3t/DJ3Ov7wjZGo3cWR9tD +nsw== 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=iz1qiAOSCOnkxPsyI19LsO+D8x7BgqmfmJjcxn2Wo2I=; b=D4gIROY68Ar5ULMQMLASYardYUKrFxgSABnCCpEU/aW1cU0WfrECBIG5VYS+w8PY8J /lWtpfmMQqGpeBi07vzca7yYHzpS9PBlKw9u0mH4Q+6X1FYuY9WxeWZnBO0C1+iEJVU0 7xWxqJlPhB4OqsQ0t0R28TBEYZx0Kti5EqcG6Asf++1B0aHzv7q78cby8iy3Lzaux3Tt zn3cGJcvJP2Omt301g8llg9BypUGtO9aufwTrG8R8gqoe2Sg0+NuJgKiN9R+0ar/Zd4I JsTBYFshkU6bye8KHm220ib5HSBtJlsBXBl3/8FXfb+uujQneiEOdEN7DY46qkFR4+C5 lXjA== X-Gm-Message-State: APjAAAV1SSUyWfH8JuLLORHXmHbq4WxGAKlcco3JQRsHWGBK9TmGMvWM fUPfI/6QJKsKyFC7RbGpx+xVTbUgZ0ZHrhjbMNI= X-Received: by 2002:a0c:c2ce:: with SMTP id c14mr4701970qvi.243.1567032975799; Wed, 28 Aug 2019 15:56:15 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:28 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-8-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 07/14] mips: 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 Acked-by: Paul Burton Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Signed-off-by: Nick Desaulniers --- arch/mips/include/asm/cache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h index 8b14c2706aa5..af2d943580ee 100644 --- a/arch/mips/include/asm/cache.h +++ b/arch/mips/include/asm/cache.h @@ -14,6 +14,6 @@ #define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) +#define __read_mostly __section(.data..read_mostly) #endif /* _ASM_CACHE_H */ From patchwork Wed Aug 28 22:55:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172497 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395924ily; Wed, 28 Aug 2019 15:56:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfBas3+SALN3ePTz8A8YVlcgoH9mNkLenXb+V9msE/EFBIOHibgf5I6ayG5VPZq6QxH6P5 X-Received: by 2002:aa7:81c1:: with SMTP id c1mr7321882pfn.78.1567032984564; Wed, 28 Aug 2019 15:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032984; cv=none; d=google.com; s=arc-20160816; b=zNa7HWf2VC8SjHg78mLSymabMp6/Brerda5ms5iwihdSg8eieJK+0UEUQaCEvRXOAX leXxGr2iTGGepnsGcBiPVqhwzNP876jjut/ZfREAfNXEoIsnNn3+9ADNwS7wwJB0nwTI QnUgleY05AOuSc103umwmKmXBNVyzzKI+2HmfyYnXKtTS2aTVl20DpPQbiqpIxEYJUCc +MAyc5EuHKIfOGlBCbZ/hmp3iJMBH9encqQGu/v1WLONhSHwB95VHGk92ppju3Jb6kEG IjInhvDiE3s7A7gpVbdU/xNBTIFypRE3PyCGVLDEDn7vtZ/3wEwrh4Hpc1iRSbNO0g2P zjqw== 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=b7ld9YNlx/ctaSkEdtcO3fpX7aUy1ofd0MxWpfkF/rA=; b=zC3bYWzysymzgRObF93aTrRnz65IrxLQ3uKVX2tWOI/WlUA66CHDss6A4Ssdeltht/ V7oidqW0dfOarAaq3/IrbIE6JRrB7MIW4dR9dqLjbxsWpoqhrD2CES19mZGIpOOwIseV 9q9CmK9QXFhDxJHgWoAhZ2IZHJFPPgfNqOc7OVxnLLTCVkKG4VGRF3vyu1NhppJYIqjO Uru5rgVW9zybM22I4PAXQczl0V9uJV85cUor/Eh6N64cO7Qi5lfAVUFxlFxIfn1xIXD2 8iLgT+L162QyTPAekG72AtKmh1aJ+PeMm4j0XH0GhPXQA6DnLs8Anp9VqpiR6Nrd5N0Y h/aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="JzT8/LLb"; 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.24; Wed, 28 Aug 2019 15:56:24 -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="JzT8/LLb"; 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 S1727418AbfH1W4W (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:22 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:41238 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727352AbfH1W4T (ORCPT ); Wed, 28 Aug 2019 18:56:19 -0400 Received: by mail-pf1-f201.google.com with SMTP id 191so861795pfz.8 for ; Wed, 28 Aug 2019 15:56:19 -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=b7ld9YNlx/ctaSkEdtcO3fpX7aUy1ofd0MxWpfkF/rA=; b=JzT8/LLbQFND6yOdtjnjndUw5dZEXCmhAV49vnQicQImhLm9v6qzCBihCNlmrsXKTl jKpxIU6rwju1F8GAvgLl1poxw1iypySHcqwITYHfFdUetBFnQRy2MYw8B4Fx8DZva/43 lI575oWycij5nbg78kD4esr4cV4ET13QvfrjpDIDnzzw+1tMt7relayQpEUDZSxiswjX dJdU0sBvXksVr/8/4uioOoYAHsSOYQKNTnYrlSKsq5NIqH0bFJBkrBCK3sF/VWxnDDRb pf05BA3w+S5mdkYjgJ7+v+z5ce9kp5i80DlZxB2Q3DhYgUwvhgc9vAZXNGlUFnsnHxWz MOSQ== 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=b7ld9YNlx/ctaSkEdtcO3fpX7aUy1ofd0MxWpfkF/rA=; b=LKC2X0Ii+6or/U6sB1njrkOCCXIxtT9s26mWvlYUDVTQiIDWFtz9DYGd/JnLMzygIF 3HvVyK2aN+JZNLpsamjXONpQKmFWOxo6JGNp/UmU9nuCWbzarV0egZvkdjTeqHi7a1zi S3mukk9cI0mZGS+ilYFcMZ0ud07M5avfPIos2WtIty9xqGlDbvkmagW6dReqOYIk5WBw fij4yNUPNIl35FgxOVZxZAiugfMr5MMXvpYB9fPC1kss27uxeBvv+N3UYem8Hhpf0FYP zojdn545Eq3IHEKKEQXw23no8bv/J6IXHRGTpnsDhQNua52WTW1feCFeIT47ArmNhfGK lrCw== X-Gm-Message-State: APjAAAXmQODTaKBMee85H4tBv0jLQuMLLLCtgCxqBWt74pEJgM5GKn3/ bh0RzyAasHi8k7afDdfcGVkqlyMAJLLak5Rx6DY= X-Received: by 2002:a63:6686:: with SMTP id a128mr5422005pgc.361.1567032978096; Wed, 28 Aug 2019 15:56:18 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:29 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-9-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 08/14] sparc: 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 Acked-by: David S. Miller Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Signed-off-by: Nick Desaulniers --- arch/sparc/include/asm/cache.h | 2 +- arch/sparc/kernel/btext.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/sparc/include/asm/cache.h b/arch/sparc/include/asm/cache.h index dcfd58118c11..9a9effdd01e2 100644 --- a/arch/sparc/include/asm/cache.h +++ b/arch/sparc/include/asm/cache.h @@ -21,6 +21,6 @@ #define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) +#define __read_mostly __section(.data..read_mostly) #endif /* !(_SPARC_CACHE_H) */ diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c index 5869773f3dc4..b2eff8f8f27b 100644 --- a/arch/sparc/kernel/btext.c +++ b/arch/sparc/kernel/btext.c @@ -24,7 +24,7 @@ static void draw_byte_32(unsigned char *bits, unsigned int *base, int rb); static void draw_byte_16(unsigned char *bits, unsigned int *base, int rb); static void draw_byte_8(unsigned char *bits, unsigned int *base, int rb); -#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; 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; From patchwork Wed Aug 28 22:55:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172499 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1395979ily; Wed, 28 Aug 2019 15:56:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5GDYfUedV4Gq5Paginsw2BVIOCW+gxEVfIHRxbk7bvGEvL/ujWhkia7SzaFWb/d+BkTRg X-Received: by 2002:a17:902:b704:: with SMTP id d4mr6941008pls.261.1567032989032; Wed, 28 Aug 2019 15:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032989; cv=none; d=google.com; s=arc-20160816; b=tixBbCgRXCq69anxlpKQqJjyA0ZRxD0UiYsTOGFcpSSMQOCJxmFBLfXIJ4gtGbik7h 1dQ1ihec7EXOgzpVixAVCwQLoxMJZRZPMBq2ZpqYdRwzkywkNU4+tEgexKV3VAiSmOHT PgmiiwewfYtrOLjZRsITHdcHnpF8mfnmqRKtYcVfLnDcf/hw0n0R4kvuWcTlg9wFdT9U 10AKtpieXkHIde7WDO35z3qCVRoBiCSEHFvyeJTh3xHEF8fK5QZgtVlCUj/WjY7BBJhN F25tMrtLdFmJAAKi2wP/iB7TNzp7NtmlbsDuzxLNlwXUG9TltHHf9iwTtVjQd+TGwlVR Nm5Q== 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=tRdkLp5blIPkAjhL3VcWLqU9CGzkwns+t7XttYIchcI=; b=ny4GSUNtKSfkadji1DgXoV1sXaVB9nde8iJQJe4qbwAvHjRNc3WfbiDmWIeV26jH5y XU6vqc3koGNW4vJtz08gZ76LB395S+iReyJAh6yaXm0+wmidUhX1Is3lWDqW1I1GoXn/ f4dP8gBFHH9m1ZpW8cJ/R+bta6aKzNn9yI++x+pNZpvmalHOXJ9qRh3urm8JjYNXt+dG /vRoDhIcxuR/2ZwBJjUSW6P7LnMdeEk6qtvuXajuFig0MiNmLMnKUK9ln2vjbkajADRb hhRc/UXTxckYPm613KeYNnQ26nYdNkMFuFeuKBTU5Z/8qq/+T/vFf+V+fukdQjuA+/7y Fdew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CMVAnmm+; 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 29si360394pgk.306.2019.08.28.15.56.28; Wed, 28 Aug 2019 15:56:29 -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=CMVAnmm+; 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 S1727492AbfH1W41 (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:27 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:53794 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727432AbfH1W4Z (ORCPT ); Wed, 28 Aug 2019 18:56:25 -0400 Received: by mail-pl1-f202.google.com with SMTP id y22so801511plr.20 for ; Wed, 28 Aug 2019 15:56:24 -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=tRdkLp5blIPkAjhL3VcWLqU9CGzkwns+t7XttYIchcI=; b=CMVAnmm+YWw/BIadUY7YkC8sx7aCqztSp28UEVdIAoBP/Db56oZcYwzwqO2lnEiwxy HeMLtZhGYyQIkv8VzXp/1ZoAc0KOiEx25s63pADHK/NT70OynSBYThUHxroz2TMm1IpL 4OlZhZdHoED0+GrWWY9KfbkPon3aclDJJa4vn6vu4wuP7Q6YFcILIJ4JkxR6PJHmKuwW 66wIkcJmowDYRiYd4A8lM+pQRGPmeKsp2m9hUm07nv0DKitnTk2ic9IyXNfR4sdS9c0v UibkgV0Ij7jXR0sDh9icT4PqjlrjUFopN82MmtPfRSnV9hQ+95iec5iGoo3PJyKVAa1w mW3A== 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=tRdkLp5blIPkAjhL3VcWLqU9CGzkwns+t7XttYIchcI=; b=epLGLxsyDB+YkgSAw5UkwlWQpU13Rud74o19oRyE8Oyui5fXKF0ozaJcTLIHP94DXh S2OfccajetRpQ+swdagTniFESj75Zj1XjsdSeJSbsU4Tsmk8+vxz4xjfESIf3cNKMFod qJxU5KR5gzM3B4+807QT1Vva0lio9xrpaLcokRQL5EvtM/w2HMhDNqkUydWWz1Ehd0ef cql9nP/x8K2lONghM7HMinvnHx1ePjFcMM8iR3Zdw0QxLF4VMAN6gEZ0ixn6o5mg/akf TJKoqSoLS7ryubk6KSsMkwp4Oj00rYwmANM3nBcvFoJ4CzVsrlERR2f9fn04NmS2hon2 LySQ== X-Gm-Message-State: APjAAAWDGTc8U6AwTysGLtbOH5JGl5muebKmNl7xFAGQW6u0tX9L3RLr ShVn7eCkfEkvIvzKXKRAvTOGq9vZYWh5NfXMx3Q= X-Received: by 2002:a65:638c:: with SMTP id h12mr5450926pgv.436.1567032983334; Wed, 28 Aug 2019 15:56:23 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:31 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-11-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 10/14] x86: 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 Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- arch/x86/include/asm/cache.h | 2 +- arch/x86/include/asm/intel-mid.h | 2 +- arch/x86/include/asm/iommu_table.h | 5 ++--- arch/x86/include/asm/irqflags.h | 2 +- arch/x86/include/asm/mem_encrypt.h | 2 +- arch/x86/kernel/cpu/cpu.h | 3 +-- 6 files changed, 7 insertions(+), 9 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/arch/x86/include/asm/cache.h b/arch/x86/include/asm/cache.h index abe08690a887..bb9f4bf4ec02 100644 --- a/arch/x86/include/asm/cache.h +++ b/arch/x86/include/asm/cache.h @@ -8,7 +8,7 @@ #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) +#define __read_mostly __section(.data..read_mostly) #define INTERNODE_CACHE_SHIFT CONFIG_X86_INTERNODE_CACHE_SHIFT #define INTERNODE_CACHE_BYTES (1 << INTERNODE_CACHE_SHIFT) diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h index 8e5af119dc2d..f51f04aefe1b 100644 --- a/arch/x86/include/asm/intel-mid.h +++ b/arch/x86/include/asm/intel-mid.h @@ -43,7 +43,7 @@ struct devs_id { #define sfi_device(i) \ static const struct devs_id *const __intel_mid_sfi_##i##_dev __used \ - __attribute__((__section__(".x86_intel_mid_dev.init"))) = &i + __section(.x86_intel_mid_dev.init) = &i /** * struct mid_sd_board_info - template for SD device creation diff --git a/arch/x86/include/asm/iommu_table.h b/arch/x86/include/asm/iommu_table.h index 1fb3fd1a83c2..7d190710eb92 100644 --- a/arch/x86/include/asm/iommu_table.h +++ b/arch/x86/include/asm/iommu_table.h @@ -50,9 +50,8 @@ struct iommu_table_entry { #define __IOMMU_INIT(_detect, _depend, _early_init, _late_init, _finish)\ static const struct iommu_table_entry \ - __iommu_entry_##_detect __used \ - __attribute__ ((unused, __section__(".iommu_table"), \ - aligned((sizeof(void *))))) \ + __iommu_entry_##_detect __used __section(.iommu_table) \ + __aligned((sizeof(void *))) \ = {_detect, _depend, _early_init, _late_init, \ _finish ? IOMMU_FINISH_IF_DETECTED : 0} /* diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h index 8a0e56e1dcc9..68db90bca813 100644 --- a/arch/x86/include/asm/irqflags.h +++ b/arch/x86/include/asm/irqflags.h @@ -9,7 +9,7 @@ #include /* Provide __cpuidle; we can't safely include */ -#define __cpuidle __attribute__((__section__(".cpuidle.text"))) +#define __cpuidle __section(.cpuidle.text) /* * Interrupt control: diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index 0c196c47d621..db2cd3709148 100644 --- a/arch/x86/include/asm/mem_encrypt.h +++ b/arch/x86/include/asm/mem_encrypt.h @@ -50,7 +50,7 @@ void __init mem_encrypt_free_decrypted_mem(void); bool sme_active(void); bool sev_active(void); -#define __bss_decrypted __attribute__((__section__(".bss..decrypted"))) +#define __bss_decrypted __section(.bss..decrypted) #else /* !CONFIG_AMD_MEM_ENCRYPT */ diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h index c0e2407abdd6..7ff9dc41a603 100644 --- a/arch/x86/kernel/cpu/cpu.h +++ b/arch/x86/kernel/cpu/cpu.h @@ -38,8 +38,7 @@ struct _tlb_table { #define cpu_dev_register(cpu_devX) \ static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \ - __attribute__((__section__(".x86_cpu_dev.init"))) = \ - &cpu_devX; + __section(.x86_cpu_dev.init) = &cpu_devX; extern const struct cpu_dev *const __x86_cpu_dev_start[], *const __x86_cpu_dev_end[]; From patchwork Wed Aug 28 22:55:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172500 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1396003ily; Wed, 28 Aug 2019 15:56:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3OBC3pl7ODF+I4914H0AOyO0bXvfDMTRDjcYI7hml/+UAx3EDzPPK1GKVCkQRQ6SYaLAx X-Received: by 2002:aa7:938d:: with SMTP id t13mr7297724pfe.180.1567032990577; Wed, 28 Aug 2019 15:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032990; cv=none; d=google.com; s=arc-20160816; b=LHCza8lMIW0JZGjjlKKX9txXD1A5kUOEqAqKwK9FPbaiaNzMCV7hjKdrQxG4jNYvuQ GXkLdTs/2MiS/NHE5XrBTJgC/Cu8vcjqUzm2jERXb5HhjKIqcxaFFhW0ukH6cOAfK/8p 9mkJOXS/ioyVlG/0dW/LjqRzS7pnN/tMPF+WY6iCrOwZVHKGlqwNJeD99jRPTNUTqYP0 PdlrsY7MT0VlxLz99K66n+I7YhnSPTGkyV39XYT6zOy4yxq1XYFirVcj7qst8Oi41Gk4 CXu9O54d4CehOnDrO22qMBF25K0yD9/+UPKlofBeDSzCPaL0SFtsybjnxyEr9YlePj5W +CWQ== 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=WH4YcJNGldw8lGialETJ/aKYammbyIUszQaJj27lQ9U=; b=auktp7YUGRcZ+YsaeUZ+/7uAw4k6yGrzVdT9XFsm761Zlp1v6po0NrZPTfmfyKXWNP co4tQ74tOK/qBLV0kxHGTT7SejYZ/p3EbJGe+8lOeFRUOaW5kuwGD8YkZAwteDy05Nf1 KcpGZf53fYohoaSO4Oivxyf9WAKzXlXpad6+WCJ1XG7BAi6ZbQRY3WHZnZ9V/b4usQlx x4dWitfsVRXcWnRDBHQ6xhcWELRVCW0sVbaNTSfzuX1s7S76lG4VvL24eFdl9Z5W1Htn z3N10DSl2wDNXKdNf7Hi+SAn5YmSErLruhYHisgMj+9OvSKnfmXtwefHduswNevAS/vI cb0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R04ttarl; 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 29si360394pgk.306.2019.08.28.15.56.30; Wed, 28 Aug 2019 15:56:30 -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=R04ttarl; 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 S1727519AbfH1W43 (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:29 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:50237 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbfH1W41 (ORCPT ); Wed, 28 Aug 2019 18:56:27 -0400 Received: by mail-pf1-f202.google.com with SMTP id b21so845175pfb.17 for ; Wed, 28 Aug 2019 15:56:26 -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=WH4YcJNGldw8lGialETJ/aKYammbyIUszQaJj27lQ9U=; b=R04ttarliq3AU5HEMs+PgjVrPHYJ9wCLxu6WOLrSANpSN/Ghx9wW3fAyo7ejGQCptx PADhzXyMrmVT3btp0uzstj7JM7DzYHXL50hQhMHKO/EZ6HJUWCGDl0DCmav6f2SDQeGv LuFj0sCNJeIvOfGQQ99FrUalx6sy5DbVqj1l/1uiZo1rsewBVYp1wsnsR3kRuiJnRfCL AZWVSWZQsS+E7WmswnOjvygHYBkH0RqxQvQzs6XXcdBHeZ7E3W28gCOmXUGTRYrMfO6p nLOvhDo1nQeTbjJ1SBraZQwONtehxUlKs/Z9CXM2s+o9PNi/xcrDRjSXA0DgNciCCqDG z6qw== 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=WH4YcJNGldw8lGialETJ/aKYammbyIUszQaJj27lQ9U=; b=VUiGQAx5Wt6tu663ERSD0PV9VzGqrLEn3Mxlg0PyhkrhB8d6ntaikeG1q+fYdBGPkT pIN2lDgvr9SXwuoNvsmVGJrOnwDmSprdpt1KCByEgOB6r0e9dhq61mFnHhVRbMgzPLZ3 xJHoP3a6vDQImXk3+2sMgcvogsK+jQB2F9IGTIRoaduVWJUPTX03inbmQIo0Lv0BZyBT NmHMpAE2beGX+pta+TyM3wHRbwkX6IKF+wwrgK0U9n9m0RyIMSdLYR6eP1yR5tIxNS1+ 6wnsK9/l5xLs5yn14qlPqnXQp07eDea5zVXUbrtyfybkOJd5lrnDtLeNuw0tQCANTTPE zQlg== X-Gm-Message-State: APjAAAWlDKkxNij3jL3ZiTVEAcoFd8ZdechJcxeJgM0yyFtvqLnXE47Q pwjVqQLSWdOzHsRLkPC8zGppsSi7oHXCNB5rdpQ= X-Received: by 2002:a63:3dcd:: with SMTP id k196mr5589110pga.45.1567032986002; Wed, 28 Aug 2019 15:56:26 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:32 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-12-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 11/14] include/asm-generic: 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 Acked-by: Naveen N. Rao Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- include/asm-generic/error-injection.h | 2 +- include/asm-generic/kprobes.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/include/asm-generic/error-injection.h b/include/asm-generic/error-injection.h index 95a159a4137f..a593a50b33e3 100644 --- a/include/asm-generic/error-injection.h +++ b/include/asm-generic/error-injection.h @@ -23,7 +23,7 @@ struct error_injection_entry { */ #define ALLOW_ERROR_INJECTION(fname, _etype) \ static struct error_injection_entry __used \ - __attribute__((__section__("_error_injection_whitelist"))) \ + __section(_error_injection_whitelist) \ _eil_addr_##fname = { \ .addr = (unsigned long)fname, \ .etype = EI_ETYPE_##_etype, \ diff --git a/include/asm-generic/kprobes.h b/include/asm-generic/kprobes.h index 4a982089c95c..20d69719270f 100644 --- a/include/asm-generic/kprobes.h +++ b/include/asm-generic/kprobes.h @@ -9,12 +9,11 @@ * by using this macro. */ # define __NOKPROBE_SYMBOL(fname) \ -static unsigned long __used \ - __attribute__((__section__("_kprobe_blacklist"))) \ +static unsigned long __used __section(_kprobe_blacklist) \ _kbl_addr_##fname = (unsigned long)fname; # define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname) /* Use this to forbid a kprobes attach on very low level functions */ -# define __kprobes __attribute__((__section__(".kprobes.text"))) +# define __kprobes __section(.kprobes.text) # define nokprobe_inline __always_inline #else # define NOKPROBE_SYMBOL(fname) From patchwork Wed Aug 28 22:55:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172501 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1396058ily; Wed, 28 Aug 2019 15:56:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBP7s6TDWbXmPxN8rnCqGisb90Z8AFL5HahoEzG0LImk3oTtHT48uAhEgTUkM8bJPuNS96 X-Received: by 2002:a17:902:a58c:: with SMTP id az12mr6904746plb.129.1567032994070; Wed, 28 Aug 2019 15:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032994; cv=none; d=google.com; s=arc-20160816; b=SPlT2qYF9zHffnp/ScUH42f51wwH52OHxeKiq9tUVtoD2Ja2nblFOf/f4DAreWR0CI Ahu8+mX4O99vCqKLe5Q8uY5rdHv81GeV8wphvolvEtKHmtOJgRvdDcFp6cPo5Q4/MSTQ nlt/jM2zZ3vWUhCZGwxWaVjtM/uGQaTSNKyoXIv1vrBxCZbBwUkDN9QHiYYbWdlgmAHk EuwBFzplYqd8JysB7KUrXNWaxlwo606ebDn2n9r7unsEo0BWQpbyCxb3o47T9Ene7rVq s2R+U1b3jEL/MmdgGf8VUGrWXA6588F6+BLoj9SxSmHELfBfpGLcvV7Yassge6A7V74S GoSA== 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=xAknKHqXr0xCfYuKxMybFQP6qX0ULDYjjg9JhyAUNI4=; b=twVroHzlZ/9BVBaBZaevUz73vFtzGAAM5AdyyXGCUYaDjqi/Q8l13K33ycZ4xZup5h aMxFnE2rZiY0ZLqlXpYd7zDskLHU+BURlkFj6tUUHZo21Xmxk1R+Q9gVuh4+wXcIDAOk 7EcCC6L4j5i8ZpaNHPKe6x2Pku+aL47GnXM5DSXjJgcqI+hQVEZ9E1X1GJM13IWOXML2 UdSOjJgbvNdizFdoZSrQjIXuD5B7BnfDIbVL99LMk4xT9cQBFZLQG02Fhehp4eRCY3EY 6IwLlkfHPWwosSHEyowggm37K27q8Y95nsIG6exD5AKqQOnQdDmXbvh5yYtU9ipM6h6m lFGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r9JORaju; 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 72si609176pfx.268.2019.08.28.15.56.33; Wed, 28 Aug 2019 15:56:34 -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=r9JORaju; 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 S1727559AbfH1W4d (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:33 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:46689 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727521AbfH1W4a (ORCPT ); Wed, 28 Aug 2019 18:56:30 -0400 Received: by mail-pf1-f201.google.com with SMTP id g185so853927pfb.13 for ; Wed, 28 Aug 2019 15:56:29 -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=xAknKHqXr0xCfYuKxMybFQP6qX0ULDYjjg9JhyAUNI4=; b=r9JORajusLEPhUbZ/aCElfnTPC6SOGPOzUW205APcHa8WSO2eLR3RwkNsx1f28w8Do qfJMIBpd44p6DGLZSywA7wRF1cXcN5pWJ6s19xSuN29K6qUWJy5P4t32xR3q6Y6y/kbv yRt5riE7/WDyBtMCOrT6V0BF1izIKQ4rwqXsWGy6s9ySO3eSjo0pWXE8sJ5CO/zuK+Ct wyRaMwlxf9w7J1LChppWxqZgozB55v+OKfeKU6i0lucLfyp0zcuQSWjLu/CNKd3yg7jI ahGPGIS4SDQRtrBJGHUvfnGf1gSmJUH23PohDPiuUm9vp4JpKgqaMm9fNMyw5n6q0aFi t1qg== 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=xAknKHqXr0xCfYuKxMybFQP6qX0ULDYjjg9JhyAUNI4=; b=DmwkWP8vao9iMy9EulqoKMFC4Gu//UW2NeBviwWQ98nSGhllhMLR7GCweSUeqnZDCg pAh9mghPzi4FUcTqh+uBedpejGGXjDwyGjGEVO/KFzrz0zaiE7J/5iNYem7wPCvZtL5G /YWLU9BuTH02Ha7fj/24kbRY1WOKB2iqDt8nnTI+ic5F7iTrMlYbGZm1seyidDLbBaJl PhmdUwcQfzMfmFabyNrLwKWpt8Q3/P2KdOPRZo19T6zTLwb0VVDBESdCfk4GirjoP6PW V9d1cBwxFdPyWhxntX0o/+TFo4uL96vfIxWUZpk/ok/VdVmBrb+XeN4D6KkR5+omaCa5 sTyA== X-Gm-Message-State: APjAAAUtNDmpIiz4MPl8qXaHvQgH/0kjx0MuaicuF8RUlL1UuCwk5+u5 FBYu9syPBkupm7KVfrQMrdUrhOgO6JpGShBUt9U= X-Received: by 2002:a63:f04:: with SMTP id e4mr5384375pgl.38.1567032988724; Wed, 28 Aug 2019 15:56:28 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:33 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-13-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 12/14] include/linux: 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 Acked-by: Will Deacon Reported-by: Sedat Dilek Suggested-by: Josh Poimboeuf Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- include/linux/cache.h | 6 +++--- include/linux/cpu.h | 2 +- include/linux/export.h | 2 +- include/linux/init_task.h | 4 ++-- include/linux/interrupt.h | 5 ++--- include/linux/sched/debug.h | 2 +- include/linux/srcutree.h | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/include/linux/cache.h b/include/linux/cache.h index 750621e41d1c..3f4df9eef1e1 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h @@ -28,7 +28,7 @@ * but may get written to during init, so can't live in .rodata (via "const"). */ #ifndef __ro_after_init -#define __ro_after_init __attribute__((__section__(".data..ro_after_init"))) +#define __ro_after_init __section(.data..ro_after_init) #endif #ifndef ____cacheline_aligned @@ -45,8 +45,8 @@ #ifndef __cacheline_aligned #define __cacheline_aligned \ - __attribute__((__aligned__(SMP_CACHE_BYTES), \ - __section__(".data..cacheline_aligned"))) + __aligned(SMP_CACHE_BYTES) \ + __section(.data..cacheline_aligned) #endif /* __cacheline_aligned */ #ifndef __cacheline_aligned_in_smp diff --git a/include/linux/cpu.h b/include/linux/cpu.h index fcb1386bb0d4..186bbd79d6ce 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -166,7 +166,7 @@ void cpu_startup_entry(enum cpuhp_state state); void cpu_idle_poll_ctrl(bool enable); /* Attach to any functions which should be considered cpuidle. */ -#define __cpuidle __attribute__((__section__(".cpuidle.text"))) +#define __cpuidle __section(.cpuidle.text) bool cpu_in_idle(unsigned long pc); diff --git a/include/linux/export.h b/include/linux/export.h index fd8711ed9ac4..808c1a0c2ef9 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -104,7 +104,7 @@ struct kernel_symbol { * discarded in the final link stage. */ #define __ksym_marker(sym) \ - static int __ksym_marker_##sym[0] __section(".discard.ksym") __used + static int __ksym_marker_##sym[0] __section(.discard.ksym) __used #define __EXPORT_SYMBOL(sym, sec) \ __ksym_marker(sym); \ diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 6049baa5b8bc..50139505da34 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -51,12 +51,12 @@ extern struct cred init_cred; /* Attach to the init_task data structure for proper alignment */ #ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK -#define __init_task_data __attribute__((__section__(".data..init_task"))) +#define __init_task_data __section(.data..init_task) #else #define __init_task_data /**/ #endif /* Attach to the thread_info data structure for proper alignment */ -#define __init_thread_info __attribute__((__section__(".data..init_thread_info"))) +#define __init_thread_info __section(.data..init_thread_info) #endif diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 5b8328a99b2a..29debfe4dd0f 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -741,8 +741,7 @@ extern int arch_early_irq_init(void); /* * We want to know which function is an entrypoint of a hardirq or a softirq. */ -#define __irq_entry __attribute__((__section__(".irqentry.text"))) -#define __softirq_entry \ - __attribute__((__section__(".softirqentry.text"))) +#define __irq_entry __section(.irqentry.text) +#define __softirq_entry __section(.softirqentry.text) #endif diff --git a/include/linux/sched/debug.h b/include/linux/sched/debug.h index 95fb9e025247..e17b66221fdd 100644 --- a/include/linux/sched/debug.h +++ b/include/linux/sched/debug.h @@ -42,7 +42,7 @@ extern void proc_sched_set_task(struct task_struct *p); #endif /* Attach to any functions which should be ignored in wchan output. */ -#define __sched __attribute__((__section__(".sched.text"))) +#define __sched __section(.sched.text) /* Linker adds these: start and end of __sched functions */ extern char __sched_text_start[], __sched_text_end[]; diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 9cfcc8a756ae..9de652f4e1bd 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -124,7 +124,7 @@ struct srcu_struct { # define __DEFINE_SRCU(name, is_static) \ is_static struct srcu_struct name; \ struct srcu_struct * const __srcu_struct_##name \ - __section("___srcu_struct_ptrs") = &name + __section(___srcu_struct_ptrs) = &name #else # define __DEFINE_SRCU(name, is_static) \ static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data); \ From patchwork Wed Aug 28 22:55:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172503 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1396147ily; Wed, 28 Aug 2019 15:56:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwS4rkffFusa2rSmuXQgEfJSHwmQsBzacI7a9/kvHyJCC6aBL0N5dny1MOslPhvL5Q5gD/D X-Received: by 2002:aa7:96dc:: with SMTP id h28mr7585613pfq.86.1567033001104; Wed, 28 Aug 2019 15:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567033001; cv=none; d=google.com; s=arc-20160816; b=D5XsVJxnvumvU+o0KPgb1XA7Kj7hrqki8HlU0iaWnUzpw9TLUBngYlJFWs5BfjeGu7 KtnH1LZpH1eUTsb3hSzi15pnpXus/NC0PLn/wk4s4s3TGPhDU5vTiADGcL+3/1gsl93I njoORTld/rqxB1rwrpRdCqPwU295+WvdoxyfM7wkJQKbEh8R720teYT6PGGq6jz8QX6p vWJki5IxM8PqPnmv1kDqZMpYRG5mwqzet/LV3RrWodn17qOaDBp2tE/jcZa57Vf77u8f djRsfsVEa8RoLC6UvOM6p2Q9QlOp0szgpY1WCKLl09LlLsiRqfwKo+PjCjJ0iPC3BkSY fJpg== 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=6RxBbYYa4fUI8s5OPNOU3iQ7zoV1TR03oRwDSBMZl1U=; b=I2dySUCSkfDL9t8DLzEtVzBuenK5iRWOo/wtmRyf+1nHWGf6eXPspGOqOicg951YPD 8mLCWUw9Rr+USDmVblriqKCgjlDPMlaUKxe284jtT9XZg+h8mIpUriPJMzSyN8Bj8bsC aLhQ4c9uN+1pIFZSs7Ncds1m5ZBVfam2K5yrB8tmpJdRxMu6xJUj4KknUivwrtWDqMIC mIVH3TU92tUCrUmQ/ZxMPWWWFpNCb3FdljRanZ0bcx/qZ+EUbE8e3roOZ0drSTxD+I+2 D3bt0JK4/J/GO5t9cQfGzRBVtFeIVITGQCE6fpRaors9nlJU8EjimPf7Pz8hiprflw0S dCgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dI5spwXf; 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 v10si277494pls.249.2019.08.28.15.56.40; Wed, 28 Aug 2019 15:56:41 -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=dI5spwXf; 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 S1727595AbfH1W4g (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:36 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:55918 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727548AbfH1W4c (ORCPT ); Wed, 28 Aug 2019 18:56:32 -0400 Received: by mail-pl1-f202.google.com with SMTP id u24so799442plq.22 for ; Wed, 28 Aug 2019 15:56:32 -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=6RxBbYYa4fUI8s5OPNOU3iQ7zoV1TR03oRwDSBMZl1U=; b=dI5spwXfZwaXJJJGLP+3s8pi+5tH9oLSVIATkx/9S9KRLM4d/SJVbeZw2cXMYwOIX3 Qq/g0LsfcXBc59m1se1ALpG7EdbIT5JaZsXxknVsPyMZMJMDwGHUwgCv77YcNpK8yb1a ujquOoWvY1DTAzk0gFMvYqSU7mDnsNE6eaEZATK5/UeecBMbmWjgVmL54sX8RkMDhmuv K95INy/7EQxWckULbQEtulTM7A3q/enbJaBcASsxRB+zUC3lYQTtDMUWhfYb/Qv/ex3y MnmcqCFalt+80IQsKRLmQpIOjwVqi4hI3NhRi5neRP0SmvoQ8TGcM+TKJvDNxKW4C4wY cyFg== 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=6RxBbYYa4fUI8s5OPNOU3iQ7zoV1TR03oRwDSBMZl1U=; b=CR6CP868OfTudDtF4yeZ19Oaa2VYPNPuD7idAy0yTYmMblVr5KA3o+yT9xuYwcLuTw hDrvMW9+f9WE0VELsIlUBKGeBUAYN6MQcVleLIl/o/R0pvEoj/x8/Evf7lcY+gn9VwBX wpFJ35jWXDXYmdmg2z37E5zqfNmhA3fa296hOgdAJB5VZozImvUhLzyGD+QgWHwTqzY1 3P27Ys9VWLs4J4p5ClRYOWvVC6XgPpfxgdxh1VtA9s/gfNsvhBeKOk12Va13fzAD6l++ FOSi0z1FsWfJ/VFZy52PrRaKiGI7YZ5ahJwfj6eFTRQ4G1HdVWMBmNlH9C/3dGAAGD3k aNmg== X-Gm-Message-State: APjAAAXvCKVXlXXS1xlPkfTuVZUAETAMdzToFSTdyk5EG6zTBiwkjeCE r9SQTlfHAnt8RdbncSjYZqCkpGUDxqiVA1m7Src= X-Received: by 2002:a63:31cc:: with SMTP id x195mr5459002pgx.147.1567032991282; Wed, 28 Aug 2019 15:56:31 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:34 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-14-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 13/14] include/linux/compiler.h: remove unused KENTRY macro 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 This macro is not used throughout the kernel. Delete it rather than update the __section to be a fully spelled out __attribute__((__section__())) to avoid https://bugs.llvm.org/show_bug.cgi?id=42950. Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- include/linux/compiler.h | 23 ----------------------- 1 file changed, 23 deletions(-) -- 2.23.0.187.g17f5b7556c-goog diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 5e88e7e33abe..f01c1e527f85 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -136,29 +136,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, } while (0) #endif -/* - * KENTRY - kernel entry point - * This can be used to annotate symbols (functions or data) that are used - * without their linker symbol being referenced explicitly. For example, - * interrupt vector handlers, or functions in the kernel image that are found - * programatically. - * - * Not required for symbols exported with EXPORT_SYMBOL, or initcalls. Those - * are handled in their own way (with KEEP() in linker scripts). - * - * KENTRY can be avoided if the symbols in question are marked as KEEP() in the - * linker script. For example an architecture could KEEP() its entire - * boot/exception vector code rather than annotate each function and data. - */ -#ifndef KENTRY -# define KENTRY(sym) \ - extern typeof(sym) sym; \ - static const unsigned long __kentry_##sym \ - __used \ - __section("___kentry" "+" #sym ) \ - = (unsigned long)&sym; -#endif - #ifndef RELOC_HIDE # define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ From patchwork Wed Aug 28 22:55:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172502 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1396114ily; Wed, 28 Aug 2019 15:56:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaY8ixhp32r2vMeqRp6xrpeZVzG4Hhxh1s18TELKgu1pBtVM4CmR7fOmNUNase1/NTQZYI X-Received: by 2002:a17:902:a58c:: with SMTP id az12mr6904951plb.129.1567032998346; Wed, 28 Aug 2019 15:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567032998; cv=none; d=google.com; s=arc-20160816; b=X1+9YMTLJr32A6tQP99p9fzlt/MtNENAF9ELDhAa5vua5QWl/WqiVONqMalY8B1trF C1Q5JUVU3SQ6+BJAK5hLkRDSne+1PKL+nplGvjwMxYv1NSaaEjDz2LuDX9+XjQVV2+KQ 3SD1vKVt6m7W5AVB+1q4Can/ewVAvEsYa2L71bRMbCuaY3tmwwCCWiwWhHxcsVfkLAqY ZjSLESSd7WO/e3hS6mVrzUh9eM0QKdyDX9YNwxSMbLC7HbE8PKeV//mdyKnc/VZJQWno Vps75ea6Ro8Z4G6ez4oYBO0+Y6ZcZ8mk5D/plBV/9ql/u2hoxPxfMNG/ohFdX83G+2Fm o4MA== 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=LzcRbLdLn8n10++XwDQc5vyYA3PF12gHibA7BtY6a0Q=; b=kyAoFCy0Ti5rVIBXzjKxb+CTAOiFMqrxm2RbKuAwf8egKEZadlUNFIwXGiRWkAXmj2 QFk2vxEreJTraBepwA/6t5BfNZWo3NDzpOgQMexIr50w0x5AW0eR4z5aRECVYOzoP35A dA1lUMXwOXHhLLfJtLw0NXlrWjp2JCLGxPYwLhOYl2zX6wvkZh3jOvG0+46A5TUlq/YQ NVIQd0Eyvj0UTM4QDCuWV6y8y79/Xy9DRPqjmazxjwhxIu2brSgJQRklvWiS+w/lVC7P HnEyFgGc/Q6wQK9HvrXqlEHKxOrJ9cvmXaB4l03DmNBbsg1MmL/lFN3ze/r5jj7bZo8O 3FTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=K8RHoPgM; 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 72si609176pfx.268.2019.08.28.15.56.38; Wed, 28 Aug 2019 15:56:38 -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=K8RHoPgM; 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 S1727635AbfH1W4h (ORCPT + 28 others); Wed, 28 Aug 2019 18:56:37 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:39731 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727521AbfH1W4e (ORCPT ); Wed, 28 Aug 2019 18:56:34 -0400 Received: by mail-qt1-f201.google.com with SMTP id z15so1409081qtq.6 for ; Wed, 28 Aug 2019 15:56:34 -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=LzcRbLdLn8n10++XwDQc5vyYA3PF12gHibA7BtY6a0Q=; b=K8RHoPgM+mJAwqXlvEcSR/kuV73Nvjs0NviMvA+6/v0063urVipIsN+d8mlpENBRzA AIukuHkBYMxwEyNRQHbmPq/nktcLZUEzaTIHtmSEaLFMToKN8Bxjr+nWG4R2tJ/LnYOt 9n/pUgMBMpf76Jt7D0dXCQVThxHNybR+6+omky9JLxGLVpYxP/GO535I3f3GaQzlOCj1 pSVTjTbhZVosKLfoak/7Vdf4TFkOQCAFvrWNPlLcI0gT+Q0otmxwA3geurBCbjcyHt3S h/BlerhzfZusOFatfX7QUJX5mAIdGff06HBCjzEfOmhXm4JitbWIVjIz8ABXnaCNrW7S /Mag== 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=LzcRbLdLn8n10++XwDQc5vyYA3PF12gHibA7BtY6a0Q=; b=GAXtC+k4Qfx+gQqAEi+VgCVUCxah0l8DBzCyc7uTQJGOD/8YuacNxTJliAQZC3n4N7 Ctj3Tn7MYHFT3pU8zPbOJXz2kAKAlusRUkIjW0HmsVdYBragwY8dLn+KMbtnqbNxrnIt 8A+D7cn4hBglHxCcqebZraXX2skVubP+ic3EpOnpeYp3OS6xbV4Qb7xZMjLW2vsS2vGO gkzlpox7zFpD5Be/ygBw5ztQ6P/ddMzK5Qhajw6abwb0MWbxFFdzKcB8C/RjW45uQMOP thwQcJFeq7jvEnzkGgiBf7oe0y0Mi1pd94q3t5C+OW+uev5WtTFRqkF5JjRrCnKA9nho oX+w== X-Gm-Message-State: APjAAAXTSXDZwbiqc2IglyJgG72QcQOmPrKOT6bkA2lTp3lk2o4ZGk5i DTzPWWQdv8M+QZRz6Da4FZxY2gcaQYqM1Oeb4/Q= X-Received: by 2002:a05:620a:130d:: with SMTP id o13mr6782091qkj.285.1567032993987; Wed, 28 Aug 2019 15:56:33 -0700 (PDT) Date: Wed, 28 Aug 2019 15:55:35 -0700 In-Reply-To: <20190828225535.49592-1-ndesaulniers@google.com> Message-Id: <20190828225535.49592-15-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 14/14] compiler_attributes.h: add note about __section 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 Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers --- include/linux/compiler_attributes.h | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.23.0.187.g17f5b7556c-goog 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