summaryrefslogtreecommitdiffstats
path: root/arch/loongarch/kernel/vmlinux.lds.S
diff options
context:
space:
mode:
authorHuacai Chen <chenhuacai@loongson.cn>2022-12-10 15:39:59 +0100
committerHuacai Chen <chenhuacai@loongson.cn>2022-12-14 01:36:11 +0100
commit19e5eb15b00c5841b4b9bd9777af2865a40d2f39 (patch)
treef471107baccd8668f7cd72a2e8f5b5f690e30506 /arch/loongarch/kernel/vmlinux.lds.S
parentLoongArch: Add unaligned access support (diff)
downloadlinux-19e5eb15b00c5841b4b9bd9777af2865a40d2f39.tar.xz
linux-19e5eb15b00c5841b4b9bd9777af2865a40d2f39.zip
LoongArch: Add alternative runtime patching mechanism
Introduce the "alternative" mechanism from ARM64 and x86 for LoongArch to apply runtime patching. The main purpose of this patch is to provide a framework. In future we can use this mechanism (i.e., the ALTERNATIVE and ALTERNATIVE_2 macros) to optimize hotspot functions according to cpu features. Signed-off-by: Jun Yi <yijun@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/vmlinux.lds.S')
-rw-r--r--arch/loongarch/kernel/vmlinux.lds.S12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/vmlinux.lds.S b/arch/loongarch/kernel/vmlinux.lds.S
index efecda0c2361..733b16e8d55d 100644
--- a/arch/loongarch/kernel/vmlinux.lds.S
+++ b/arch/loongarch/kernel/vmlinux.lds.S
@@ -54,6 +54,18 @@ SECTIONS
. = ALIGN(PECOFF_SEGMENT_ALIGN);
_etext = .;
+ /*
+ * struct alt_inst entries. From the header (alternative.h):
+ * "Alternative instructions for different CPU types or capabilities"
+ * Think locking instructions on spinlocks.
+ */
+ . = ALIGN(4);
+ .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
+ __alt_instructions = .;
+ *(.altinstructions)
+ __alt_instructions_end = .;
+ }
+
.got : ALIGN(16) { *(.got) }
.plt : ALIGN(16) { *(.plt) }
.got.plt : ALIGN(16) { *(.got.plt) }