<div dir="ltr">Did it work before? I think we don't support symbols on RHS yet.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 24, 2016 at 4:16 PM, Davide Italiano <span dir="ltr"><<a href="mailto:davide@freebsd.org" target="_blank">davide@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sun, Jul 24, 2016 at 11:19 AM, Rui Ueyama via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: ruiu<br>
> Date: Sun Jul 24 13:19:40 2016<br>
> New Revision: 276574<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=276574&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=276574&view=rev</a><br>
> Log:<br>
> Make readExpr return an Expr object instead of a vector of tokens.<br>
><br>
> Previously, we handled an expression as a vector of tokens. In other<br>
> words, an expression was a vector of uncooked raw StringRefs.<br>
> When we need a value of an expression, we used ExprParser to run<br>
> the expression.<br>
><br>
> The separation was needed essentially because parse time is too<br>
> early to evaluate an expression. In order to evaluate an expression,<br>
> we need to finalize section sizes. Because linker script parsing<br>
> is done at very early stage of the linking process, we can't<br>
> evaluate expressions while parsing.<br>
><br>
> The above mechanism worked fairly well, but there were a few<br>
> drawbacks.<br>
><br>
> One thing is that we sometimes have to parse the same expression<br>
> more than once in order to find the end of the expression.<br>
> In some contexts, linker script expressions have no clear end marker.<br>
> So, we needed to recognize balanced expressions and ternary operators.<br>
><br>
> The other is poor error reporting. Since expressions are parsed<br>
> basically twice, and some information that is available at the first<br>
> stage is lost in the second stage, it was hard to print out<br>
> apprpriate error messages.<br>
><br>
> This patch fixes the issues with a new approach.<br>
><br>
> Now the expression parsing is integrated into ScriptParser.<br>
> ExprParser class is removed. Expressions are represented as lambdas<br>
> instead of vectors of tokens. Lambdas captures information they<br>
> need to run themselves when they are created.<br>
><br>
> In this way, ends of expressions are naturally detected, and<br>
> errors are handled in the usual way. This patch also reduces<br>
> the amount of code.<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D22728" rel="noreferrer" target="_blank">https://reviews.llvm.org/D22728</a><br>
><br>
<br>
</div></div>This commit breaks (at least) this case. Can you please take a look?<br>
<br>
[davide@ganondorf bin]$ ./ld.lld reduction.script<br>
line 3: malformed number: kernbase<br>
  . = kernbase + kernphys + SIZEOF_HEADERS;<br>
      ^<br>
[davide@ganondorf bin]$ cat reduction.script<br>
SECTIONS<br>
{<br>
  . = kernbase + kernphys + SIZEOF_HEADERS;<br>
}<br>
<br>
--<br>
Davide<br>
</blockquote></div><br></div>