summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/head-64.h
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-05-29 17:39:40 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-05-30 14:59:51 +1000
commit951eedebcdea06fdcc742c82dc347509ce0e1ba4 (patch)
treee019d53fbd8e6f4e4edd0644440e62a1f4c5f038 /arch/powerpc/include/asm/head-64.h
parent4ea80652dc75482dca1739762075dd5caa57ae29 (diff)
downloadtalos-obmc-linux-951eedebcdea06fdcc742c82dc347509ce0e1ba4.tar.gz
talos-obmc-linux-951eedebcdea06fdcc742c82dc347509ce0e1ba4.zip
powerpc/64: Handle linker stubs in low .text code
Very large kernels may require linker stubs for branches from HEAD text code. The linker may place these stubs before the HEAD text sections, which breaks the assumption that HEAD text is located at 0 (or the .text section being located at 0x7000/0x8000 on Book3S kernels). Provide an option to create a small section just before the .text section with an empty 256 - 4 bytes, and adjust the start of the .text section to match. The linker will tend to put stubs in that section and not break our relative-to-absolute offset assumptions. This causes a small waste of space on common kernels, but allows large kernels to build and boot. For now, it is an EXPERT config option, defaulting to =n, but a reference is provided for it in the build-time check for such breakage. This is good enough for allyesconfig and custom users / hackers. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/head-64.h')
-rw-r--r--arch/powerpc/include/asm/head-64.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/head-64.h b/arch/powerpc/include/asm/head-64.h
index 86eb87382031..68828aa6e056 100644
--- a/arch/powerpc/include/asm/head-64.h
+++ b/arch/powerpc/include/asm/head-64.h
@@ -63,11 +63,29 @@
. = 0x0; \
start_##sname:
+/*
+ * .linker_stub_catch section is used to catch linker stubs from being
+ * inserted in our .text section, above the start_text label (which breaks
+ * the ABS_ADDR calculation). See kernel/vmlinux.lds.S and tools/head_check.sh
+ * for more details. We would prefer to just keep a cacheline (0x80), but
+ * 0x100 seems to be how the linker aligns branch stub groups.
+ */
+#ifdef CONFIG_LD_HEAD_STUB_CATCH
+#define OPEN_TEXT_SECTION(start) \
+ .section ".linker_stub_catch","ax",@progbits; \
+linker_stub_catch: \
+ . = 0x4; \
+ text_start = (start) + 0x100; \
+ .section ".text","ax",@progbits; \
+ .balign 0x100; \
+start_text:
+#else
#define OPEN_TEXT_SECTION(start) \
text_start = (start); \
.section ".text","ax",@progbits; \
. = 0x0; \
start_text:
+#endif
#define ZERO_FIXED_SECTION(sname, start, end) \
sname##_start = (start); \
OpenPOWER on IntegriCloud