]>
Commit | Line | Data |
---|---|---|
e36271ef GKH |
1 | From 3f0a53bc6482fb09770982a8447981260ea258dc Mon Sep 17 00:00:00 2001 |
2 | From: Yasha Cherikovsky <yasha.che3@gmail.com> | |
3 | Date: Fri, 8 Mar 2019 14:58:51 +0200 | |
4 | Subject: MIPS: Ensure ELF appended dtb is relocated | |
5 | ||
6 | From: Yasha Cherikovsky <yasha.che3@gmail.com> | |
7 | ||
8 | commit 3f0a53bc6482fb09770982a8447981260ea258dc upstream. | |
9 | ||
10 | This fixes booting with the combination of CONFIG_RELOCATABLE=y | |
11 | and CONFIG_MIPS_ELF_APPENDED_DTB=y. | |
12 | ||
13 | Sections that appear after the relocation table are not relocated | |
14 | on system boot (except .bss, which has special handling). | |
15 | ||
16 | With CONFIG_MIPS_ELF_APPENDED_DTB, the dtb is part of the | |
17 | vmlinux ELF, so it must be relocated together with everything else. | |
18 | ||
19 | Fixes: 069fd766271d ("MIPS: Reserve space for relocation table") | |
20 | Signed-off-by: Yasha Cherikovsky <yasha.che3@gmail.com> | |
21 | Signed-off-by: Paul Burton <paul.burton@mips.com> | |
22 | Cc: Ralf Baechle <ralf@linux-mips.org> | |
23 | Cc: Paul Burton <paul.burton@mips.com> | |
24 | Cc: James Hogan <jhogan@kernel.org> | |
25 | Cc: linux-mips@linux-mips.org | |
26 | Cc: linux-kernel@vger.kernel.org | |
27 | Cc: stable@vger.kernel.org # v4.7+ | |
28 | Signed-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 |