Skip to content

Commit 3f0a53b

Browse files
yashac3paulburton
authored andcommitted
MIPS: Ensure ELF appended dtb is relocated
This fixes booting with the combination of CONFIG_RELOCATABLE=y and CONFIG_MIPS_ELF_APPENDED_DTB=y. Sections that appear after the relocation table are not relocated on system boot (except .bss, which has special handling). With CONFIG_MIPS_ELF_APPENDED_DTB, the dtb is part of the vmlinux ELF, so it must be relocated together with everything else. Fixes: 069fd76 ("MIPS: Reserve space for relocation table") Signed-off-by: Yasha Cherikovsky <yasha.che3@gmail.com> Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul Burton <paul.burton@mips.com> Cc: James Hogan <jhogan@kernel.org> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org # v4.7+
1 parent 5f5f67d commit 3f0a53b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

arch/mips/kernel/vmlinux.lds.S

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ SECTIONS
140140
PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
141141
#endif
142142

143+
#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
144+
.appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
145+
*(.appended_dtb)
146+
KEEP(*(.appended_dtb))
147+
}
148+
#endif
149+
143150
#ifdef CONFIG_RELOCATABLE
144151
. = ALIGN(4);
145152

@@ -164,11 +171,6 @@ SECTIONS
164171
__appended_dtb = .;
165172
/* leave space for appended DTB */
166173
. += 0x100000;
167-
#elif defined(CONFIG_MIPS_ELF_APPENDED_DTB)
168-
.appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
169-
*(.appended_dtb)
170-
KEEP(*(.appended_dtb))
171-
}
172174
#endif
173175
/*
174176
* Align to 64K in attempt to eliminate holes before the

0 commit comments

Comments
 (0)