[PATCH] add support for LayoutAfter/LayoutBefore references

Michael Spencer bigcheesegs at gmail.com
Thu Feb 7 11:44:09 PST 2013



================
Comment at: lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp:96-97
@@ -95,2 +95,4 @@
     break;
-  default: {
+  case lld::Reference::kindLayoutAfter:
+  case lld::Reference::kindLayoutBefore:
+    break;
----------------
This needs to include in group. Same for the other target infos.

================
Comment at: lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp:99
@@ -98,3 +98,3 @@
   }
-  // Runtime only relocations. Ignore here.
+    // Runtime only relocations. Ignore here.
   case R_X86_64_IRELATIVE:
----------------
This formatting changes is wrong.

================
Comment at: lib/ReaderWriter/ELF/File.h:330
@@ -298,3 +329,3 @@
     for (auto &ri : _references) {
-      const Elf_Sym *Symbol = _objFile->getElfSymbol(ri->targetSymbolIndex());
-      ri->setTarget(findAtom(Symbol));
+      if (ri->kind() > lld::Reference::kindLayoutBefore) {
+        const Elf_Sym *Symbol = _objFile->getElfSymbol(ri->targetSymbolIndex());
----------------
It's not obvious that this means "if it's not a core reference kind". We should have a kindTargetLow = 0.

================
Comment at: lib/ReaderWriter/ELF/File.h:307-316
@@ -288,1 +306,12 @@
 
+        // If we are inserting a followOn reference, lets add a precededBy 
+        // reference too
+        if (followOn) {
+          ELFReference<ELFT> *precededBy = nullptr;
+          followOn->setTarget(newAtom);
+          precededBy = new (_readerStorage)
+              ELFReference<ELFT>(lld::Reference::kindLayoutBefore);
+          precededBy->setTarget(previous_atom);
+          newAtom->addReference(precededBy);
+        }
+
----------------
Aren't these completely redundant?

================
Comment at: include/lld/Passes/Passes.h:1-14
@@ +1,14 @@
+//===------ Passes/Passes.h - A Uber header file containing all passes----===//
+//
+//                             The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLD_LIB_PASSES_ALL_PASSES
+#define LLD_LIB_PASSES_ALL_PASSES
+
+#include "LayoutPass.h"
+
+#endif 
----------------
Clients should include the passes they need.

================
Comment at: include/lld/Core/Reference.h:69-71
@@ +68,5 @@
+      return kindInGroup;
+    else if (kindString == "layoutbefore")
+      return kindLayoutBefore;
+    else if (kindString == "layoutafter")
+      return kindLayoutAfter;
----------------
Missing '-'


http://llvm-reviews.chandlerc.com/D373



More information about the llvm-commits mailing list