[PATCH] D30500: [ELF] - Do not treat colon(":") as separate token in script parser.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 14:11:27 PST 2017


ruiu added inline comments.


================
Comment at: ELF/LinkerScript.cpp:2004-2009
+    if (consumeLabel("local:")) {
+      if (Locals)
+        setError("nested local label");
+      readLocals();
+      return Ret;
+    }
----------------
grimar wrote:
> ruiu wrote:
> > Do you need this error check?
> Otherwise we would accept scripts like:
> 
> ```
> {
> global:
> ...
> local:
> ...
> local:
> ...
> local:
> ...
> }
> ```
> 
> Both bfd and gold does not accept this, I think we also should not.
> 
> Code would be really simpler if we had peekLabel() I believe. Still not understand why we can't have one. consumeLabel can me implemented via peekLabel() + next(), so at fact we would have single method relying on LL(2) in final anyways.
What's wrong with that? I think we should accept that because that makes sense. Overall this part of code should be simpler than this. Let me try.


https://reviews.llvm.org/D30500





More information about the llvm-commits mailing list