[llvm-commits] [PATCH] [lld][ELF] Add very basic support for IFUNC.

Shankar Kalpathi Easwaran shankarke at gmail.com
Thu Jan 24 05:46:45 PST 2013



================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:65-66
@@ -58,1 +64,4 @@
 
+class GOTAtom : public SimpleDefinedAtom {
+  static const uint8_t _defaultContent[8];
+
----------------
Michael Spencer wrote:
> Shankar Kalpathi Easwaran wrote:
> > shouldnt this be a ELFDefinedAtom ?
> Why? The Writer is only going to see it as a DefinedAtom.
Oh Yeah, got your point, but since you are going to add ELF type references to the Atom, I thought it would make better sense to have it as ELFDefinedAtom. Also how are you keeping the symbol information, that you have created a GOT entry or that symbol ?

================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:94
@@ +93,3 @@
+class PLTAtom : public SimpleDefinedAtom {
+  static const uint8_t _defaultContent[16];
+
----------------
Michael Spencer wrote:
> Shankar Kalpathi Easwaran wrote:
> > why static, cant it be part of a instance variable ?
> It doesn't need to be yet, I'd like to keep memory usage down.
Got it. Keeping memory usage down is also pretty important.

================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:74-83
@@ +73,12 @@
+
+  virtual ContentType contentType() const {
+    return DefinedAtom::typeGOT;
+  }
+
+  virtual uint64_t size() const {
+    return rawContent().size();
+  }
+
+  virtual ContentPermissions permissions() const {
+    return DefinedAtom::permRW_;
+  }
----------------
Michael Spencer wrote:
> Shankar Kalpathi Easwaran wrote:
> > you need to have a sectionName too
> It already has typeGOT, the writer should assign a section name.
If you have a section Name, ELFLayout could automatically add atoms to the appropriate section. And Target can just override the order. 

I am also planning on registering certain section names in the TargetHandler so that when an Atom is added to a section that is registered by the target, you call the targetHandler for it.


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



More information about the llvm-commits mailing list