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 23:40:14 +0000

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

--- Comment #2 from Jim Wilson <wilson at gcc dot gnu.org> ---
The issue with the R_RISCV_NONE appears to be that we are pre-allocating space
for dynamic relocs, and accidentally allocating one more than we need.  This
space is apparently cleared someplace.  So it ends up looking like we have a
R_RISCV_NONE reloc in the extra unused reloc space.

The exact sequence appears to be we have a R_RISCV_TLS_GD_HI20 reloc, which
generates a call to riscv_elf_record_got_reference, which increments
elf_local_got_refcounts.  It also calls riscv_elf_record_tls_type which sets
the tls type to GOT_TLS_TD.  Then in riscv_elf_size_dynamic_sections, the fact
that local_got was set for a symbol, and the fact that the tls type is
GOT_TLS_TD, causes us to add one reloc to the srelgot size.  But we never write
a reloc into that space, so that ends up being the mysterious R_RISCV_NONE at
the end.

Fixing this looks complicated, and may need a rewrite to allocate space for
relocs when we actually generate relocs.  It looks like the MIPS port works
this way with the mips_elf_allocate_dynamic_relocations calls scattered around
the code.

-- 
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]