From 20561b893d5b15717b8b615080b876f8461053f5 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 14 Nov 2022 21:43:30 +0000 Subject: [PATCH] Add riscv64 support to the linker relocation benchmark. Change-Id: I8274826803a07016b9fd08efe60a2f1c77751c5d Signed-off-by: Mao Han Signed-off-by: Xia Lifang Signed-off-by: Chen Guoyin Signed-off-by: Wang Chen Signed-off-by: Lu Xufan Test: `mm -j` in bionic/ --- .../linker_relocation/include/linker_reloc_bench_asm.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h b/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h index 2ff3d810a..885e47fb4 100644 --- a/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h +++ b/benchmarks/linker_relocation/include/linker_reloc_bench_asm.h @@ -42,6 +42,15 @@ #define DATA_WORD(val) .quad val #define MAIN .globl main; main: mov w0, wzr; ret +#elif defined(__riscv) + +// No `lga` in clang unless https://reviews.llvm.org/D107278 lands. +// `la` is equivalent when using PIC (which we do) though. +#define GOT_RELOC(sym) la a0, sym +#define CALL(sym) call sym@plt +#define DATA_WORD(val) .quad val +#define MAIN .globl main; main: li a0, 0; ret + #elif defined(__i386__) #define GOT_RELOC(sym) .long sym@got