[PATCH] [ELF]: Initial implementation for ARM static linking

Shankar Kalpathi Easwaran shankarke at gmail.com
Fri Nov 28 18:53:18 PST 2014


================
Comment at: lib/ReaderWriter/ELF/ARM/ARMELFFile.h:1
@@ +1,2 @@
+//===- lib/ReaderWriter/ELF/ARM/ARMELFFile.h ----------------------===//
+//
----------------
80 columns.

================
Comment at: lib/ReaderWriter/ELF/ARM/ARMELFFile.h:103-108
@@ +102,8 @@
+      return readAddend_THM_CALL(ap);
+    case llvm::ELF::R_ARM_CALL:
+    case llvm::ELF::R_ARM_JUMP24:
+      return readAddend_ARM_CALL(ap);
+    case llvm::ELF::R_ARM_THM_MOVW_ABS_NC:
+    case llvm::ELF::R_ARM_THM_MOVT_ABS:
+      return readAddend_THM_MOV(ap);
+    case llvm::ELF::R_ARM_THM_JUMP11:
----------------
All of the above would need to be done in the relocation  handler. We should not interpret the bits in the Reader, this way the Reader is agnostic to the symbol value.



================
Comment at: lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h:36
@@ +35,3 @@
+
+    _gotFile->addAtom(*new (_gotFile->_alloc) GLOBAL_OFFSET_TABLEAtom(*_gotFile));
+  }
----------------
This should be done only for dynamic executables.

================
Comment at: lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h:73
@@ +72,3 @@
+  result.push_back(std::move(_armRuntimeFile));
+  result.push_back(std::move(_gotFile));
+  return true;
----------------
same here, only for dynamic executables.

================
Comment at: lib/ReaderWriter/ELF/ARM/ARMLinkingContext.h:45
@@ +44,3 @@
+    case llvm::ELF::R_ARM_TLS_DTPOFF32:
+    case llvm::ELF::R_ARM_TLS_TPOFF32:
+    case llvm::ELF::R_ARM_COPY:
----------------
Why is this a dynamic relocation ?

================
Comment at: lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp:158-161
@@ +157,6 @@
+        }
+            // Process all references.
+            llvm::dbgs()
+            << "Defined Atoms"
+            << "\n");
+    for (const auto &atom : mf->defined()) {
----------------
You may need to manually indent.

================
Comment at: lib/ReaderWriter/ELF/ARM/TODO.rst:8
@@ +7,3 @@
+* Dynamic executable linking
+* DSO linking
+* PLT entries' generation for images larger than 2^28 bytes (see Sec. A.3 of the ELF reference)
----------------
you should also add ARM interoperability.

http://reviews.llvm.org/D6446






More information about the llvm-commits mailing list