[PATCH] RISC-V: Eliminate spurious error w/ reloc truncated message

Jim Wilson jimw@sifive.com
Thu Feb 8 21:19:00 GMT 2018

I don't see a similar comment in any other port, but it seems reasonable.  Many
ports just return true unconditionally here.  The riscv port has support to
return false if a malloc call fails.  Otherwise, it should not return false
at present.



	* elfnn-riscv.c (riscv_elf_relocate_section): Add comment for previous
 bfd/elfnn-riscv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index a37f4aac76..dd9c300b5e 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2253,6 +2253,8 @@ riscv_elf_relocate_section (bfd *output_bfd,
       if (msg)
 	  (info, msg, name, input_bfd, input_section, rel->r_offset);
+      /* We already reported the error via a callback, so don't try to report
+	 it again by returning false.  That leads to spurious errors.  */
       ret = TRUE;
       goto out;

More information about the Binutils mailing list