[llvm-dev] Linking Linux kernel with LLD

George Rimar via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 24 05:29:32 PST 2017

>Our tokenizer recognize

>  [A-Za-z0-9_.$/\\~=+[]*?\-:!<>]+
>as a token. gold uses more complex rules to tokenize. I don't think we need that much complex rules, but there seems to be >room to improve our tokenizer. In particular, I believe we can parse the Linux's linker script by changing the tokenizer rules as >follows.
>  [A-Za-z_.$/\\~=+[]*?\-:!<>][A-Za-z0-9_.$/\\~=+[]*?\-:!<>]*
>  [0-9]+

That probably should help a bit,
but does not solve a problem in general.
I think it will not work for expressions like

. = z5*4;

as it will read "z5*4" as a single token I think.

I was thinking about entering some special parser state for
extracting sub tokens from tokens transparently when
we are inside code that evaluates the expression.

We can start from your suggestion first I think and see how it works
and if we really face scripts writtel like above in real life.
At least it is not harmfull and should help to kernel.

I'll try to prepare a patch if you do not mind.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170124/18b272e4/attachment.html>

More information about the llvm-dev mailing list