Lines Matching defs:tok
93 ByteCommand *readByteCommand(StringRef tok);
95 bool readSectionDirective(OutputSection *cmd, StringRef tok);
102 InputSectionDescription *readInputSectionDescription(StringRef tok);
112 SymbolAssignment *readAssignment(StringRef tok);
248 StringRef tok = next();
249 if (tok == ";")
252 if (tok == "ENTRY") {
254 } else if (tok == "EXTERN") {
256 } else if (tok == "GROUP") {
258 } else if (tok == "INCLUDE") {
260 } else if (tok == "INPUT") {
262 } else if (tok == "MEMORY") {
264 } else if (tok == "OUTPUT") {
266 } else if (tok == "OUTPUT_ARCH") {
268 } else if (tok == "OUTPUT_FORMAT") {
270 } else if (tok == "OVERWRITE_SECTIONS") {
272 } else if (tok == "PHDRS") {
274 } else if (tok == "REGION_ALIAS") {
276 } else if (tok == "SEARCH_DIR") {
278 } else if (tok == "SECTIONS") {
280 } else if (tok == "TARGET") {
282 } else if (tok == "VERSION") {
284 } else if (tok == "NOCROSSREFS") {
286 } else if (tok == "NOCROSSREFS_TO") {
288 } else if (SymbolAssignment *cmd = readAssignment(tok)) {
291 setError("unknown directive: " + tok);
379 StringRef tok = next();
381 config->entry = unquote(tok);
401 StringRef tok = unquote(next());
403 if (!seen.insert(tok).second) {
408 if (std::optional<std::string> path = searchScript(tok)) {
413 setError("cannot find linker script " + tok);
429 StringRef tok = next();
431 config->outputFile = unquote(tok);
556 StringRef tok = next();
558 config->searchPaths.push_back(unquote(tok));
624 StringRef tok = next();
625 if (tok == "OVERLAY") {
629 } else if (tok == "INCLUDE") {
634 if (SectionCommand *cmd = readAssignment(tok))
637 v.push_back(readOutputSectionDescription(tok));
675 StringRef tok = unquote(next());
678 if (tok.starts_with("elf"))
680 else if (tok == "binary")
683 setError("unknown target: " + tok);
823 ScriptParser::readInputSectionDescription(StringRef tok) {
828 if (tok == "KEEP") {
838 if (tok == "INPUT_SECTION_FLAGS") {
840 tok = next();
842 return readInputSectionRules(tok, withFlags, withoutFlags);
876 bool ScriptParser::readSectionDirective(OutputSection *cmd, StringRef tok) {
877 if (tok != "NOLOAD" && tok != "COPY" && tok != "INFO" && tok != "OVERLAY" &&
878 tok != "TYPE")
932 StringRef tok = peek();
933 if (!readSectionDirective(cmd, tok))
934 setError("unknown section directive: " + tok);
994 StringRef tok = next();
995 if (tok == ";") {
997 } else if (SymbolAssignment *assign = readAssignment(tok)) {
999 } else if (ByteCommand *data = readByteCommand(tok)) {
1001 } else if (tok == "CONSTRUCTORS") {
1005 } else if (tok == "FILL") {
1012 } else if (tok == "SORT") {
1014 } else if (tok == "INCLUDE") {
1016 } else if (tok == "(" || tok == ")") {
1019 osec->commands.push_back(readInputSectionDescription(tok));
1027 auto *isd = make<InputSectionDescription>(tok);
1101 SymbolAssignment *ScriptParser::readAssignment(StringRef tok) {
1103 if (tok == "ASSERT")
1113 cmd = readSymbolAssignment(tok);
1116 cmd = readSymbolAssignment(tok);
1117 } else if (tok == "PROVIDE") {
1120 } else if (tok == "HIDDEN") {
1123 } else if (tok == "PROVIDE_HIDDEN") {
1131 tok.str() + " " +
1296 static std::optional<uint64_t> parseInt(StringRef tok) {
1299 if (tok.starts_with_insensitive("0x")) {
1300 if (!to_integer(tok.substr(2), val, 16))
1304 if (tok.ends_with_insensitive("H")) {
1305 if (!to_integer(tok.drop_back(), val, 16))
1311 if (tok.ends_with_insensitive("K")) {
1312 if (!to_integer(tok.drop_back(), val, 10))
1316 if (tok.ends_with_insensitive("M")) {
1317 if (!to_integer(tok.drop_back(), val, 10))
1321 if (!to_integer(tok, val, 10))
1326 ByteCommand *ScriptParser::readByteCommand(StringRef tok) {
1327 int size = StringSwitch<int>(tok)
1339 tok.str() + " " +
1344 static std::optional<uint64_t> parseFlag(StringRef tok) {
1345 if (std::optional<uint64_t> asInt = parseInt(tok))
1348 return StringSwitch<std::optional<uint64_t>>(tok)
1381 StringRef tok = unquote(next());
1382 bool without = tok.consume_front("!");
1383 if (std::optional<uint64_t> flag = parseFlag(tok)) {
1389 setError("unrecognised flag: " + tok);
1405 StringRef tok = next();
1408 return tok;
1440 StringRef tok = next();
1445 if (tok == "ABSOLUTE") {
1453 if (tok == "ADDR") {
1462 if (tok == "ALIGN") {
1478 if (tok == "ALIGNOF") {
1486 if (tok == "ASSERT")
1488 if (tok == "CONSTANT")
1490 if (tok == "DATA_SEGMENT_ALIGN") {
1502 if (tok == "DATA_SEGMENT_END") {
1508 if (tok == "DATA_SEGMENT_RELRO_END") {
1520 if (tok == "DEFINED") {
1531 if (tok == "LENGTH") {
1539 if (tok == "LOADADDR") {
1548 if (tok == "LOG2CEIL") {
1557 if (tok == "MAX" || tok == "MIN") {
1563 if (tok == "MIN")
1567 if (tok == "ORIGIN") {
1575 if (tok == "SEGMENT_START") {
1583 if (tok == "SIZEOF") {
1591 if (tok == "SIZEOF_HEADERS")
1595 if (tok == ".")
1596 return [=] { return script->getSymbolValue(tok, location); };
1599 if (std::optional<uint64_t> val = parseInt(tok))
1603 if (tok.starts_with("\""))
1604 tok = unquote(tok);
1605 else if (!isValidSymbolName(tok))
1606 setError("malformed number: " + tok);
1608 script->provideMap[*activeProvideSym].push_back(tok);
1610 script->referencedSymbols.push_back(tok);
1611 return [=] { return script->getSymbolValue(tok, location); };
1631 StringRef tok = next();
1632 phdrs.push_back((tok.size() == 1) ? next() : tok.substr(1));
1640 StringRef tok = next();
1641 if (std::optional<uint64_t> val = parseInt(tok))
1644 unsigned ret = StringSwitch<unsigned>(tok)
1664 setError("invalid program header type: " + tok);
1735 StringRef tok = next();
1736 v->push_back({unquote(tok), false, hasWildcard(tok)});
1749 StringRef tok = next();
1750 bool isCXX = tok == "\"C++\"";
1751 if (!isCXX && tok != "\"C\"")
1757 StringRef tok = next();
1759 {unquote(tok), isCXX, !tok.starts_with("\"") && hasWildcard(tok)});
1786 StringRef tok = next();
1787 if (tok == "INCLUDE") {
1807 MemoryRegion *mr = make<MemoryRegion>(tok, origin, length, flags, invFlags,
1809 if (!script->memoryRegions.insert({tok, mr}).second)
1810 setError("region '" + tok + "' already defined");