]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.32/mips-ensure-elf-appended-dtb-is-relocated.patch
Linux 4.19.32
[thirdparty/kernel/stable-queue.git] / releases / 4.19.32 / mips-ensure-elf-appended-dtb-is-relocated.patch
CommitLineData
e36271ef
GKH
1From 3f0a53bc6482fb09770982a8447981260ea258dc Mon Sep 17 00:00:00 2001
2From: Yasha Cherikovsky <yasha.che3@gmail.com>
3Date: Fri, 8 Mar 2019 14:58:51 +0200
4Subject: MIPS: Ensure ELF appended dtb is relocated
5
6From: Yasha Cherikovsky <yasha.che3@gmail.com>
7
8commit 3f0a53bc6482fb09770982a8447981260ea258dc upstream.
9
10This fixes booting with the combination of CONFIG_RELOCATABLE=y
11and CONFIG_MIPS_ELF_APPENDED_DTB=y.
12
13Sections that appear after the relocation table are not relocated
14on system boot (except .bss, which has special handling).
15
16With CONFIG_MIPS_ELF_APPENDED_DTB, the dtb is part of the
17vmlinux ELF, so it must be relocated together with everything else.
18
19Fixes: 069fd766271d ("MIPS: Reserve space for relocation table")
20Signed-off-by: Yasha Cherikovsky <yasha.che3@gmail.com>
21Signed-off-by: Paul Burton <paul.burton@mips.com>
22Cc: Ralf Baechle <ralf@linux-mips.org>
23Cc: Paul Burton <paul.burton@mips.com>
24Cc: James Hogan <jhogan@kernel.org>
25Cc: linux-mips@linux-mips.org
26Cc: linux-kernel@vger.kernel.org
27Cc: stable@vger.kernel.org # v4.7+
28Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30---
31 arch/mips/kernel/vmlinux.lds.S | 12 +++++++-----
32 1 file changed, 7 insertions(+), 5 deletions(-)
33
34--- a/arch/mips/kernel/vmlinux.lds.S
35+++ b/arch/mips/kernel/vmlinux.lds.S
36@@ -140,6 +140,13 @@ SECTIONS
37 PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
38 #endif
39
40+#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
41+ .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
42+ *(.appended_dtb)
43+ KEEP(*(.appended_dtb))
44+ }
45+#endif
46+
47 #ifdef CONFIG_RELOCATABLE
48 . = ALIGN(4);
49
50@@ -164,11 +171,6 @@ SECTIONS
51 __appended_dtb = .;
52 /* leave space for appended DTB */
53 . += 0x100000;
54-#elif defined(CONFIG_MIPS_ELF_APPENDED_DTB)
55- .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
56- *(.appended_dtb)
57- KEEP(*(.appended_dtb))
58- }
59 #endif
60 /*
61 * Align to 64K in attempt to eliminate holes before the