[PATCH] D43952: [ELF][MIPS] Don't change every dynamic relocation into R_MIPS_REL32

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 10:16:15 PST 2018

ruiu added inline comments.

Comment at: ELF/Arch/Mips.cpp:191
 template <class ELFT> RelType MIPS<ELFT>::getDynRel(RelType Type) const {
-  return RelativeRel;
+  // TODO: are there any that need to change?
+  return Type;
arichardson wrote:
> ruiu wrote:
> > Is this correct? getDynRel is supposed to return a dynamic relocation type for a given static relocation type. Currently it returns a platform-specific relocation type for the dynamic relocation, which seems correct to me.
> I am not sure if the TLS relocations need any change but for preemptible relocations in the data section we want to emit an absolute relocation that RTLD can fill in and not one that just adds the base address to the addend.
> I looked at both FreeBSD rtld and glib rtld and both only add the current objects base address for R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE (Target->RelativeRel) which will break any pointers to undefined symbols in the data section.
Sorry I think I didn't understand this function well. I believe this change is correct. You can remove this function entirely because it is a virtual function, and the base class' function does the same thing as this function does.

  rLLD LLVM Linker


More information about the llvm-commits mailing list