[llvm-dev] Linking Linux kernel with LLD

George Rimar via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 27 01:37:03 PST 2017

>The lexical format of linker scripts requires a context-sensitive lexer.

>Look at how gold does it. IIRC there are 3 cases that are something like: one is for file-name like things, one is for numbers and stuff, and the last category is for >numbers and stuff but numbers can also include things like `10k` (I think; would need to look at the code to remember for sure). It's done in a very elegant way in gold >(passing a callback "can continue" that says which characters can continue the token). Which token regex to use is dependent on the grammar production (hence >context sensitive). If you look at the other message I sent in this thread just now, ScriptParserBase is essentially a lexer interface and can be pretty easily converted to >a more standard on-the-fly character-scanning implementation of a lexer. Once that is done adding a new method to scan a different kind of token for certain parts of >the parser.
>-- Sean Silva

I think that approach should work and should not be hard to implement.
Though when I think about that feature from "end user POV" I wonder how much users of it can be ? AFAIK we have the only script found in the wild that suffers from absence of whitespaces in math expressions. Looks 99.9% of scripts are free of that issue. And writing "5*6" instead "5 * 6" is looks not nice from code style.
Adding more code to LLD requires additional support for it at the end.

I am not going to say we should or should not doing that, that is just my concern. Moreover I probably would try to do that (just in case, to extend flexibility), though I can't say I see read need for that atm, basing on said above.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170127/97e66a5e/attachment.html>

More information about the llvm-dev mailing list