From patchwork Tue Aug 27 20:39:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172292 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308107ily; Tue, 27 Aug 2019 13:40:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwULwXRcRUvTieTvbyJf/ssRgEH/SWeWamx7l+6pRMXMpzSefKZfUT15fefKYtxK1lPYbAQ X-Received: by 2002:a17:902:26b:: with SMTP id 98mr809142plc.61.1566938430213; Tue, 27 Aug 2019 13:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938430; cv=none; d=google.com; s=arc-20160816; b=pt2bWThU822ZYyoYzH9zLiBpnM3RrMH2zpaVAjF0rlyXSXpIMSVZsoTsiUWsazEB+G wcR9V/htqRaKSLrN6UHT4cdTWtbAgk3zFvkxGA0YrYUuAeWCbH0I5cqt61gHUASkf9OJ K55B+qgbkXaT1rnz4CSiWMMg8rKtuUpEBYy1f/HyfOiTtCZ0MjnTSztHBtFhLm4w8Y6H yCVikQwcNDT7ZOF79zW2bT95IUOHcP9sdHLDP03ASHGjWWOkcQXns8HV5qNxr14wpPz9 rPbsheg/x8gPSQphC/t6RuPLUXsKbMGMifUAjC4WbBJWzXvt8F5sPupRHFq4eyeMlZSI OOSA== 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=J7Ohnds+A9ovXQdZzadUakafh+P4fUUaEWG9NoT89Rg=; b=Q8mVOYZ8Z+LQFEBLcv/ETeIH70ltoYV5xDZ/5NsVNy7Y8b7W+pKpHdbN7YzB6GFZ7Q 6Th/ZJos4hivlXBF6mg614TbQEwYDKCzD4tEeQ64NBaet4vSWHTXovAuI6ziZ75WRDQ5 +UJ7sAv2/E8cbsuf5O93Xf/H/dmQfZLz+BoFtHsz43SfRND1NPnk2pmxOCegWtU5BzA7 BRul7U6ukGbkKI7Y9XiSlFfb0UHMjjrWrz9Wbp5lM/BCJ+GsWSyXBBL1msFuynXNmBt/ hk90SoSSbwR8oiIHs6O2sIV7HHSqs/fHWFW6hsP1nzznVHPDyHxFDV2I0cgUycKKyDOV +hZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=thwZre+v; 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 m17si307343pgg.539.2019.08.27.13.40.29; Tue, 27 Aug 2019 13:40: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=thwZre+v; 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 S1730518AbfH0Uk2 (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:28 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:45267 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbfH0Uk2 (ORCPT ); Tue, 27 Aug 2019 16:40:28 -0400 Received: by mail-vk1-f202.google.com with SMTP id c65so223547vkg.12 for ; Tue, 27 Aug 2019 13:40:27 -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=J7Ohnds+A9ovXQdZzadUakafh+P4fUUaEWG9NoT89Rg=; b=thwZre+vfdeUyR0h7L2yCKuWA2znWIDH+Bw7v7hNIdznHaTRSi2dsWr3wHsdxO5p2G 4gap3akaSI0XfBlo7jufAwxKZ3gFY2xTQhQtb2CtE3fSc4QSPbWt1num9gjZ2SJN9rwk zgs7mEYf1ClluXfrZ+VWcTZvq+mWam6tr+IG43JjpG4tILrmVPlYYsE0Z23N1CRi2r1T pbZ/Q/odS6M9ZxhTIXoh6xKlSJyoNhrnudn7/X0TKXw+A0wazeC0JR/4VrTlrriCrZA1 Vd2mTJjsENlTw4i9LHws9DWjxcQe9KdUbgidIcVOsTZWkhX74cfLGNcDbbXeEjlfha9D dd1g== 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=J7Ohnds+A9ovXQdZzadUakafh+P4fUUaEWG9NoT89Rg=; b=NTR1L0m3zjJn6iqxeawFxc42fxLlfSahJLpyiM77BPLTW9fUdITRQpQVkLih3szRVy Veg8VtEmQGVs0rdRV6QpRgbi54ovY+zQ59Lbr2TksqEg1v94UF+qwAHCbTB6MSkJyc25 +1Z3nk3fk8RAwS7Y4cK7vM/E6lUZy9nprl87yeGXYIWLl6CHtmTp669Nv/LKVoZ/0+gc h0A6y3Yknsm5oynWZtIUgy5i9uacAFMcENB9LlMYkNnHt3c6QGpYkDVLWcav2xEY49P8 bE5003k3rNNzhXc1MsBVy0sRJhbHogYatVK6+tPMzoebjbfvBCMVK8FF0DghDk8rUPFM h+iw== X-Gm-Message-State: APjAAAVED0ET97wwox/hrq0ZoRjuKzqlqD1JbeiyeeECr+d2lrxFuFT/ DhURFWSKOTpKrwRxrk+6vZxY6+e1D3IMmGvaY/g= X-Received: by 2002:a1f:fc0a:: with SMTP id a10mr437887vki.21.1566938426805; Tue, 27 Aug 2019 13:40:26 -0700 (PDT) Date: Tue, 27 Aug 2019 13:39:54 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-2-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 01/14] s390/boot: perfer __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 antipattern was found with: $ grep -e __section\(\" -e __section__\(\" -r 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 Tue Aug 27 20:39:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172294 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308260ily; Tue, 27 Aug 2019 13:40:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyd3y4M3EL9+GMOOqboFUzcNtokUK2msBuDfpSgUY8Q8rak+MK1W5dR3dWAQFaVDDiryBYb X-Received: by 2002:a17:90a:234f:: with SMTP id f73mr642437pje.130.1566938438334; Tue, 27 Aug 2019 13:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938438; cv=none; d=google.com; s=arc-20160816; b=TFx6hqXpNlvFVOEb7pmORLIaUYS1dfblx2qhOpCqvJmD7Eo2EnG9Bg+jDKYVbLAS2X WXAL+Fl6vzu9nutMdWtvyYGW2WWJ+Nfm7oaxEeJLi4mj2bDE4hop2IbgIkewKy5V80Ta OJ2CKhgpDBF1Fwgj8H2I7PyEQ9ZRXJr5Bu0jvLch9NeG9GntI210/PoPEZcPCtWfbxnO WiC7zgU2W5WB4kP5ZVbs/nkoDSWo+3I/Breb/ouVOgmSjT+GkguSOF0OE8WST+BBLKEA q7p9+17ksngQfHbFAAAHJGDCpsNV7tiQl9t/jK8Ti95fDePBhE32pVPcrGOC9VXV4v1a AgLA== 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=pMRR3udv7zUt55udgy/JnJSChNtnGj7LBE8r938k6XI=; b=rb1MdIG75r6UmSl8q9b6xw1qOBcajo/SElIMUs92JO1DMiiDJ/TBk8753eq30YVeVj xuoEmG0PpZ846RJwKTn8NkmI9EmU3RYMWhSoukq1UzfPmdPJELmJAZMdZ08TBAfJuJTf niwiRCEyIy6ebrq09jaTx1/12TAaTvDleU7PaAv144hZbdBWXcO+Ib6UsFRll+bBEe1b hpyRr1eP1y2n+IzGWBwiXLEjr36Hn5PITCcFZjKVsWFpS+sctUC8MkBruO1U/vJozeXW J0OsFd0HRmxIW2VT2zih0JtyehvBqfY20IwdM9sOue5rWgMDI5kvxf9sMPDgoKaepALc 5oMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=udtjEyCD; 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 q24si124056pls.7.2019.08.27.13.40.38; Tue, 27 Aug 2019 13:40: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=udtjEyCD; 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 S1730622AbfH0Ukh (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:37 -0400 Received: from mail-pl1-f201.google.com ([209.85.214.201]:45204 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730523AbfH0Ukg (ORCPT ); Tue, 27 Aug 2019 16:40:36 -0400 Received: by mail-pl1-f201.google.com with SMTP id c14so197621plo.12 for ; Tue, 27 Aug 2019 13:40:35 -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=pMRR3udv7zUt55udgy/JnJSChNtnGj7LBE8r938k6XI=; b=udtjEyCDVwYq/FK3kBeTb3nH8Aa7vL9kuHCFwllx1BaX/30WXSHx6kZYDXQ7Q+voCO cK/gu8GvhtQ36YbkCBbyMFDS1/DLu+qYijMvJFH5APSWGaS9EoRiWUmfTTs102uoutds WrWXfIy8nJf3Io7Dsmrfo+DF6TzSDatNANOWeaTRc/PeYESbP6O8Q+9MAl2oE+eUuyDM WLi/k40Mz/YxM3rUzFk/5JdQBAbl2nlbxiaysh8/ku9XqHmQQbMIxCss2j9KNXL3dwjt nwDrCze8E57svT2Qpwd05NkuaR8T0Wd8XQuXchUbZ/yUTKgxjwXeph5z5nP+k6Akieyr Ot6w== 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=pMRR3udv7zUt55udgy/JnJSChNtnGj7LBE8r938k6XI=; b=pM64XVsj4hCueTErparp360gQ0EjOajShVPzIeUcmjt5RHkF2szFPFS88mX9hj2GiB g4G8eMH7maCwFwWzuUDz4AIFURbUBaP4uIXHvifnKfVP/AsB3lwKb4vBPCR0/wTTjoCX rvOU7iZAR5SlhWysfsm1yNkbt7zghaUvFYxUT+XCuJE3743uqC39P+m+3tPJJj6JWtzp nwghEYHzOXXcQM9HVmWYtWDFN7AJ8F5sUdxIATqbpNx4IxQX61geASyqQf1sQDa0zegn 15Mclag2qHXde/aGYxPEQ48eBggUeYPatO29ZfXkoyjfoVaC+ia/oYxvAc4vEu7krxtW SgDg== X-Gm-Message-State: APjAAAVO/pG7nSavXQw6/qSXKbPOeV/8Ey0/t0Je1QWclyM+H6f2nXBl osfZKROBaIvoSG7tk0/b6d6kvSJO+/hL0VyfoWY= X-Received: by 2002:a65:6152:: with SMTP id o18mr255957pgv.279.1566938435091; Tue, 27 Aug 2019 13:40:35 -0700 (PDT) Date: Tue, 27 Aug 2019 13:39:56 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-4-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:39:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172295 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308340ily; Tue, 27 Aug 2019 13:40:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0QUv1zWvWFPCdNTJsKEau2NVPlTdMKW8Tnp08MORVaa+al83pG+jl67dxEwiW9M0FQJ9e X-Received: by 2002:aa7:938d:: with SMTP id t13mr412935pfe.180.1566938442303; Tue, 27 Aug 2019 13:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938442; cv=none; d=google.com; s=arc-20160816; b=vfbMd86AtSHUiwKk8qUUSj6ZZpma/6+9mf8SKjCXtAc6mdvIRYc+XWBATWosDa6X/p H3+Snucc7xOYyUZZbjlnMP6bLqUsEt8j3xWgLOzvU7O30vhsgMRHHBZBxM02jifkRIM3 0rhJQtoOnkmyHOjLGXtbKiKrvpYOfvEazb5HwK+HsFhg4g9jAj9FyEd6kUYGZhUdlEPK sjA4KU2yctPVhKqpDOjNLlwISWmXIdVvVAyMlz5F7iffigQMN7fEEXp+IpgPN6HvkRzW +H1p5vXElhfVEu47WUApLEzqFkOmdiZ944eUTwLhc2fa9INtoS1cpHcgmcb74fCuZdH1 c0Ng== 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=gDvIlxNr8TEoF4pbaoMLzWxO2r6ObQp6ll/9rTpnRHw=; b=GuJky42tmGRP+HITU1tAnsyhL7O7OZk8Rxhgi9/lC11TIbZYlCkrcM0oE8b4y9WKLb WYNGR7qqWZjeS85SvzKeV26qhjVV072ur2lrfvTyQ6+9Sl9+Y9qcKq+xak/xf+uUtbcL feWsjARDKeZ4fo36sAeCMFjzI2F//OeqyJg72oHitz3LprtYBzlukfar8tmgVKPWM9DA WaacbO4Ol0qA6Ixc1A1rAzUOp1GcpGDWut1rKPOINcD4Q0GgQwDN3RTDNoZeOf4QZ8kS WFME7tZur9anl7j61+Nv5yzFqN05J1UN0BHcOdhZKmQ+kzO/bKsMLRUGdIRwuZMt2edm ExCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YMViHd8L; 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 14si339627pgy.255.2019.08.27.13.40.41; Tue, 27 Aug 2019 13:40:42 -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=YMViHd8L; 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 S1730645AbfH0Ukl (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:41 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:34189 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730221AbfH0Ukk (ORCPT ); Tue, 27 Aug 2019 16:40:40 -0400 Received: by mail-pl1-f202.google.com with SMTP id b68so120719plb.1 for ; Tue, 27 Aug 2019 13:40:40 -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=gDvIlxNr8TEoF4pbaoMLzWxO2r6ObQp6ll/9rTpnRHw=; b=YMViHd8LC0GbZNZVHrKmW6KGyH8quBNuS8Pd9Rx0mYImtdtmRm11fcVFLOyS+o1alx an6UcEqmkeG61I+R9JbATD3nT2oVNcjm5c8KEP/j08Q7d/tThlh5dRDnV7mVA69wTzf+ T83H0JxAGEA8fRpmAUdYzTEAof+ptRtRDlSpyhdM7SkZ/B84by8Ja21bEDnL9X8T0Q38 gGp4mxDePqRYjm1p/8awzKlrZMt59cfsc8kt7W05WMIyYkCVX9/KU9CfVrXB3QTx8a2s u0nUoOevdadoG6YMEi5JGpAuwax1DoDMUWoi7CzuC8wTI8ziJg3abKGjAgnjKOxGifUH JBNQ== 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=gDvIlxNr8TEoF4pbaoMLzWxO2r6ObQp6ll/9rTpnRHw=; b=HQwBOA/pYrw0oyErzZXO3iiauLDahwQJ5RL5oNUTzGb1Cwsm9iWYYb1i4XevECZtIb Rwp3JB2CuxGejGc9b9tb9jzwnKZHs5Jeo8dZRIGRAc1pNoDDcskFSEuwAKrq8Igh/+zw qWXv4CEtFwlp3KmwLiY4EGGrVxbq4rYN7z6EO7eVAX04iKwMfO44r7jthVXXYWyoL8TX om6pIwEmtv1f1zyjBUg2ulq70mNLV460GP+ijKMLYNTfQAFixsRP9v6IIrbam9a6XwEd S6KOlmasB8KDcbchCmG+GTWXAvgC1CO9yu19CEqRT+CkEsuqtUF3iJ1q1b6ra4sZzr+B 8KPA== X-Gm-Message-State: APjAAAVDMFwiXx1d0sCf0dpIZD7kIwzTsWQM5EFe7uvEOLHKDy8o6Q8H hIL8FJWEGQ8LUq/0cj8I3SrNgRfQ0F2IoCrvGh8= X-Received: by 2002:a63:9e56:: with SMTP id r22mr265817pgo.221.1566938439399; Tue, 27 Aug 2019 13:40:39 -0700 (PDT) Date: Tue, 27 Aug 2019 13:39:57 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-5-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:39:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172296 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308415ily; Tue, 27 Aug 2019 13:40:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVv4ZSsVl9sZXHbEQ2GVSMx4n7EYseEh4ulkc7Jvw5SoA8uoq0Sg322QHcHKKyTZxVqmVy X-Received: by 2002:a17:90a:f0c9:: with SMTP id fa9mr590888pjb.137.1566938446499; Tue, 27 Aug 2019 13:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938446; cv=none; d=google.com; s=arc-20160816; b=tCRykB4opntytec4U2aaAfWrdXHOLXJeDBOX6pnYugjs9eGoK/rigsfhdOWEdFakU9 v4234souAQdIIiR9w9mRjIny+TYi255Hqmvs/WNORJBDrlD19mpkUgUMHPs6A1moC0cA GsRou+M6L+nTQNvYqetl9JB2cM8sLPfjqhfGgKEP1m3KiFGJcTdpu6HWNYfCg7kzYTHl RG62DbU0G7iaBCC9Y7CHrcZC6S0yAn1hCm68iRuwMkK6mbb3I4L2wXwXnBDKcr/vBPzf us3GkEfRn7Hwwqc1wQTPQBLkAdwc5/MPUDA23PAPkv27/4Ef5nyKcr6dQowoAOqrPM9j hl6A== 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=tH7yiZ4DL/IkimFAxsXUYbqZ+IlrPZSmhVaW+hn/z/8=; b=H5WYPoWs9EGXjBhgPxpmDK1nbHu3KOURASjVcaFwoEs30QqSlYV+d50PQe/8UvlmkT Xnk+zJ+PB631K7LVQ8uZGsf5EE36QH4ztZYmi8wXWtYwU3pGjZhr90rRw7yqUmh4NJlX 0HfRox4U9XuHmkoGa9VjyV/7pjlxk2jt4QRHw/pkfmNzEbddXB/qIzlGeNbne4aqPeFw 6/N6RBmEUHZuJ6tf5L9APGHN5q2ZSLO7yARGXSikgB8PBuc2GnBNu3kfJCLtOBzowqdg Wdpn+mDY9oNjd7mtZfj40morncLwj8XhAP9YzfXfbG+YZ5zZy5NOyS1P3YV8ei/q1ThH pqFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=n0LdiSdO; 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 14si339627pgy.255.2019.08.27.13.40.45; Tue, 27 Aug 2019 13:40:46 -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=n0LdiSdO; 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 S1730674AbfH0Uko (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:44 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:55802 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730221AbfH0Ukn (ORCPT ); Tue, 27 Aug 2019 16:40:43 -0400 Received: by mail-qt1-f202.google.com with SMTP id z93so129721qtc.22 for ; Tue, 27 Aug 2019 13:40:42 -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=tH7yiZ4DL/IkimFAxsXUYbqZ+IlrPZSmhVaW+hn/z/8=; b=n0LdiSdOzXuRJngcIMltgwmxzEdvOm/U2iaaJkJ5SMyebx7xgAPC0fWRUGoaPlgEDm i2Kq7YcvAIGN+5tZsRlDY7cKjJz0WNsjEZrj1G4PT5xk9M9urqOw/otYjBC1XO4LFkKF 6BVIAhu27ZTRv5fu9QWEkkLqlSFbBSKXJhno3wD+XQvnW7oduaHsf7AxHJjI5zoue+CU kqp6BK40i8JQOEqSbp72KhHSCfJwrlweqQyf1rFOGeeEKZn7nHPE+ykpQ8cVpru4Tpn9 i41OZfOBoEZH0a/ZbskqZJf4yazbh71/OPAPdM9voiUphvh7/Xt5YjE2JDzhEGBgCTnX 6+uw== 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=tH7yiZ4DL/IkimFAxsXUYbqZ+IlrPZSmhVaW+hn/z/8=; b=QUV62n4HEuQ2zZT2IR83HE7rS4H8atnzwadn8mGdx7bs/GrPwphrABwBNEXJy0ZVcV KRMcMMtceXi9tJ6F7+UgKSuXy2489DYbLK2FupGgry55I/+lZ1/6aRO5l9Fjzmuii97T 1SsjdzWXHKxWFs4usVoFDx9Di+2JE6kmyUwIushM+RqV/97t27WpjgLhF3WtsM996dfc Or4W++VyUcufOL5y6jAfIiIulHcot7mgEtwqhopg0x7zs1rIdtq1MkDW/NBhxSBpOj2Q Jo7WJXwtmFhh80PCUyNQthWRzx/fDiHRtRFBwoszNIAcyZwNkt6+BHsY0cxgCXW+2+vx gNKg== X-Gm-Message-State: APjAAAVt22liz0dPvfpMPVhUippfAvZpiHbPIKeX1exYMhsQZzCMmJ+K iBZ+4ouaKNsAIKBxTdPKtSQN5Qfr/xixOiZ0Cew= X-Received: by 2002:a05:6214:10e1:: with SMTP id q1mr461176qvt.148.1566938442229; Tue, 27 Aug 2019 13:40:42 -0700 (PDT) Date: Tue, 27 Aug 2019 13:39:58 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-6-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:39:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172297 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308450ily; Tue, 27 Aug 2019 13:40:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqzm55iOwNmpj4zqwJvBJ2Miw1xseoS9YDb70Mxs9en/g1Zr6y8px8ZZ59xk62BWqTwwyE X-Received: by 2002:a62:1d8a:: with SMTP id d132mr385764pfd.187.1566938448577; Tue, 27 Aug 2019 13:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938448; cv=none; d=google.com; s=arc-20160816; b=naSthRgSs9RYUppIFT36sPmZY2Q2QlE3lQ8JjQE/D54bxxjCD706+LohHJzZJEA06b xhbFA0ixkvouZ8N4vNsfiaSg67dlUHl3sy/DfrQgkLjyK397+mmy7MApyMXNwTrsoPwX RObP0kTpO1epo2Pv2tpQmhLZbywd1vGZAiPqk/kAHrC3wzHABaC0nAlxZcV4cF22NGH1 sVzcXHa3ikaMcsEwpQ8QkMt2xdQNFek074bOtVJpemXwjoct3dFV9CGqeiFLtZXW0zQW C/ZpRQy7XmON38PZXWG6eAcORo56RDb0JZECWY25QgEGmFLjfOWBEaslFzLJwxt9RSrs 4uSQ== 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=6yNuMZ+qRtYF0Z0S5bbj5Vin0heyTc8hHeZYmojDlCY=; b=l9lTqyPx6sLdNphLf760cXtNe50HacIbI0C07mlUn/QeRWqDefQ5GYyw/eySPv+wlr Nw6EKx6diFj3WY1QzAZobFdusq+h4ZLsmJ8YVn7yREbvw9DfQFCvWtSo70ubPT8wfXoR ktAdgz317LSARmhdey2xY6ZPFTsHbm92IAiejPIRFcozxDRMwHDXfurqCscXlfmsbHdV VNqB5IsFYK3oZoCv3OxsLfxLO1vQ0b/2YP+9myBQglq1GII3cO/1taCXU/fWNDQl2GOv 99oeUSthg/CB6BCBi/EbBmdk4T6MAFZT6ls3BMpeeVxz08vxUrsMWAkBInR6xi5sgrYd YWzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aIlVMPtE; 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 j6si289756pfh.289.2019.08.27.13.40.48; Tue, 27 Aug 2019 13:40:48 -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=aIlVMPtE; 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 S1730706AbfH0Ukr (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:47 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:54199 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730221AbfH0Ukq (ORCPT ); Tue, 27 Aug 2019 16:40:46 -0400 Received: by mail-pf1-f202.google.com with SMTP id 191so207713pfy.20 for ; Tue, 27 Aug 2019 13:40:45 -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=6yNuMZ+qRtYF0Z0S5bbj5Vin0heyTc8hHeZYmojDlCY=; b=aIlVMPtEmORNLus5Du6VSEeTR+AxBIOU2u74x5O/HcddvgQP/TuEu+361Skly8Mawk zITjIiUyikL8e1QxWJJ+iyVfYPytRJknw54m+p5VTTsHiHUAfVoDnwA2spZ1POXs2yrT YkbS43FH7UTIqhsQVKjNzHpOaiJP0xx3U43umzjkL92BlD1bJSjwo3Dd7/zBtkwkqEua sk7WkTKny2ofK4FXD1OoZ+mfkKzcL13+/YA5yemvayFd3nzGVEsYfpQGN7p31ltDZv91 ezDns0NVpR9KVZkEg6AFLWg28t+XgfVChl24Je7/svX/PvXD1NnnfEOXYBBNsxusb6Ac Wwdg== 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=6yNuMZ+qRtYF0Z0S5bbj5Vin0heyTc8hHeZYmojDlCY=; b=Xd2r6hK8j0K3IZY2vzDTAe7wliwpuxaZcBG2L8jFQIXDAreChIaUUvukTH2s2Qv743 AdQNuV1mz/liU79cN70zwKumTUBJOf63ZyWpCeumY/vO3d70+tckl1qUnMM+VqB4Vt+c BKb1uxV604q1X7uhlPOmpp9fJoy9nmpJyOSCo9xCjHFuIduvydzvwTxEGcuJA0USWN3N meACnY6B0GcutS0+ye/+yb6At6o8iAi0iHNsNErow1g3pAHgdV6A6sKfLE69waT5WK+E HEve3bmX/30rc8xYv1l4I7Jum1++GJDuGGz00CLnffIigORbrN27amgfJwkG3ITMLtDP ZlTw== X-Gm-Message-State: APjAAAWDvkGgc5qHj/OXQ0YMRuJ6ZEQrfKH5f+lZjlUk3qg92chqHH8Z GZSTA1nsUNUbTJPccVWs187EB56MwBVtK/eZ5dg= X-Received: by 2002:a63:4e60:: with SMTP id o32mr323110pgl.68.1566938444719; Tue, 27 Aug 2019 13:40:44 -0700 (PDT) Date: Tue, 27 Aug 2019 13:39:59 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-7-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:40:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172298 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308495ily; Tue, 27 Aug 2019 13:40:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+l/ToT0YJlrWDybtN/A/If2zAKQy4eD7iYi6optZuvNW7dzU09w33WNODRi9Er6olYkeD X-Received: by 2002:a63:7a06:: with SMTP id v6mr278741pgc.115.1566938450920; Tue, 27 Aug 2019 13:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938450; cv=none; d=google.com; s=arc-20160816; b=UlpfofQ2JhO3wNH9xSbHJW+lxzDJYVytyCPV3C7zRjO7ck6FJoeuv8+UcS3Gt+Cdxk JxzLSNqXapCeVwCTGfWFHd2I3GNBU6crVM3LLvmSqgSTQnGNXiN12DeAMP6z/PxE6ko/ BL0WxpdHNp1BEdDvdjgRYeXX80NTn/JAML8pFdR27kZ3P4qF24istfRhqPUjOJT8p/c8 lnjX+q1hEG4Rjiy/PhwxkxdNq+UAoRroLFQQ7clcUKcM+OYgx34tcApGZ0Lin3zEIYNb 5pTF9sWchGUOtUp6KkKDygqXjr/pwGUwSq7fpgSUVYpIrADR6yb7IbRSOGugHi/e9yy0 gG+w== 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=69o5Grxjv62QvQRHvmQYsH04Y/pWfPSVibkBDTUpZck=; b=YvaMOxKPRlN9GreeV2b/VTBmYhIw0JSgGgH1EY3akFLP11NZXBIMpD4Ms5TwNwWqrx aeWvfBA1xivhkDi5shLxl05nymR5ANPODDSWxY+PDuyvfwlh/qeImit6skWjZ3UQTHCQ ejwYS4oRSC620kR0FzV5RKu4ly5OSJT24h5tCzS1PLNX2Rh02n7ygLHCw8rlC7SuY/a1 bogGV6fg1Q8+jv19t/VTil5XjhL2kqXf1WUIxPscH3oVh/wniT5yT8oqAs+bYDUK1laC lTtn7qU/6G/gCorlIxc+KKbGA511V94HX+Y6K/vrQ3zmLuZUyQB/ohpaz/4LqfQu334r Y/pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hReFQ8hC; 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 j6si289756pfh.289.2019.08.27.13.40.50; Tue, 27 Aug 2019 13:40:50 -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=hReFQ8hC; 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 S1730724AbfH0Ukt (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:49 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:45200 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730221AbfH0Uks (ORCPT ); Tue, 27 Aug 2019 16:40:48 -0400 Received: by mail-pg1-f202.google.com with SMTP id 141so219275pgh.12 for ; Tue, 27 Aug 2019 13:40:48 -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=69o5Grxjv62QvQRHvmQYsH04Y/pWfPSVibkBDTUpZck=; b=hReFQ8hCxEL6bw2JDh/MqNIvy644a7nuoCq3WHEhQzVrMCKSuBPRsE4ojzK+e76jk7 fd9z0VUbRz9rzsaUz2pd3Vbk3Dzi/MWW4TGuqY6YaNj1mzqQUWaq4ezq60DCs171Trz+ K+0bAGR/QBc0P3/grOBtOJGrYkkZ086qqtpr/0V25KNgNAdtBQg+pWzBFaFQXWgAk4iW f6I3hwFjbGDqgIRAjEcUC5q1OptG59hoHMCn9N01FAqTt4BAC5gBjgq88iLnl5AnsPD7 oup+hkyJLNlgHcOTwGVtmRybWt0hVzlFa+oCNucvdqwBJy7PREzmiSOIFNfgNT1ArD+I /7jA== 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=69o5Grxjv62QvQRHvmQYsH04Y/pWfPSVibkBDTUpZck=; b=YXplXWSAubCYeI4dpw7cMwOFjD/quayUbediKydm0osEyfxZzS2iVtf0MTwtHYnf5i L3lhP+id5YzFA1tBzyCrlglnC+RYY4fMtYfGvyeutUTZX2e1ItS4qCJ+xca3RrZmaDNB yXyBzyb0M/niu2HmVQNxTPiHMOWF9Ijh9AROfYHAo1PJlNQt9rl02mLioDrr0JGGtNzu HgQdxzWl7RfCuF6ABlkWDb4Xr6dvCFGf3izeEz9oAJGASjjMkOPplescpBWfSkAedF47 NCjqvbswCFsj8cEyYAZ//JOQzRy3MpqW0C7NGHRlXTMqwmB8ZALqGo8AfEdj7tXPjS08 gpJw== X-Gm-Message-State: APjAAAXME9VralA9vo/5yq/J9ZZuF6DkJa58+Qtray/gVpy77ezKVo/O M4hMrM0rp/JHwmxF+9gKp9T8nL13bwKIBzzfL3I= X-Received: by 2002:a63:24a:: with SMTP id 71mr260306pgc.273.1566938447325; Tue, 27 Aug 2019 13:40:47 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:00 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-8-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:40:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172299 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308562ily; Tue, 27 Aug 2019 13:40:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7LNLpR8n1VRZkoIfH5yGR2TSdcDcplEzBRTXHuQ1RJzBcJk3hTOGwKOIwR+kAvcjylxS6 X-Received: by 2002:a05:6a00:8e:: with SMTP id c14mr367895pfj.241.1566938454478; Tue, 27 Aug 2019 13:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938454; cv=none; d=google.com; s=arc-20160816; b=AOJ4pcYkn09+pVxx14vspqCjZh/GmrJ0xveZ8mMO0PzfGfnCVnXWxDM3LmKY/tb869 xPDOo66C5E03HZkl2/CSVUnRSXt77+jfF3KZwREFc3ztEi8JHlA26H2S4tG8JmcVF80z dwglyws6dL3LoA49pJzFsNr3iPTwpkwsETcwdb2y54SE2SGKwBq5NSPo9BR77u8xlDjb eXrhB0uAfcZjBC3JqerpfIFb8t0tGyU71LklpF62S2EwzpijUA2jU7fEkq1N3JYeueDW dh637Z3egpxkkoSGCESj1/UMnx6PMjBYDflZd92gXnOLhpjbzkexo/NN12W7B5Vm3YPr UXsw== 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=jdT1qqSDs2qFZzLVnvA8tbfOhFVP3FSFASOlvOrlNi4=; b=HkJkgaVNtagCBPrGvA1oTWOhCVZOHgr4/Tm0G4F7sG4kAx3tXd5GYvHy/RcYByKWwp h6+4rk9ksP1vh5KuTQT5Qy45alaquRHmjWf4+n4MdUvPQXCa2s1FAj6jmavsTdD+vywH QfwCf7G6v7D84CKxcQVWeRYm/Hfo2jb2lfEg6QVYXKjPG98ztITzhVxn59FGKTfgz0go 2s+trNUfpoic7wShnqEVn3QdFmyKkjVq06nP5ClttAQJcyvqHa8i/HqEZEZEl6pVHsfw 7GghmzGPcOn8PQ9fgYyDykFop+sTwD8zIaz3Fyl169X6G2d71LqKT9SHxW2eAhcktXTq zvzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iD5Ox0Uj; 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 j6si337482pgb.206.2019.08.27.13.40.54; Tue, 27 Aug 2019 13:40:54 -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=iD5Ox0Uj; 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 S1730742AbfH0Ukw (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:52 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:33424 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730221AbfH0Ukv (ORCPT ); Tue, 27 Aug 2019 16:40:51 -0400 Received: by mail-qt1-f202.google.com with SMTP id z4so182509qts.0 for ; Tue, 27 Aug 2019 13:40:50 -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=jdT1qqSDs2qFZzLVnvA8tbfOhFVP3FSFASOlvOrlNi4=; b=iD5Ox0Ujybxm5MGH5+JvS/NIUjFsEsRINEO9WSqSIOq1NsnfaUXMY0/4OYvLKkiqTk Nb8OT8rye6gaiP6NP9McvKngKEIno81ydeKx+3m8cIz/fNSWmOqCI5gSVfpyEyjD4wCF Ui19boz/LAoZa8N8aOmOS1mPINSGPMpmAAR5Y0R+q/wJheuPgTL+n39PWUyYs+qMKfgL 4I7moS1Gv3VY/5nHHdVrNuSi6TMfzaRe5buc7XrKtmVhJVqnKrRJMWJXVtnLBfSOS8pE 3HabM+dyLOhE5J8trjwPQaGAqDqs7DbToGaNFAtsWAa13c1sz6IQG7gPOWe3Ub8mGHfm kGNg== 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=jdT1qqSDs2qFZzLVnvA8tbfOhFVP3FSFASOlvOrlNi4=; b=AzzAN3u51sQDPSMx0hhys0Iyh1C8AtUCQ/a2Ei5qcLCnesETqH+anF0Y3DuaJnJnwu BgYRQJKM6KtYro9UzAhaINHM8FpBTHCNu5zaBZIFDqIQZP1dvc7X9kgV0n3UsRL96t+1 n5CfCT4CKxWUFyLAvosFWlIRB1pJDmEvAbxiUbDy+dBYb2jZ8+BYTa3eG+kqQtK8zOvA SWvFewGno51J8atyPxDtWOThOWcv4L+yJ8sqZD/1UAM7aA5Mq7gHhEupY2fYBR1LGszT vZ9suISxhj48oydo/nyPCy9Xcqzwyt83ZLjErVq0fwPIQj1pIJaSyytjQ3d4daCz3TxG LpRQ== X-Gm-Message-State: APjAAAW6uNB9r2h/ZTnW13w6bsJBq3LBo7+Qdvhz8kffbrH6rplK2avO wlzjZ1jaULimEzVFxpAv9Pr2S0wSjJcWf9XQ/FU= X-Received: by 2002:a05:6214:18a:: with SMTP id q10mr410277qvr.157.1566938449923; Tue, 27 Aug 2019 13:40:49 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:01 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-9-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:40:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172300 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308610ily; Tue, 27 Aug 2019 13:40:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwO1Vo6DsnP7FGr2Ss65DZWO+/HlOWeboOld2JQqpwXly29rH3V09oeBWS5Qw0rG/q4LAtJ X-Received: by 2002:a17:902:fe11:: with SMTP id g17mr855250plj.154.1566938457597; Tue, 27 Aug 2019 13:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938457; cv=none; d=google.com; s=arc-20160816; b=PllAsA2f52cYBtBG5TIwjXRsyC5FW/UjPi2IHQKYSk4/3hY4jC52mh4xQ9Nh1u4Yq6 c7TaqXVl6iGi4ZKBuTuzNmhQjyMojbdwWCdpSU+Ght3DZTh339rLQTQC6hKa7End+RbJ LroaDe5ame9LAIbWpJHyKt04VSWerHGY725MtcTuOz0F6qBf/KfS99Za22t6V1DqCAP/ GLPgaoXYlRWMGkSzY7aqdjeBnHThO39CbuQPP6toC9N70+ThxElprnAO4XgP1SQBFBhI CJYgBTzKT2suvncAh8g2QsPZ8Kxq9+iT+gxYDf+2RkNIHfqGytQbk7pTx8JulYmSsFET Nj/g== 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=Ywx7jCXsKEfuHAj2q8Y6vNlDnApWLp+V93ssN5FszZc=; b=0BYKhZ1TZ6j7ipL/lvDRDV+rFjtw8Uqs6Tnm9JI6oQDxtAWLTqDYgb0wYI5YMz5K8Z n4UoR22p1j0MoZQyDxB2xX7X+gGW9Ns3LWN89IHdQQl1Y4KXncBE0OeA9S9WC+FT/cnU UeWOzythoPqBlWSBS19xYRKlcoP8POigAPNBDXBqu5IQMD1iQv5Lm9NsbqTSgFD24gVY 1YUK+1jOAw6C+p4ZoFICrSo8g4ViRwT0GYZjvgOByp3MYH2TN4uRSs/VmL3AbSJABSxV 9GlOHKuN/VeF5V4+gp6nvnn+1L9DeXm3ofP87/w7MKqj8gB/oTUdK7iyieAtI0/9cdMN 9MGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oZVG6SfX; 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 j6si337482pgb.206.2019.08.27.13.40.57; Tue, 27 Aug 2019 13:40:57 -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=oZVG6SfX; 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 S1730763AbfH0Uk4 (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:56 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:47450 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730221AbfH0Ukx (ORCPT ); Tue, 27 Aug 2019 16:40:53 -0400 Received: by mail-pg1-f202.google.com with SMTP id l11so217096pgc.14 for ; Tue, 27 Aug 2019 13:40:53 -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=Ywx7jCXsKEfuHAj2q8Y6vNlDnApWLp+V93ssN5FszZc=; b=oZVG6SfXr9wmXQ8Rkz+CrFhNt9Bn+kim+2iyLqD1AZfdOXST1eTSwraH9ntOGJtoL4 qzAqH61z46Z31dZYp7HSK+kOIFNuMyXCOoF2W7QyHO2oquClG6cjfUgSu/ObSXmM6X1A Cei4K2LrukVqse/fjZhwZbnw+QhyJe40JUJ2O4aHhEJHu49hCPdxdLpHgLA9D+UvFbzy +1mYlLMPIqjWDdIYpcR+xquKD04F0Gt6y3hGFoH9wj7/F4Ip5cm6kLjZgR35p3q1XySY vnrGwHuV2tVpoAGHcy7OJTTSCCALCdu7KEEllQeg2O53Nh1QIFdYsbxqdMvrgdTpQa9O dMHw== 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=Ywx7jCXsKEfuHAj2q8Y6vNlDnApWLp+V93ssN5FszZc=; b=VywmHXDBVIUwPWvfOwyERXc9wmKiUHWx/7udwB2HKQphtKN35DvTFQVGv015zJE84i 90wws1aR/8oHFXMMi6oLewchWIpLn7ArVhMd9uSfSHBFcwyyKWS0l/d+88MW4rOFGv9o nIjvZ6cXPDGMOSmTnzccRHAWPmL994PAcar1pLC6kCpLOVf03p9jIyt0GCSjIduNMJmK dbneYRzkWY6R9Rnw+c3tDi+HBa4zZKA6rU3Z6Ew2+qUFB8n7OPpgevFvyDvxY0n0ONBA 9U4GnA7q6+Qm4M1mNMRIErgpFAOAUT8romZky9/LEnEyGkHWQA2yULxCsPCpsIgL+eOH USQA== X-Gm-Message-State: APjAAAX+02+S4jcClGSaFZgADnSpYKQ8M2u67LE4c7DNN3ELLlkRoeww /B2IbHsd+722zpofpuxJvYC+YH8P6FBL+LP7irU= X-Received: by 2002:a63:6206:: with SMTP id w6mr281844pgb.428.1566938452324; Tue, 27 Aug 2019 13:40:52 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:02 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-10-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:40:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172301 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308654ily; Tue, 27 Aug 2019 13:40:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxMN8iaAKWzoWGT/Xi0BS+c73d8yd9hLE/lku0Uc7vb0tg4mtHEo//x0isi7mpucY5mYlN X-Received: by 2002:a17:902:8ecc:: with SMTP id x12mr837111plo.258.1566938459729; Tue, 27 Aug 2019 13:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938459; cv=none; d=google.com; s=arc-20160816; b=xIQi1UIc3sHudz1W181FVoeke15Bc2aDn89AR3KSyO51tiBXBBF6bIzc27H1uQZwAd 8uPOQ4iqJJFxBawOlZsZmu++KBHS+VP1ISJEK/WsVVC9Hw5Kk41cpB1mji6wzTpSlXiT y15BbnaQldJ1Dt/sFc9wtzO3dU1jI/iNcoyaNq2S1UakGMfzdeCjIsfZaeL9OiaOkGTN FPMHr5e7mOYGe3nIvgJk+zOJ0Nn21Co+Sr44ZHsEo7Oouy9UCyU1vDqG3QciQWAXvm7E vTT6XEm10pkkQM0z2jsE6E/9u/yWMXEIFtgqI8Z5+Ueb1IJES8nOM5tiqfs07VTLJq86 NmzQ== 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=7fwBBDcVeQDxpK7w1Viqz28DYsc11S+Pn/agx9uPCfE=; b=W+5dUtb77hrbzmvYgA5guQaSWljbdFbSmHaprqYDQ/FNkPq2hnjAWar6PrcOxecL0S Ek+/GjH9nTXu4sjRuLgxWBYRILMdgBD2CLSx84JCEPbMA53XnbW4+l1XNuyfimFCVLLV RdH9jvz4HaY4WTVuPdRO0smEuGiT+DALu6pE5kWnoroFS0y/geUEDaywFJGJRuN+wm8n JN/EnLDbVCrJH2Su+eZggU+3ZsYCfUIXi9MIq6BFvOkckizVv4MKQNFlWhV1HtTPDZYI NQ5BWGODdCW12cs1LDBuF5MYSIW9uqVQgdqVAPjnvmwAThAt1Gzozd5fYF45G3O0XMDh /KLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Iwi+WE6J; 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 136si331058pgg.354.2019.08.27.13.40.59; Tue, 27 Aug 2019 13:40:59 -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=Iwi+WE6J; 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 S1730791AbfH0Uk6 (ORCPT + 28 others); Tue, 27 Aug 2019 16:40:58 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:34160 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730760AbfH0Uk4 (ORCPT ); Tue, 27 Aug 2019 16:40:56 -0400 Received: by mail-pf1-f201.google.com with SMTP id i2so242554pfe.1 for ; Tue, 27 Aug 2019 13:40:55 -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=7fwBBDcVeQDxpK7w1Viqz28DYsc11S+Pn/agx9uPCfE=; b=Iwi+WE6JbPkkCKZbTw1n8ZZdbyETfaDCr/XrX/9YqyhWNcNtRyG64M9A6jv8Lx4jcs nGYeBarBt+BbRLrO7UHy4GOXQKG6gQKxw5pmT7UORkJXFn3yhYkQK92lMgMRGtNOgwWF xsyZm2QDeLm9Pzf/p8j9W0DP25eatD626aJoQwt6NwNRy/8mB2bEcJMfWA9CRE9V3hcN ZgdNdL1ihrQIEciqkbtzAANN0TLA8JOBxyZoqrW9YC9gX5KoOQrE1/olIKblieTfwbIs TsZMgWnajhs3Kp8X0pGppkisz2yKvk/okD7MHoZk4fv9GIO1rrs+nfLAiipg7yfLNpgB 3qHg== 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=7fwBBDcVeQDxpK7w1Viqz28DYsc11S+Pn/agx9uPCfE=; b=c14R9hvc3UFDFGcYRkFmwfEBOxPNEvdB041naJoFF9tPuaxQh+fp8IV7o1XyCvUwCW WQuZSTFR3yGfAEoWY833WoynpnLSOHxg4wcoTDZNnzFVueWzxvISLd9r0DGmIgjrEeVs T73BONfsPn+Xf69KDs74lUmxXrLVL8lDW8aniy/9PUxE8l6AXsRPgb3rj3ciwPd0MIHF rkxDK/KZ2zZmPQjrVHrE09oDBqT+ED5Ww6ZdGN6CnInnjPitozeR3yKnDIZJDkmJblXq I7VwXOeGpmBz7h04FLJlXDvM1dM2fHmFa2K/vWiYmKCJmSgEesgktLcb+LZL9dBDLysz ZlGg== X-Gm-Message-State: APjAAAWt7gs1IzWFuBGAyGRo7GTYQPkHXprOdXPXxeKd+RKZ43Mx9gsh HzIOGcQJRxRoXYWM4LgF3sHJg0hDc3RdTfyaKB0= X-Received: by 2002:a65:5183:: with SMTP id h3mr300039pgq.250.1566938455242; Tue, 27 Aug 2019 13:40:55 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:03 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-11-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:40:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172302 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308716ily; Tue, 27 Aug 2019 13:41:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiuzhZWEwvmDypkKy4x5i0Z7k7DrFangVe8D/Mf/tS0HyUuGXC75HoKd3Ee04qHPl7lImk X-Received: by 2002:a65:638c:: with SMTP id h12mr281907pgv.436.1566938462967; Tue, 27 Aug 2019 13:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938462; cv=none; d=google.com; s=arc-20160816; b=aX7Nyy/UfaQScXxB0r6TEKNMoIDfDZN/70o1f3dkWr55ex1caMm9uSpU4YALfwOeZo WVe4oHAwYFsjBFPXNkfpYn4+fRLR8yZJcDROu2ae65YrZWm+/DA/JIUf6KH9cIizICDt clKHJKw7B6exymK0gR2/ai4fUMtUT+0LVsDQ54BXRKe9NXdRLEvIV+NmjqxgXBLpHxTt LS9QF5+RgR5jKdJwii0CEBLSBP4lg+DUnIKyMnbYvjd47K9N+cATw6p065BxxIumJECl CcIEpV04XBnYQYtZDBPuTPMgdvg9DCBfLCMh5K7VfRztNTiW2tEti66Ne6WjkGPl3Qcg YSOg== 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=/29bjCjTbbl+cLbTxIw0tiWmYrpTAoAKv+ZcK1v+ox8=; b=NgWeiyJhq57rbAp5H/OSvkaSWIuMFPCBicJZE12JWBMMg0bejyjmDOU8NIbK9YAFSo MsHhQXOYtpBi8X01/SlS9AZ6UV7OysoXMkADTYf2DwsXfIdffKNuF0Jquq6UiONomK4P IbdKgnVhlVBk0Kc+ASipO/bD0qESqCaFpwGvv4tTa5yGV9EzVRP+vX99nNwoqSuzo8uV vY2RtHa6zY+5806paqnQWU1hz60EHUARdD/QJPR2Hz2rL5DW0LBOHGm8gZOogpAImAbb C5zSM6YGzLGNo/jwogHLvpTW3Snf3AQx9srFhJsSgpqCS2drFDcBXVSPpsXsdSdNtSEc b64A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=c21KIJW5; 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 136si331058pgg.354.2019.08.27.13.41.02; Tue, 27 Aug 2019 13:41:02 -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=c21KIJW5; 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 S1730824AbfH0UlC (ORCPT + 28 others); Tue, 27 Aug 2019 16:41:02 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:51136 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730760AbfH0Uk7 (ORCPT ); Tue, 27 Aug 2019 16:40:59 -0400 Received: by mail-pg1-f201.google.com with SMTP id q9so214730pgv.17 for ; Tue, 27 Aug 2019 13:40:58 -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=/29bjCjTbbl+cLbTxIw0tiWmYrpTAoAKv+ZcK1v+ox8=; b=c21KIJW5g4MvXBOS7sME+t0QDUpjgdIeAAj4Dp8ElLl69ZEoixqIhZ+fwaw+wn7eL7 D6/4lnvdM+kKaI4kTkpi9vlsbviFugLjZgcvgVrDVeotJA4dDdzTebuHj3Z9l9tEh/JW +lEUV++D/HbJ+fYgyCwuLobZemlmdv7epF1ZSYGCG/pakcXO33SnFgZZHEIIrnm5+/Gs e0FUU/YtFcx1N0xsk2TOXo7UhtkUeLNis39W+2MdQFq1RFeeTbcRLJLSAHd6BNqAsgQN bCrq6X0Te9hQI9XwHv33OlzZc5rZ5dptuS18x9F7Iz7djaOR+NK/I/nY/STfG/lUNVry 6+hQ== 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=/29bjCjTbbl+cLbTxIw0tiWmYrpTAoAKv+ZcK1v+ox8=; b=OfGd/uCxNgJMPULN4Yd9sDx9JZfU6CaGBciDu3Qjcw8S+zNkGNuHuacbx0harMv6hN NmDJMic7Ti9FKUN+zSVZ2jHIrPUX5NQdMLTxJbrkixQGdDr3EjnuJsYmTT9mOp5wg3cF ig0OQBaUM/wKryOZtyaTzbUoqoFweETdhehDh43tZpayrCd6rV6O0HJ39FBk2LaTf868 hu3RFzzWpQMuPXCAqTP0leQM1Zvg2M8yB2wSlAvWAgICl6+GE4qhe/XOs3LSVp14LRCZ OWASzQqnYGFNl6TWYJp8uafqapWD2Ss1n0V6Q3QlzM9tkpWkuNNhck6RxwR4TgS9JAnH V8Ug== X-Gm-Message-State: APjAAAXxj8qMdKnR0nByTNoyjElBmlsSBpWEFH4C0LOawrr2JdzmTSxh KApj3DgwU3FP4LCx+j+Nw+dhwMtIy9s85FVEOIs= X-Received: by 2002:a63:a346:: with SMTP id v6mr281349pgn.57.1566938457832; Tue, 27 Aug 2019 13:40:57 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:04 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-12-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:40:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172303 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308765ily; Tue, 27 Aug 2019 13:41:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaDtA/lZEW2B9T5KCMevpzoZNNvI8hKS8ElPMpV/7R+QawOO0m54QwGEXVllA7nS1aknSr X-Received: by 2002:a63:4042:: with SMTP id n63mr273000pga.75.1566938465471; Tue, 27 Aug 2019 13:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938465; cv=none; d=google.com; s=arc-20160816; b=LMbb6jCf+V7s2NDnG5avEanq/e/qbky6a8xxdHE61RLQK4/7TMObR54vckMl8qb4Mq AM6v18Gb18ZRcYfu1G2xVdshueO3qFcTUdoO8k3x2M5LG+uLE2AkKj2EWZPpZqzuTTGE rgOque5pug1qPu1iQuTvYtR8Makxo6SmR3IZhvOxGw6RBsK2uOISxql4+qqcodRQzxGR bEyhmUKc8QLodyF0PA50+auZlQHXnGzRsVqs27cmO62fApT3YxTYcbeDWmlg40HpvX4l QEqPLF1O7vHt25WdZ0yT1NVC8sAfIepPrOOOnatEgp4hejn9WOw+h02cuTGB9TNgoug8 2Yiw== 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=c85yaSBCcgJs92ECoOpY1wTN4fvezGR1R2LzkXxYTJA=; b=S6gfFsw5npuOi4J8fJ1D7t4ChMrp3r9wep+iNWNVrLcRcQ8gcScC4gjTEDSoQBBFEJ zYEyTu8oWKjljSdC3xS5RII0P9o46Z4M3XmsYY60zD2r5ZVei5scKpA4+ldSe10rOs7p WSkKzhtRULWGqlHUXnaToW+MZJdEp1YfoUqEdko5ma91NgbLa4NStWKjW2x5zbow7F2k u7/Kl5iy7V+Kl/dBM5UpC0+aB2d97hQupGmXwBzug8WhIAaV3BbOciE/etfDBj+e91jd lSPg+54hbO/wlMpooXeCAXqFD5GCt/+bic/IqbqC9ad8sF5V4dEOgyDhjxG5qH05I0ZP 4uzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=X9bA6RYW; 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 136si331058pgg.354.2019.08.27.13.41.05; Tue, 27 Aug 2019 13:41:05 -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=X9bA6RYW; 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 S1730872AbfH0UlE (ORCPT + 28 others); Tue, 27 Aug 2019 16:41:04 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:41672 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730801AbfH0UlB (ORCPT ); Tue, 27 Aug 2019 16:41:01 -0400 Received: by mail-pg1-f202.google.com with SMTP id b18so224090pgg.8 for ; Tue, 27 Aug 2019 13:41: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=c85yaSBCcgJs92ECoOpY1wTN4fvezGR1R2LzkXxYTJA=; b=X9bA6RYW3SmopxTVDf41RMh8cJZOXKHPd+G3Ugca/TkoK4ngGJYO+ZJp13UVO7qDxT 203FNJAVQqt719AEzD96jSoIuXdjHvGJlWDIqyE+jltbjJhA8hCd4jnui2w7P1Xcj/3f S9hj/lL2roLibcJ26l3c+yUCJFJ8I0Unkk+n5pRVbCUr5T16FTzx8KnQYZhjvvJGTaig z9uDAtJKZJQBonhsXPO+5D0T9YwTshQeTzFRM04y348tbRlpdWL9OYvUkW7ttsH3ZWNm HSIronvBHUvTuEAJoF0ua6CAYFRuM9K1qzXufDDTSFuf6P4x0Yc8D5C6hix4fdjYsgE1 +aEg== 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=c85yaSBCcgJs92ECoOpY1wTN4fvezGR1R2LzkXxYTJA=; b=sNns4zhwCAv8l/9/bA/g5zlFNCL3Snvrzrc9tlHnhqsM5d9dZx7pdjBANLaq3MpUqp fGvUWDE9BSA5qz3YeXAq3sq1im+FF3GLQ3TcWtpaUuiE2s6PlLMINvmM+04hJt4szqIU Cr+rhujul9JWpdkYjfdh1jkwFVyFHV37iDK+QCJYILUUFsBx7xKURhD1IqbymORujCV2 SZz+253F89BmsUsaQArpQyPPhv4gaC1IIh2RCwSAT38ZTbCGtWttUTjzOgBB9kx4doSD mBetULOTSn11Ks3DbgeaUSNkDdzh8hjn0nL+n20pH/iL+MEJ55kzNWWM+9NepB/h9S64 fpDQ== X-Gm-Message-State: APjAAAUmRT8VaczpF3Hd937t2LfzrNqdK8UbNkskrAcJpp0NWG5iclVF nyhA+uaDrcL+z35SHLOMcfP7J2wZboazXZ3f5sk= X-Received: by 2002:a65:6815:: with SMTP id l21mr312139pgt.146.1566938460536; Tue, 27 Aug 2019 13:41:00 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:05 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-13-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 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 Tue Aug 27 20:40:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172304 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308794ily; Tue, 27 Aug 2019 13:41:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqy418dAtNVXvYVPNU8YgiKOAKk0FOW2t2ywkdMX1gXTMKgMk91sPsGEqrZQpfjLhe4LoLtf X-Received: by 2002:a17:902:7c8a:: with SMTP id y10mr792543pll.65.1566938467161; Tue, 27 Aug 2019 13:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938467; cv=none; d=google.com; s=arc-20160816; b=OBliE8jQWPxNYgFN1M9XVIih0dMaVsy0Kw59WoJhQ26cKr/pGKFmakV1ayXPFI8NCK yd/6+eHsn6lbzNWMd/qcuY+knndhPGTSyLrttAL9RmtQJezXqMhykFVrtQPXCboGgqsY TDpC1RmCaWZ3LztuBtpKz1xTAr7DL/1Kx4b+0Oxg3Ly7S87nj6KfPEpxrHrE4XjJnJIh omBOBTqbLmOlfzfWI87r0/CG4hYp3P3RQ5G+Faf40ckVkVBcn3qHGlp2gtImUAP2jGF6 HAnEfZYaAxbv56Y5gdfwPwzgkUBwJ6i9h1kR8EgYvRBoWCb8O14DzXGHb9oarumrlzzU iqBw== 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=k6ystdld102wcEURQlNxrhbnCKmrBYSJcT4O6Xk1CP7aayhegB/rvExGdaep0QxAbz LZwOmEi82sF5K9EhXI2XLB7OsLjlPk79kxVFVAGBT1/sTarsh0A/0kiB+vRa7UvdvkWF GA1VHUYLMQljsNN5YAVOSArWPLmL7nB62QQaqb0bfuDJOio7RZXeuN4N0l4epExmZXls r9oMcOYxRq9lIx+OgeGGNijq/Agn6YHWSnrzqcg5b/D0J8Tn0rpRnZdKimPbQ/kDcKCW Wy1V5TiNQhJ++3TfC1ft8jtE/wDgL2fm3kxJNfN5zqtGAig/YwiBJ67oHYbxixMGy1XW wxgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gIdzwFts; 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 136si331058pgg.354.2019.08.27.13.41.06; Tue, 27 Aug 2019 13:41:07 -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=gIdzwFts; 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 S1730896AbfH0UlG (ORCPT + 28 others); Tue, 27 Aug 2019 16:41:06 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:36979 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730845AbfH0UlE (ORCPT ); Tue, 27 Aug 2019 16:41:04 -0400 Received: by mail-pf1-f201.google.com with SMTP id w30so233656pfj.4 for ; Tue, 27 Aug 2019 13:41: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=6RxBbYYa4fUI8s5OPNOU3iQ7zoV1TR03oRwDSBMZl1U=; b=gIdzwFtsEuL6/9C2ZBd9RoB6Keyd4pHLPnayQ4xW4tnsl/5z68yn8orSk4INiOuIci ugqggbiUUYtg2VlnIfVTYFKBdsYRtbtW4QCb0WGZE0qK3veM9mDQv2MmlshIcze9mnIs ZHDIdDmwa7viz32BoNkVXvPPb6lfG8+r+E53VYJ4bzm/GU85PefMNmsrAwAnAr1rBAU4 ZhbpBKk2kHFn0SCvX3vqScAfd2P1w8gfV+l28wbUFJlMymbtD9LteoMRZ+CokbMpiw1l DeivNc3FnYy/gpvdE0fukazKbLuS0jSan/u1yvNuNBYiHC2tStfSImENJKIrjj00vDzL 2b/g== 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=ObGqoT9u0/GMBImk+32muinbBy6cyM0oPeuF3Kmou8IfO7qUuPSg+tggnZnt4rwrf7 WtWr40obeQtkPk2KIwIwhuw0sXgdrOZNB7KjMUF0e/mto6Quq35PVe+PXMnxT5ILbu3w F6dKjKs5POBEIvIdwcHaUOzoWUpNoKaqFOiYhlqZLeu4pDiZtCSoxG0DYri16CKeHCkO YO90pFhYYo/Bq1FUwLwZDK46gbNWXJO6SYYR5lP6qLIp/nsxiRzUsr/gMOUf5D4HGwNV exCSKk7+VMPnKJFmHuNDE2Th2lYQuCkHohWXA0gEf895nErlkECg730cRt3EdVgsIVtF 5fSg== X-Gm-Message-State: APjAAAVKhZPvy0F75x1iHZXXLa17VR0FvuOyFlb23LaKagTGz4+ol6bR QFh8IDk1P+HzEqWIuqa/8UbmhDnrxHzy3StUCLo= X-Received: by 2002:a63:7d49:: with SMTP id m9mr283474pgn.161.1566938463070; Tue, 27 Aug 2019 13:41:03 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:06 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-14-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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 Tue Aug 27 20:40:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 172305 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp6308863ily; Tue, 27 Aug 2019 13:41:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy33NN8YF2AU4e44xLzqg4FD99H3FeJ5As0NsuXQSbu/pancPI/blPwDHT4uGm72Ghmzisd X-Received: by 2002:a63:a302:: with SMTP id s2mr275907pge.125.1566938470533; Tue, 27 Aug 2019 13:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566938470; cv=none; d=google.com; s=arc-20160816; b=qIiKNpdj2M753eZXeSNf7FmTgtkkBGODLd2alLBb0gHZZl7Uk3rC4EaSKXrPH6ZtSf LfPB79r7J83WKKSZGoBm6tYkhIrnQumCBdtA/ePnNTH/PAL31DDGfPUJopI90zo7TGCs VOVz3C7d1TFfeyEhmk+y6Ujf2giRhRKnBo8k0Pcqxdt0i8LQ8Eag6sSlcCqSv0hMb71+ zJMazZKQe60NsRA53XFXLis5Y7QWD8pbWhwGctLfmSogOz7yO17GmtWZa9CJXBHa5Qz2 EOcbJGrbb2PAmB9MntV3by9EBZRu5zL/0/laevmnJwLIYbjrr14OiD79EZFFkT2Pb44X Nfxg== 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=xayR1eaTOStHF5jKNWv1XVdOT2EVEaLrqieyOudEAew=; b=jn2PW+0aBjekdpa+7bbfTRNocZBEP1s5cyAxXXeMMWbN+dHgKCJ0XAfqdu2c41WNH4 egIXqouLoPpMZFlvPcpbvtmVVxB0WdUxdSwypfs/fVonIOvNSBFwALyioqETMVqe/32q yettCCtVgH6DhtyKefPfXM9miyKHvySAlg29Ei04SiJDKziHUrSJA6HXaNnybr4aQ85h kdm3KUFGNONJAfOb1lPjSN6nbAaeAbUCUkymp4MpRjtd6ZGj7FBiwQXrZfn74my5U2O/ ybf7kVo0v8wcqSTaO2rRHuUHGspWqAO/sLryjUMf1/yqic9zGv/Ly1IV6EJFvQVuCm3/ oMbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NHIhoqFM; 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 w4si101514pjr.76.2019.08.27.13.41.10; Tue, 27 Aug 2019 13:41:10 -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=NHIhoqFM; 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 S1730926AbfH0UlJ (ORCPT + 28 others); Tue, 27 Aug 2019 16:41:09 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:41539 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730438AbfH0UlG (ORCPT ); Tue, 27 Aug 2019 16:41:06 -0400 Received: by mail-pf1-f201.google.com with SMTP id 191so225426pfz.8 for ; Tue, 27 Aug 2019 13:41: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=xayR1eaTOStHF5jKNWv1XVdOT2EVEaLrqieyOudEAew=; b=NHIhoqFMbp5MdEk/zZR4BkgYP3OtmmrWat2vDnifQG7VpdLb8ymLES1nAKEPdRb7XW qjmB6tUw3vNvc+5O2wFghDgrdxpwGucqBvNtpiL9JE+nwKFgR4GA+rzh/2M8Kl1ofFPO 16QHFVi6WVK2Nhql5Vq4QbJzbYNNhRvXUWj0zi5jvg8k4ICb52Db9Xt3yvJEt5H3d8Iv /OcYJprQ8aPOC9FpjOlmj496KpwfbyjsGSKPvver9hp0nlEOqbFQb5Hpb569Hrps1qjf BPPoIbW6pLMIT/PiWXnLALASS1TG5OdI7SwRI/rIX8gb00S4Tr/mNs2rCPO7VvU5r8G5 VK9g== 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=xayR1eaTOStHF5jKNWv1XVdOT2EVEaLrqieyOudEAew=; b=GbEvixC6GkcfZj6jh+D9busntatKYRIXFVHw3iYfAWZ0nNYp97iJpXBo5r8Uwd3rsn cVVKQZ92nPETFibeskQ32HDGxM5qcXp4pQndvFUUV3nnz91wNlsW2Am3tJs6k33z4EP0 lk1q2C5vi64rJUPfOpBj07Vhpk/lCJrYfGGo51AEFgllTNGavMKC4bSnbpUmefW3LTDX QtkWqFYwdTPGN4u9R8kaXZwY6taiWiPAeEcJR6ntE4IcLnk30bJdQTpc2uSE1SuJzssC Vgi4Zr4W5BhQiBc1q7YJY5rQrs6LopAvCga9ZxikObBIKiRV0iB6qnbQ1BM0cFBnNYTq vX5w== X-Gm-Message-State: APjAAAXBPa3lqFcFzzur/xXlOcRmIUu/dTWyYdnoTNikggH+Q2Sl2+AN quhwKPBYXYZRkcJRQ5V6iR60pt2qMR1vAfwm8fA= X-Received: by 2002:a65:5cca:: with SMTP id b10mr265201pgt.365.1566938465537; Tue, 27 Aug 2019 13:41:05 -0700 (PDT) Date: Tue, 27 Aug 2019 13:40:07 -0700 In-Reply-To: <20190827204007.201890-1-ndesaulniers@google.com> Message-Id: <20190827204007.201890-15-ndesaulniers@google.com> Mime-Version: 1.0 References: <20190827204007.201890-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 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://bugs.llvm.org/show_bug.cgi?id=42950 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