[PATCH] [lld] [ELF/AArch64] Fix TLS initial executable relocation

Rui Ueyama ruiu at google.com
Wed Jun 3 10:47:33 PDT 2015


================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.cpp:20
@@ +19,3 @@
+                                                 AArch64TargetLayout &layout)
+  : ExecutableWriter(ctx, layout), _targetLayout(layout)
+{
----------------
Write "{}" at end of this line.

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.cpp:35
@@ +34,3 @@
+void AArch64ExecutableWriter::buildDynamicSymbolTable(const File &file)
+{
+  for (auto sec : this->_layout.sections())
----------------
Move this at end of the previous line.

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.cpp:36
@@ +35,3 @@
+{
+  for (auto sec : this->_layout.sections())
+    if (auto section = dyn_cast<AtomSection<ELF64LE>>(sec))
----------------
Adding { would be better for readability.

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp:215
@@ +214,3 @@
+  std::error_code handleGOTTPREL(const Reference &ref) {
+    if (const auto *target = dyn_cast<DefinedAtom>(ref.target())) {
+      const_cast<Reference &>(ref).setTarget(getGOTTPREL(ref.target()));
----------------
Use isa instead of dyn_cast.

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64SectionChunks.cpp:19
@@ +18,3 @@
+                         TargetLayout<ELF64LE>::ORDER_GOT)
+{
+  this->_alignment = 8;
----------------
Fix format.

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64SectionChunks.cpp:30
@@ +29,3 @@
+    assert(r->kindArch() == Reference::KindArch::AArch64);
+    switch (r->kindValue()) {
+    case R_AARCH64_TLS_TPREL64:
----------------
A switch statement with only one case looks a bit weird. Maybe replace with an if?

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64SectionChunks.h:9
@@ +8,3 @@
+//===----------------------------------------------------------------------===//
+#ifndef LLD_READER_WRITER_ELF_AARCH64_AARCH64_SECTION_CHUNKS_H
+#define LLD_READER_WRITER_ELF_AARCH64_AARCH64_SECTION_CHUNKS_H
----------------
Add newline before this line.

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp:24
@@ +23,3 @@
+{
+}
+
----------------
Format.

================
Comment at: lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h:28
@@ -25,2 +27,3 @@
 public:
-  AArch64TargetLayout(ELFLinkingContext &ctx) : TargetLayout(ctx) {}
+  AArch64TargetLayout(ELFLinkingContext &ctx); // : TargetLayout(ctx) {}
+
----------------
Debug comment?

http://reviews.llvm.org/D10219

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list