From f71caa2b49cedf68d2237bb5f7600614ccef1a39 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 29 Jul 2016 06:14:07 +0000 Subject: [PATCH] Split readOutputSectionDescription. llvm-svn: 277121 --- lld/ELF/LinkerScript.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index abb6b38bc101..97fa471e4a7e 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -443,6 +443,7 @@ private: SymbolAssignment *readAssignment(StringRef Name); void readOutputSectionDescription(StringRef OutSec); + std::vector readOutputSectionFiller(); std::vector readOutputSectionPhdrs(); std::unique_ptr readInputSectionDescription(); void readInputSectionRules(InputSectionDescription *InCmd, bool Keep); @@ -760,17 +761,20 @@ void ScriptParser::readOutputSectionDescription(StringRef OutSec) { } } Cmd->Phdrs = readOutputSectionPhdrs(); + Cmd->Filler = readOutputSectionFiller(); +} +std::vector 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) {