From 9b0efa934621dfc956e909adadeabd9351328c11 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 29 Jul 2019 21:50:47 +0200 Subject: [PATCH] riscv: Make PLT reloc be AUTO_GOT relocs against defined symbols are replaced by relative relocs, when a GOT slot is created. But code relocs (usually calls via PLT) use the plt_offset member of attr, not the got_offset member, so the "huh" warning was triggered in the case of calls to static functions (the code still worked). So, for now just use the AUTO_GOT_PLT mechanism. We could also emit a non-PLT reloc in the backend for calls to VT_STATIC functions (like the x86-64 backend does) and do the same as for x86-64 in build_got_entries (which transforms PLT32 into PC32 relocs, riscv would transform CALL_PLT into CALL relocs). Maybe later. --- riscv64-link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv64-link.c b/riscv64-link.c index 6e850aef..b52ceca8 100644 --- a/riscv64-link.c +++ b/riscv64-link.c @@ -87,10 +87,10 @@ int gotplt_entry_type (int reloc_type) case R_RISCV_32: case R_RISCV_64: case R_RISCV_JAL: + case R_RISCV_CALL_PLT: return AUTO_GOTPLT_ENTRY; case R_RISCV_GOT_HI20: - case R_RISCV_CALL_PLT: return ALWAYS_GOTPLT_ENTRY; }