[PATCH] [Core] Add type and size to SharedLibraryAtom

kledzik at apple.com kledzik at apple.com
Wed Sep 25 15:57:25 PDT 2013


  This could be two patches.  The first adds the type/size info the SharedLibraryAtoms and has core test cases that shows that info is propagated properly.  The second patches enhances ELF linking to use type/size to correctly created R_X86_64_COPY relocs and add ELF specific test cases.


================
Comment at: include/lld/Core/SharedLibraryAtom.h:25-30
@@ -24,2 +24,8 @@
 public:
+  enum Type {
+    Unknown,
+    Function,
+    Object,
+  };
+
   /// Returns shared library name used to load it at runtime.
----------------
These names only make sense if you know  STT_FUNC and  STT_OBJECT.  How about: unknown, code, data.  Also the SharedLibraryAtom is still small enough to get away with generic names like this, but making it an enum class would scope the names better.

================
Comment at: include/lld/Core/SharedLibraryAtom.h:43
@@ +42,3 @@
+
+  virtual uint64_t size() const = 0;
+
----------------
This is a crazy runtime model that the build time size is needed.  It is not a very dynamic DSO if the data size grows and that breaks existing programs.   Does the loader check that the size in the program is the same as found in the DSO? or does it just blindly always copy just that much.


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



More information about the llvm-commits mailing list