[PATCH] D39242: [ELF] - Stop naming relocation sections with first input section name.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 11:27:03 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/Writer.cpp:101
 
+  // This is normally used for --emit-relocs. With that we want
+  // to name relocation section similar to it's target section.
----------------
Is there an "abnormal" situation in which this code is used even if --emit-relocs is not given?


================
Comment at: ELF/Writer.cpp:104-110
+  for (StringRef V : {".rel.", ".rela."}) {
+    if (!Name.startswith(V))
+      continue;
+    StringRef Prefix = V.drop_back();
+    StringRef Target = getOutputSectionName(Name.drop_front(Prefix.size()));
+    return Saver.save(Prefix + Target);
+  }
----------------
Is this the same as this?

  if (Name.startswith(".rel."))
    return Saver.save(".rel." + getOutputSectionName(Name.substr(4)));
  if (Name.startswith(".rela."))
    return Saver.save(".rela." + getOutputSectionName(Name.substr(5)));


https://reviews.llvm.org/D39242





More information about the llvm-commits mailing list