]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf symbol: Add RISCV case in get_plt_sizes
authorChen Pei <cp0613@linux.alibaba.com>
Tue, 17 Mar 2026 03:48:47 +0000 (11:48 +0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 18 Mar 2026 18:54:20 +0000 (11:54 -0700)
According to RISC-V psABI specification, the PLT (Program Linkage Table)
has the following layout:
- The first PLT entry occupies two 16-byte entries (32 bytes total)
- Subsequent PLT entries take up 16 bytes each

This aligns with the binutils-gdb implementation which defines the same
PLT sizes for RISC-V architecture.

Update get_plt_sizes() to set plt_header_size=32 and plt_entry_size=16
for EM_RISCV, matching the architecture's standard ABI.

Since AARCH64, LOONGARCH, and RISCV have the same PLT size definition,
they are merged together.

Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-riscv.c
Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
Reviewed-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/symbol-elf.c

index d7582dbf379ed053f085d5ed23ce33c15c3e2541..3cd4e5a03cc5d6f668ae2ea05dd782d8e97d44b8 100644 (file)
@@ -372,10 +372,8 @@ static bool get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt,
                *plt_entry_size = 12;
                return true;
        case EM_AARCH64:
-               *plt_header_size = 32;
-               *plt_entry_size = 16;
-               return true;
        case EM_LOONGARCH:
+       case EM_RISCV:
                *plt_header_size = 32;
                *plt_entry_size = 16;
                return true;