[llvm-commits] [PATCH] [lld][ELF] Add very basic support for IFUNC.
Shankar Kalpathi Easwaran
shankarke at gmail.com
Wed Jan 23 22:12:24 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];
+
----------------
shouldnt this be a ELFDefinedAtom ?
================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:70-71
@@ +69,4 @@
+ GOTAtom(const File &f, const DefinedAtom *target) : SimpleDefinedAtom(f) {
+ if (target->contentType() == DefinedAtom::typeResolver)
+ addReference(llvm::ELF::R_X86_64_IRELATIVE, 0, target, 0);
+ }
----------------
These references are tied to X86_64 and they shouldnt be in generic GOTAtom
================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:94
@@ +93,3 @@
+class PLTAtom : public SimpleDefinedAtom {
+ static const uint8_t _defaultContent[16];
+
----------------
why static, cant it be part of a instance variable ?
================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:93
@@ +92,3 @@
+
+class PLTAtom : public SimpleDefinedAtom {
+ static const uint8_t _defaultContent[16];
----------------
I think it should derive from ELFDefinedAtom
================
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_;
+ }
----------------
you need to have a sectionName too
================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:118-122
@@ +117,7 @@
+
+const uint8_t PLTAtom::_defaultContent[16] = {
+ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmpq *gotatom(%rip)
+ 0x68, 0x00, 0x00, 0x00, 0x00, // pushq pltentry
+ 0xe9, 0x00, 0x00, 0x00, 0x00 // jmpq plt[-1]
+ };
+
----------------
again, platform specific.
================
Comment at: lib/ReaderWriter/ELF/ELFTargetInfo.cpp:138-139
@@ +137,4 @@
+ for (const auto &ref : *atom) {
+ if (ref->kind() != llvm::ELF::R_X86_64_PC32)
+ continue;
+ if (const DefinedAtom *da = dyn_cast<const DefinedAtom>(ref->target())){
----------------
specific to X86_64.
http://llvm-reviews.chandlerc.com/D324
More information about the llvm-commits
mailing list