[PATCH] D14140: [ELF2] SECTIONS command basic support

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 08:50:44 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/OutputSections.h:98-99
@@ -97,2 +97,4 @@
 
+  enum Kind { OutputKind, MergeOutputKind, OtherKind };
+  virtual Kind kind() const { return OtherKind; }
   virtual void finalize() {}
----------------
Why do you need this?

================
Comment at: ELF/Writer.cpp:92-107
@@ -82,1 +91,18 @@
+
+template <class ELFT> class LinkerScriptWriter : public Writer<ELFT> {
+public:
+  LinkerScriptWriter(SymbolTable<ELFT> &S) : Writer<ELFT>(S) {
+    parseSectionDescriptions();
+  }
+
+private:
+  void parseSectionDescriptions();
+  bool compareOutputSections(OutputSectionBase<ELFT> *A,
+                             OutputSectionBase<ELFT> *B) const override;
+  bool discardInputSection(InputSectionBase<ELFT> *IS) const override;
+  bool hasBoundingSymbols(OutputSectionBase<ELFT> *OS) const override;
+  StringRef getOutputSectionName(StringRef S) const override;
+
+  llvm::StringMap<llvm::StringRef> InputToOutputSection;
+};
 } // anonymous namespace
----------------
No, please don't make another Writer class. This is over-engineering. There's no such need to support two writers, one for ELF without linker script and another for ELF + linker script.



http://reviews.llvm.org/D14140





More information about the llvm-commits mailing list