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.
This commit is contained in:
Michael Matz 2019-07-29 21:50:47 +02:00
parent 0cb6e3fff8
commit 9b0efa9346

View File

@ -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;
}