[PATCH] [lld] Teach LLD how to parse complete linker scripts

Shankar Kalpathi Easwaran shankarke at gmail.com
Sat Oct 25 20:50:49 PDT 2014


================
Comment at: include/lld/ReaderWriter/LinkerScript.h:42-68
@@ -40,1 +41,29 @@
     r_paren,
+    star,
+    starequal,
+    plus,
+    plusequal,
+    comma,
+    minus,
+    minusequal,
+    slash,
+    slashequal,
+    number,
+    colon,
+    semicolon,
+    less,
+    lessequal,
+    lessless,
+    lesslessequal,
+    equal,
+    equalequal,
+    greater,
+    greaterequal,
+    greatergreater,
+    greatergreaterequal,
+    question,
+    identifier,
+    libname,
+    kw_align,
+    kw_align_with_input,
+    kw_as_needed,
----------------
rafaelauler wrote:
> shankarke wrote:
> > All of the above need to have a prefix.Also you may need to sort all the enumerated constants like others to be consistent.
> > 
> > http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
> I just kept the coding style I found in this file, whose original author is not me. For me, it's no problem to convert this to the official LLVM naming convention.
> 
> This enum is already sorted according to Rui's suggestion, by using the ASCII table order.
> 
> Correct me if I'm wrong, but I think we can drop the prefix here, according to official LLVM naming rules. If the enum is inside a class, the prefix is not necessary.
We are following a mixed pattern here, for some we use a kw_ to start the enumeration with, there are _(underscore patterns) and non underscore patterns, I am not sure on what we want to rename but I think it would be nice if we are consistent in naming the enumerations ?

================
Comment at: include/lld/ReaderWriter/LinkerScript.h:657-667
@@ +656,13 @@
+
+/// Represents an Overlay structure as documented in
+/// https://sourceware.org/binutils/docs/ld/Overlay-Description.html#Overlay-Description
+class Overlay : public Command {
+public:
+  Overlay() : Command(Kind::Overlay) {}
+
+  static bool classof(const Command *c) {
+    return c->getKind() == Kind::Overlay;
+  }
+
+  void dump(raw_ostream &os) const override { os << "Overlay description\n"; }
+};
----------------
rafaelauler wrote:
> shankarke wrote:
> > From your tests, do you see any that uses Overlay command ?
> None. Do you think it's better to remove this, for now?
leave it for now, at the time of Layout we could say this command is not supported :)

================
Comment at: lib/ReaderWriter/LinkerScript.cpp:577-582
@@ -204,1 +576,8 @@
 
+// Constant functions
+void Constant::dump(raw_ostream &os) const { os << _num; }
+
+// Symbol functions
+void Symbol::dump(raw_ostream &os) const { os << _name; }
+
+// FunctionCall functions
----------------
rafaelauler wrote:
> shankarke wrote:
> > move this inside the class itself.
> Should we leave these as virtual anchors in the C++ code or is this not a concern for the LLD project?
Leave them as virtual anchors still.

http://reviews.llvm.org/D5852






More information about the llvm-commits mailing list