[PATCH] D51027: [LLD][ELD] - Do not reject INFO output section type when used with a start address.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 22 02:40:44 PDT 2018
grimar added inline comments.
================
Comment at: ELF/ScriptLexer.cpp:248-252
+ skip();
+ StringRef Tok = next();
+ if (errorCount())
+ return "";
+ Pos = Pos - 2;
----------------
ruiu wrote:
> This is perhaps fine, but why don't you just return `Tokens[Pos+2]`?
Tried to be consistent with `peek()` implementation. Fixed.
================
Comment at: ELF/ScriptParser.cpp:735
void ScriptParser::readSectionAddressType(OutputSection *Cmd) {
- if (consume("(")) {
- if (consume("NOLOAD")) {
- expect(")");
- Cmd->Noload = true;
- return;
- }
- if (consume("COPY") || consume("INFO") || consume("OVERLAY")) {
- expect(")");
- Cmd->NonAlloc = true;
- return;
- }
- Cmd->AddrExpr = readExpr();
- expect(")");
- } else {
- Cmd->AddrExpr = readExpr();
- }
+ if (readSectionDirective(Cmd, peek(), peek2()))
+ return;
----------------
ruiu wrote:
> I don't think you need a helper function. Can you do something like this?
>
> unless the following two tokens are "(" and ("LOAD", "INFO" or ...)
> read expression
> if the next token is "("
> read "LOAD", "INFO", ...
Done.
https://reviews.llvm.org/D51027
More information about the llvm-commits
mailing list