https://sourceware.org/bugzilla/show_bug.cgi?id=24673

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-06-12
                 CC|                            |wilson at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> ---
The DTPMOD64 reloc is required for a shared library, and a PIE program is
basically a shared library with a few differences.  So this is probably a
failure to distinguish between pie and shared, and optimize them differently.

With this completely untested patch
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 69cadaa..ed8b9f1 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2182,7 +2182,7 @@ riscv_elf_relocate_section (bfd *output_bfd,

              /* The GOT entries have not been initialized yet.  Do it
                 now, and emit any relocations.  */
-             if ((bfd_link_pic (info) || indx != 0)
+             if ((bfd_link_dll (info) || indx != 0)
                  && (h == NULL
                      || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
                      || h->root.type != bfd_link_hash_undefweak))

I now get a R_RISCV_NONE for both the no-pie and pie cases, and still get a
DTPMOD64 reloc for the shared case.  This also makes the RISC-V code look more
like the MIPS code, so is probably correct.

I see that there are no uses of bfd_link_dll in elfnn-riscv.c currently, so
there are probably other similar cases to fix.

I haven't looked at why we get the R_RISCV_NONE yet.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to