[PATCH] D51027: [LLD][ELD] - Do not reject INFO output section type when used with a start address.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 21 02:45:27 PDT 2018
ruiu added inline comments.
================
Comment at: ELF/ScriptLexer.cpp:248-252
+ skip();
+ StringRef Tok = next();
+ if (errorCount())
+ return "";
+ Pos = Pos - 2;
----------------
This is perhaps fine, but why don't you just return `Tokens[Pos+2]`?
================
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;
----------------
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", ...
https://reviews.llvm.org/D51027
More information about the llvm-commits
mailing list