From patchwork Mon Jan 25 15:41:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101125 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1432492lbb; Mon, 25 Jan 2016 07:43:33 -0800 (PST) X-Received: by 10.66.102.40 with SMTP id fl8mr26748639pab.136.1453736613020; Mon, 25 Jan 2016 07:43:33 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ui8si34306952pac.217.2016.01.25.07.43.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2016 07:43:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aNjIM-0008V3-BL; Mon, 25 Jan 2016 15:43:10 +0000 Received: from mout.kundenserver.de ([212.227.126.131]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aNjIH-0008Iu-Pg; Mon, 25 Jan 2016 15:43:08 +0000 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0MYXbd-1abBel0wZF-00VCjv; Mon, 25 Jan 2016 16:42:42 +0100 From: Arnd Bergmann To: Arnd Bergmann , David Woodhouse , Brian Norris Subject: [PATCH] mtd: only use __xipram annotation when XIP_KERNEL is set Date: Mon, 25 Jan 2016 16:41:50 +0100 Message-Id: <1453736525-1959191-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:MCBJ16JsWC0QVuzrcw8BG55N67VQT3nY4VoMQ9JENAuyTtsT7fL OTMVPBkfWy0P7BHt44ni2IMu/FZ7F+LqoECpzBSwRZaIBiBgwUb2Ids24h9wUvAYaUTwbbi FtSG2E8cAQVlhf+eRDSMg2WJtO+3IgCzIzZSNE3Q2tIKL2gbYUP7RThuIHJQHKU33bvAxfU +JReTFi+DAMA77ftc/GOQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:gt5rPuqdO94=:YCIlLACL+kUwjgmg/uoxBo ryZTJanz/OX6L0YZLiBQnqHlJNssMKw/2HjThCLY1MtJEXYDIytOvUOpxLoG91+jIdov5xOyS F74BWOGj4T1Y2O2kRjhZLjzDljbvZ1O2xCJ3aSFcFQY6d2wWpaSsFXeV5pbr4UjSssNvpDZq4 atLSs727m5rQ5Z4bqBc5FDRZ9oUk/wLXfp470Bn1VCh2dwz21Xu2AkhrnWZwAvAzH56JkBMum F4haTSdPPryk08N/HqVLk/SRFWtogfY8m1QyUb7EvsYc7rj8+0S3VPq1TUuWAnOM4yKtc+396 Z6u20CbubNZuYZzgcL3/lrWh+kC70iOoXGTfD2POM/a2Yu3nwDY/wFc/g9DiiPZY5XHDY7mid Eo9nu8XjvoMR9PBNDP7OejU+/7zROW7ykTBNJQrjcFIdq46D88Ae7r70+jl4+8ktK/iEYg0Im pO5dhd7dheToTH4WdVYb6Gh84/TitNvtuZlLuDTcqPV9QD9dzyXP9+d/bCtYgaRDpHNzeNBSm WpjCgXEGY28CarkaAtNF0cVVwyWVWPX6mluIBodVcqViWUTD2zoVPJukstMr4ivlGuUR8jjEY T4Gl5q75WZyZHzUsxfFVJc5CfAD0vol/EDA/OdejHR50LN1UYPElmXbHEGhMjAyfgaB1YQ/Ff kVgBMXv/+RffVOZ7s/POMTY4WogH4eldW2ITi1xIHGwQowCY5eHDY2RgVUt+T4Bi2uzE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160125_074306_497602_0D1F641A X-CRM114-Status: GOOD ( 13.80 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.131 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.131 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org When XIP_KERNEL is enabled, some functions are defined in the .data ELF section because we require them to be in RAM whenever we communicate with the flash chip. However this causes problems when FTRACE is enabled and gcc emits calls to __gnu_mcount_nc in the function prolog: drivers/built-in.o: In function `cfi_chip_setup': :(.data+0x272fc): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o drivers/built-in.o: In function `cfi_probe_chip': :(.data+0x27de8): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o /tmp/ccY172rP.s: Assembler messages: /tmp/ccY172rP.s:70: Warning: ignoring changed section attributes for .data /tmp/ccY172rP.s: Error: 1 warning, treating warnings as errors make[5]: *** [drivers/mtd/chips/cfi_probe.o] Error 1 /tmp/ccK4rjeO.s: Assembler messages: /tmp/ccK4rjeO.s:421: Warning: ignoring changed section attributes for .data /tmp/ccK4rjeO.s: Error: 1 warning, treating warnings as errors make[5]: *** [drivers/mtd/chips/cfi_util.o] Error 1 /tmp/ccUvhCYR.s: Assembler messages: /tmp/ccUvhCYR.s:1895: Warning: ignoring changed section attributes for .data /tmp/ccUvhCYR.s: Error: 1 warning, treating warnings as errors Specifically, this does not work because the .data section is not marked executable, which leads LD to not generate trampolines for long calls. This moves the __xipram functions into their own .xiptext section instead. The section is still placed next to .data and located in RAM but is marked executable, which avoids the build errors. Also, we only need to place the XIP functions into a separate section if both CONFIG_XIP_KERNEL and CONFIG_MTD_XIP are set: When only MTD_XIP is used, the whole kernel is still in RAM and we do not need to worry about pulling out the rug under it. When only XIP_KERNEL but not MTD_XIP is set, the kernel is in some form of ROM, but we never write to it. Signed-off-by: Arnd Bergmann --- include/asm-generic/vmlinux.lds.h | 1 + include/linux/mtd/xip.h | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) -- 2.7.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index c4bd0e2c173c..73a2c72e4252 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -199,6 +199,7 @@ /* .data section */ #define DATA_DATA \ + *(.xiptext) \ *(.data) \ *(.ref.data) \ *(.data..shared_aligned) /* percpu related */ \ diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h index abed4dec5c2f..e373690cce0a 100644 --- a/include/linux/mtd/xip.h +++ b/include/linux/mtd/xip.h @@ -30,7 +30,9 @@ * obviously not be running from flash. The __xipram is therefore marking * those functions so they get relocated to ram. */ -#define __xipram noinline __attribute__ ((__section__ (".data"))) +#ifdef CONFIG_XIP_KERNEL +#define __xipram noinline __attribute__ ((__section__ (".xiptext"))) +#endif /* * Each architecture has to provide the following macros. They must access @@ -90,10 +92,10 @@ #define xip_cpu_idle() do { } while (0) #endif -#else +#endif /* CONFIG_MTD_XIP */ +#ifndef __xipram #define __xipram - -#endif /* CONFIG_MTD_XIP */ +#endif #endif /* __LINUX_MTD_XIP_H__ */