[PATCH] D16924: [ELF] - Linker script expressions, ASSERT() command.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 11:51:57 PST 2016

grimar added a comment.

In http://reviews.llvm.org/D16924#345187, @davide wrote:

> In http://reviews.llvm.org/D16924#345171, @grimar wrote:
> > In http://reviews.llvm.org/D16924#345148, @davide wrote:
> >
> > > 100% agree. I'd also like to point out that even very complex linker scripts (as the one used by kernels) don't rely on this feature. I'm strongly opposed to see this in until some real consumer shows up. I'm in general opposed to having any linker script directive parsed properly until there's a real use case. 
> > >  I can't stress enough that I'm disturbed by how badly linker script language "specification" evolved over time.
> >
> >
> > Real use case for expressions is everywhere in linkerscript. ASSERT was implemented just for validation of results.
> Sure. Expressions are used. My point is that it's better to support a subset of operators (at least in the beginning) rather than the whole set. If you look at the linker script posted by Ed, you'll notice only a small number of operators is really required. I'm not really familiar with Linux kernel linker script but I'd be really surprised if they make use of all the operators you implemented. I may be wrong.
> In any case, I think we're still away from supporting such level of complexity and I'm inclined to keep the linker script code simple enough for people to contribute.

Ok, I understood. But just in case all that specific operations is just a single line for each + record in map. For example "<<=" is:

  else if (Op == ">>=")
          HaveResult = AssignResultOp(Arg1, getValue(Arg1) >> toInteger(Arg2));
  std::map<StringRef, std::pair<uint8_t, bool>> Operators = { .... {"<<=", {0, false}} ....}

so I cant say there is a complexity because of them. If you want to see just a subset, it is easy to remove few lines. That`s easy with current implementation. At fact there is 230 lines of code for all evaluations.


More information about the llvm-commits mailing list