[PATCH] [lld][ELF] Ability to resolve undefined symbols lazily

Rui Ueyama ruiu at google.com
Mon Mar 9 10:51:46 PDT 2015


This is not a specific comment to this patch, but this patch is too complicated than it can be. It's not your fault, though.

What you are trying to do with this patch is "try to resolve _GLOBAL_OFFSET_TABLE_ as an absolute symbol to .got.plt if there is any reference to the symbol. If .got.plt doesn't exist, use 0 as its address". That's simple. But this patch involves notions of virtual archive file, virtual file, finalizeInputFiles hook and so on and so on. Something is wrong. Maybe the very notion of "virtual archive file generating atoms on demand" is not a good way to do this kind of things, contrary to our expectations. I don't have any specific plan, but I see rooms to simplify this part of the linker. We need to revisit this.


================
Comment at: include/lld/Core/Simple.h:105
@@ +104,3 @@
+
+  File *find(StringRef sym, bool dataSymbolOnly) override {
+    // For descendants:
----------------
I expect all subclasses need to implement this function, so it's better to not define this here, so that the compiler raises an error if definition is missing.

================
Comment at: lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h:87
@@ +86,3 @@
+    StringRef symName, CRuntimeFile<ELFT> *file) const {
+
+  if (symName == gotSymbol) {
----------------
Remove this line

================
Comment at: lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h:100
@@ -99,3 +67,1 @@
-};
-
 // A file to make Resolver to resolve a symbol TO instead of a symbol FROM,
----------------
Thank you for doing this!

http://reviews.llvm.org/D8159

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list