bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/24673] [RISCV] -fPIC -pie and -fPIC -no-pie create unexpected R_


From: wilson at gcc dot gnu.org
Subject: [Bug ld/24673] [RISCV] -fPIC -pie and -fPIC -no-pie create unexpected R_RISCV_NONE R_RISCV_DTPMOD64 relocations
Date: Wed, 12 Jun 2019 21:21:51 +0000

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]