Lines Matching refs:cmd
197 static bool shouldDefineSym(SymbolAssignment *cmd) { in shouldDefineSym() argument
198 if (cmd->name == ".") in shouldDefineSym()
201 if (!cmd->provide) in shouldDefineSym()
206 Symbol *b = symtab->find(cmd->name); in shouldDefineSym()
214 void LinkerScript::addSymbol(SymbolAssignment *cmd) { in addSymbol() argument
215 if (!shouldDefineSym(cmd)) in addSymbol()
219 ExprValue value = cmd->expression(); in addSymbol()
221 uint8_t visibility = cmd->hidden ? STV_HIDDEN : STV_DEFAULT; in addSymbol()
236 Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, value.type, in addSymbol()
239 Symbol *sym = symtab->insert(cmd->name); in addSymbol()
243 cmd->sym = cast<Defined>(sym); in addSymbol()
248 static void declareSymbol(SymbolAssignment *cmd) { in declareSymbol() argument
249 if (!shouldDefineSym(cmd)) in declareSymbol()
252 uint8_t visibility = cmd->hidden ? STV_HIDDEN : STV_DEFAULT; in declareSymbol()
253 Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, 0, 0, in declareSymbol()
257 Symbol *sym = symtab->insert(cmd->name); in declareSymbol()
261 cmd->sym = cast<Defined>(sym); in declareSymbol()
262 cmd->provide = false; in declareSymbol()
275 for (SectionCommand *cmd : sectionCommands) { in getSymbolAssignmentValues()
276 if (auto *assign = dyn_cast<SymbolAssignment>(cmd)) { in getSymbolAssignmentValues()
282 for (SectionCommand *subCmd : cast<OutputDesc>(cmd)->osec.commands) in getSymbolAssignmentValues()
309 for (const InsertCommand &cmd : insertCommands) { in processInsertCommands() local
310 for (StringRef name : cmd.names) { in processInsertCommands()
324 llvm::find_if(sectionCommands, [&cmd](SectionCommand *subCmd) { in processInsertCommands()
326 return to != nullptr && to->osec.name == cmd.where; in processInsertCommands()
329 error("unable to insert " + cmd.names[0] + in processInsertCommands()
330 (cmd.isAfter ? " after " : " before ") + cmd.where); in processInsertCommands()
332 if (cmd.isAfter) in processInsertCommands()
345 for (SectionCommand *cmd : sectionCommands) { in declareSymbols()
346 if (auto *assign = dyn_cast<SymbolAssignment>(cmd)) { in declareSymbols()
355 const OutputSection &sec = cast<OutputDesc>(cmd)->osec; in declareSymbols()
358 for (SectionCommand *cmd : sec.commands) in declareSymbols()
359 if (auto *assign = dyn_cast<SymbolAssignment>(cmd)) in declareSymbols()
367 void LinkerScript::assignSymbol(SymbolAssignment *cmd, bool inSec) { in assignSymbol() argument
368 if (cmd->name == ".") { in assignSymbol()
369 setDot(cmd->expression, cmd->location, inSec); in assignSymbol()
373 if (!cmd->sym) in assignSymbol()
376 ExprValue v = cmd->expression(); in assignSymbol()
378 cmd->sym->section = nullptr; in assignSymbol()
379 cmd->sym->value = v.getValue(); in assignSymbol()
381 cmd->sym->section = v.sec; in assignSymbol()
382 cmd->sym->value = v.getSectionOffset(); in assignSymbol()
384 cmd->sym->type = v.type; in assignSymbol()
489 LinkerScript::computeInputSections(const InputSectionDescription *cmd, in computeInputSections() argument
505 for (const SectionPattern &pat : cmd->sectionPatterns) { in computeInputSections()
528 if (!cmd->matchesFile(sec->file) || pat.excludesFile(sec->file) || in computeInputSections()
529 (sec->flags & cmd->withFlags) != cmd->withFlags || in computeInputSections()
530 (sec->flags & cmd->withoutFlags) != 0) in computeInputSections()
579 for (SectionCommand *cmd : outCmd.commands) in discardSynthetic()
580 if (auto *isd = dyn_cast<InputSectionDescription>(cmd)) in discardSynthetic()
590 for (SectionCommand *cmd : outCmd.commands) { in createInputSectionList()
591 if (auto *isd = dyn_cast<InputSectionDescription>(cmd)) { in createInputSectionList()
691 for (SectionCommand *cmd : sectionCommands) { in processSymbolAssignments()
692 if (auto *assign = dyn_cast<SymbolAssignment>(cmd)) in processSymbolAssignments()
695 for (SectionCommand *subCmd : cast<OutputDesc>(cmd)->osec.commands) in processSymbolAssignments()
705 for (SectionCommand *cmd : vec) in findByName()
706 if (auto *osd = dyn_cast<OutputDesc>(cmd)) in findByName()
1026 for (SectionCommand *cmd : sec->commands) { in assignOffsets()
1028 if (auto *assign = dyn_cast<SymbolAssignment>(cmd)) { in assignOffsets()
1036 if (auto *data = dyn_cast<ByteCommand>(cmd)) { in assignOffsets()
1046 for (InputSection *isec : cast<InputSectionDescription>(cmd)->sections) { in assignOffsets()
1087 for (SectionCommand *cmd : sec.commands) { in isDiscardable()
1088 if (auto assign = dyn_cast<SymbolAssignment>(cmd)) in isDiscardable()
1094 if (!isa<InputSectionDescription>(*cmd)) in isDiscardable()
1141 for (SectionCommand *&cmd : sectionCommands) { in adjustOutputSections()
1142 if (!isa<OutputDesc>(cmd)) in adjustOutputSections()
1144 auto *sec = &cast<OutputDesc>(cmd)->osec; in adjustOutputSections()
1179 cmd = nullptr; in adjustOutputSections()
1189 llvm::erase_if(sectionCommands, [&](SectionCommand *cmd) { return !cmd; }); in adjustOutputSections() argument
1195 for (SectionCommand *cmd : sectionCommands) { in adjustSectionsAfterSorting()
1196 if (auto *osd = dyn_cast<OutputDesc>(cmd)) { in adjustSectionsAfterSorting()
1215 auto firstPtLoad = llvm::find_if(phdrsCommands, [](const PhdrsCommand &cmd) { in adjustSectionsAfterSorting() argument
1216 return cmd.type == PT_LOAD; in adjustSectionsAfterSorting()
1223 for (SectionCommand *cmd : sectionCommands) in adjustSectionsAfterSorting()
1224 if (auto *osd = dyn_cast<OutputDesc>(cmd)) in adjustSectionsAfterSorting()
1257 llvm::any_of(phdrsCommands, [](const PhdrsCommand &cmd) { in allocateHeaders() argument
1258 return cmd.hasPhdrs || cmd.hasFilehdr; in allocateHeaders()
1313 for (SectionCommand *cmd : sectionCommands) { in assignAddresses()
1314 if (auto *assign = dyn_cast<SymbolAssignment>(cmd)) { in assignAddresses()
1320 assignOffsets(&cast<OutputDesc>(cmd)->osec); in assignAddresses()
1333 for (const PhdrsCommand &cmd : phdrsCommands) { in createPhdrs() local
1334 PhdrEntry *phdr = make<PhdrEntry>(cmd.type, cmd.flags.value_or(PF_R)); in createPhdrs()
1336 if (cmd.hasFilehdr) in createPhdrs()
1338 if (cmd.hasPhdrs) in createPhdrs()
1341 if (cmd.lmaExpr) { in createPhdrs()
1342 phdr->p_paddr = cmd.lmaExpr().getValue(); in createPhdrs()
1368 for (PhdrsCommand &cmd : phdrsCommands) in needsInterpSection()
1369 if (cmd.type == PT_INTERP) in needsInterpSection()
1411 SmallVector<size_t, 0> LinkerScript::getPhdrIndices(OutputSection *cmd) { in getPhdrIndices() argument
1414 for (StringRef s : cmd->phdrs) { in getPhdrIndices()
1418 error(cmd->location + ": program header '" + s + in getPhdrIndices()