[PATCH] D35944: [ELF] Disable relocation validation when targeting weak undefined symbols

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 01:11:03 PDT 2017


jhenderson added inline comments.


================
Comment at: ELF/InputSection.cpp:731-733
+      bool UndefinedWeak = (Rel.Sym->isUndefined() || Rel.Sym->isLazy()) &&
+                           !Rel.Sym->isLocal() && Rel.Sym->symbol()->isWeak();
+      Target->relocateOne(BufLoc, Type, TargetVA, !UndefinedWeak);
----------------
ruiu wrote:
> I wonder if you really have to change this many places to handle weak undefined symbols. If you don't call `relocateOne` if `UndefinedWeak` is true, doesn't it work?
I'm happy to do that. The only reason I did it this way was to match ld.bfd and gold's behaviour in this situation, but I don't think it really matters (the call should never be executed anyway).


https://reviews.llvm.org/D35944





More information about the llvm-commits mailing list