bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/24676] [RISCV] Redundant R_RISCV_DTPMOD* R_RISCV_DTPREL* resulte


From: wilson at gcc dot gnu.org
Subject: [Bug ld/24676] [RISCV] Redundant R_RISCV_DTPMOD* R_RISCV_DTPREL* resulted from Glocal Dynamic -> Local Exec relaxation
Date: Thu, 13 Jun 2019 20:43:21 +0000

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

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

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

--- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> ---
Assuming that the MIPS port is handling this right, then the completely
untested fix is as follows

diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 69cadaa..ac55563 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2176,13 +2176,14 @@ riscv_elf_relocate_section (bfd *output_bfd,
                  pic = bfd_link_pic (info);

                  if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, pic, h)
-                     && (!pic || !SYMBOL_REFERENCES_LOCAL (info, h)))
+                     && (bfd_link_dll (info)
+                         || !SYMBOL_REFERENCES_LOCAL (info, h)))
                    indx = h->dynindx;
                }

              /* 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))

Note that this necessarily includes the fix for bug 24673.  With this fix, I
now get
0000000000000000  0000000000000000 R_RISCV_NONE                              0
0000000000000000  0000000000000000 R_RISCV_NONE                              0
0000000000012018  0000000100000007 R_RISCV_TLS_DTPMOD64   0000000000000000 b +
0
0000000000012020  0000000100000009 R_RISCV_TLS_DTPREL64   0000000000000000 b +
0

Also note as in bug 24673 we preallocated space for the TLS relocs for a, which
is why we now have R_RISCV_NONE relocs.


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=24673
[Bug 24673] [RISCV] -fPIC -pie and -fPIC -no-pie create unexpected R_RISCV_NONE
R_RISCV_DTPMOD64 relocations
-- 
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]