Skip to contentSkip to conversation

powerpc/64: place .text immediately following .head.text

PATCH Applied Nicholas Piggin 2 participants 2 messages Nov 26, 2016 – Dec 3, 2016 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 1/1 powerpc/64: place .text immediately following .head.text

Do not introduce any additional alignment. Placement of text section will be set by fixed section macros. Without this, output section alignment defaults to 4096, which makes BookE text section start at 0x1000 when it is expected to start at 0x100.

This was introduced by 57f266497d81 ("powerpc: Use gas sections for arranging exception vectors") and was caught with the scripted head section checker (not yet merged).

Fixes 57f266497d81
---
 arch/powerpc/kernel/vmlinux.lds.S | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/powerpc/kernel/vmlinux.lds.S +9 -0
index 8295f51..7394b77 100644
@@ -94,8 +94,17 @@ SECTIONS
 	 * detected, and will result in a crash at boot due to offsets being
 	 * wrong.
 	 */
+#ifdef CONFIG_PPC64
+	/*
+	 * BLOCK(0) overrides the default output section alignment because
+	 * this needs to start right after .head.text in order for fixed
+	 * section placement to work.
+	 */
+	.text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
+#else
 	.text : AT(ADDR(.text) - LOAD_OFFSET) {
 		ALIGN_FUNCTION();
+#endif
 		/* careful! __ftr_alt_* sections need to be close to .text */
 		*(.text .fixup __ftr_alt_* .ref.text)
 		SCHED_TEXT
Signature · 1 line
2.10.2
#1 lore raw
Quoted 11 lines · Nicholas Piggin

Do not introduce any additional alignment. Placement of text section will be set by fixed section macros. Without this, output section alignment defaults to 4096, which makes BookE text section start at 0x1000 when it is expected to start at 0x100.

This was introduced by 57f266497d81 ("powerpc: Use gas sections for arranging exception vectors") and was caught with the scripted head section checker (not yet merged).

Fixes 57f266497d81

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/dadc4a1bb9f0095343ed9dd4f1d9f3

cheers