Skip to content

Commit

Permalink
Revert "LoongArch: Add support for relocating the kernel with RELR re…
Browse files Browse the repository at this point in the history
…location"

This reverts commit 77f8884.
  • Loading branch information
Avenger-285714 committed Nov 28, 2024
1 parent 77f8884 commit 7dd8b2f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 33 deletions.
1 change: 0 additions & 1 deletion arch/loongarch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ config ARCH_SELECTS_CRASH_DUMP

config RELOCATABLE
bool "Relocatable kernel"
select ARCH_HAS_RELR
help
This builds the kernel as a Position Independent Executable (PIE),
which retains all relocation metadata required, so as to relocate
Expand Down
1 change: 0 additions & 1 deletion arch/loongarch/include/asm/asmmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@
lu32i.d \reg, 0
lu52i.d \reg, \reg, 0
.pushsection ".la_abs", "aw", %progbits
.p2align 3
.dword 766b
.dword \sym
.popsection
Expand Down
5 changes: 0 additions & 5 deletions arch/loongarch/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ extern long __la_abs_end;
extern long __rela_dyn_begin;
extern long __rela_dyn_end;

#ifdef CONFIG_RELR
extern long __relr_dyn_begin;
extern long __relr_dyn_end;
#endif

extern unsigned long __init relocate_kernel(void);

#endif
Expand Down
18 changes: 0 additions & 18 deletions arch/loongarch/kernel/relocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,6 @@ static inline void __init relocate_relative(void)

*(Elf64_Addr *)RELOCATED(addr) = relocated_addr;
}

#ifdef CONFIG_RELR
u64 *addr = NULL;
u64 *relr = (u64 *)&__relr_dyn_begin;
u64 *relr_end = (u64 *)&__relr_dyn_end;

for ( ; relr < relr_end; relr++) {
if ((*relr & 1) == 0) {
addr = (u64 *)(*relr + reloc_offset);
*addr++ += reloc_offset;
} else {
for (u64 *p = addr, r = *relr >> 1; r; p++, r >>= 1)
if (r & 1)
*p += reloc_offset;
addr += 63;
}
}
#endif
}

static inline void __init relocate_absolute(long random_offset)
Expand Down
8 changes: 0 additions & 8 deletions arch/loongarch/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ SECTIONS
__rela_dyn_end = .;
}

#ifdef CONFIG_RELR
.relr.dyn : ALIGN(8) {
__relr_dyn_begin = .;
*(.relr.dyn)
__relr_dyn_end = .;
}
#endif

.data.rel : { *(.data.rel*) }

#ifdef CONFIG_RELOCATABLE
Expand Down

0 comments on commit 7dd8b2f

Please sign in to comment.