[llvm-dev] Linking Linux kernel with LLD
Sean Silva via llvm-dev
llvm-dev at lists.llvm.org
Fri Jan 27 02:11:12 PST 2017
On Fri, Jan 27, 2017 at 1:37 AM, George Rimar <grimar at accesssoftek.com>
> >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.
Most of the features in the linker are for a single user at the time that
they are implemented; but we know that we want that single user to work and
so it doesn't matter. If the programs are buggy (not following ELF spec or
whatever) then it may make sense to push for a fix upstream. But asking a
user to change their program just because we can't be bothered to implement
something simple (and clearly "correct") does not reflect well on the LLD
-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev