Split readOutputSectionDescription.
llvm-svn: 277121
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index abb6b38..97fa471 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -443,6 +443,7 @@
SymbolAssignment *readAssignment(StringRef Name);
void readOutputSectionDescription(StringRef OutSec);
+ std::vector<uint8_t> readOutputSectionFiller();
std::vector<StringRef> readOutputSectionPhdrs();
std::unique_ptr<InputSectionDescription> readInputSectionDescription();
void readInputSectionRules(InputSectionDescription *InCmd, bool Keep);
@@ -760,17 +761,20 @@
}
}
Cmd->Phdrs = readOutputSectionPhdrs();
+ Cmd->Filler = readOutputSectionFiller();
+}
+std::vector<uint8_t> ScriptParser::readOutputSectionFiller() {
StringRef Tok = peek();
- if (Tok.startswith("=")) {
- if (!Tok.startswith("=0x")) {
- setError("filler should be a hexadecimal value");
- return;
- }
- Tok = Tok.substr(3);
- Cmd->Filler = parseHex(Tok);
- next();
+ if (!Tok.startswith("="))
+ return {};
+ if (!Tok.startswith("=0x")) {
+ setError("filler should be a hexadecimal value");
+ return {};
}
+ Tok = Tok.substr(3);
+ next();
+ return parseHex(Tok);
}
void ScriptParser::readProvide(bool Hidden) {