Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

riscv: Move .rela.dyn outside of init to avoid empty relocations

This is a preparatory patch for relocatable kernels: .rela.dyn should be
in .init but doing so actually produces empty relocations, so this should
be a temporary commit until we find a solution.

This issue was reported here [1].

[1] https://lore.kernel.org/all/4a6fc7a3-9697-a49b-0941-97f32194b0d7@ghiti.fr/.

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20230329045329.64565-3-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

authored by

Alexandre Ghiti and committed by
Palmer Dabbelt
69a90d2f 55de1e4a

+4 -4
+4 -4
arch/riscv/kernel/vmlinux.lds.S
··· 96 96 *(.rel.dyn*) 97 97 } 98 98 99 - .rela.dyn : { 100 - *(.rela*) 101 - } 102 - 103 99 __init_data_end = .; 104 100 105 101 . = ALIGN(8); ··· 120 124 .sdata : { 121 125 __global_pointer$ = . + 0x800; 122 126 *(.sdata*) 127 + } 128 + 129 + .rela.dyn : { 130 + *(.rela*) 123 131 } 124 132 125 133 #ifdef CONFIG_EFI