mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
riscv: module: Allocate PLT entries for R_RISCV_PLT32
apply_r_riscv_plt32_rela() may need to emit a PLT entry for the
referenced symbol, so there must be space allocated in the PLT.
Fixes: 8fd6c51423 ("riscv: Add remaining module relocations")
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20250409171526.862481-2-samuel.holland@sifive.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
This commit is contained in:
parent
0b4cce68ef
commit
1ee1313f47
|
|
@ -73,16 +73,17 @@ static bool duplicate_rela(const Elf_Rela *rela, int idx)
|
|||
static void count_max_entries(Elf_Rela *relas, int num,
|
||||
unsigned int *plts, unsigned int *gots)
|
||||
{
|
||||
unsigned int type, i;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
type = ELF_RISCV_R_TYPE(relas[i].r_info);
|
||||
if (type == R_RISCV_CALL_PLT) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
switch (ELF_R_TYPE(relas[i].r_info)) {
|
||||
case R_RISCV_CALL_PLT:
|
||||
case R_RISCV_PLT32:
|
||||
if (!duplicate_rela(relas, i))
|
||||
(*plts)++;
|
||||
} else if (type == R_RISCV_GOT_HI20) {
|
||||
break;
|
||||
case R_RISCV_GOT_HI20:
|
||||
if (!duplicate_rela(relas, i))
|
||||
(*gots)++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user