Lines Matching refs:Cmd
148 static bool shouldDefineSym(SymbolAssignment *Cmd) { in shouldDefineSym() argument
149 if (Cmd->Name == ".") in shouldDefineSym()
152 if (!Cmd->Provide) in shouldDefineSym()
157 Symbol *B = Symtab->find(Cmd->Name); in shouldDefineSym()
165 void LinkerScript::addSymbol(SymbolAssignment *Cmd) { in addSymbol() argument
166 if (!shouldDefineSym(Cmd)) in addSymbol()
171 uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT; in addSymbol()
172 std::tie(Sym, std::ignore) = Symtab->insert(Cmd->Name, Visibility, in addSymbol()
175 ExprValue Value = Cmd->Expression(); in addSymbol()
191 replaceSymbol<Defined>(Sym, nullptr, Cmd->Name, STB_GLOBAL, Visibility, in addSymbol()
193 Cmd->Sym = cast<Defined>(Sym); in addSymbol()
198 static void declareSymbol(SymbolAssignment *Cmd) { in declareSymbol() argument
199 if (!shouldDefineSym(Cmd)) in declareSymbol()
204 uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT; in declareSymbol()
205 std::tie(Sym, std::ignore) = Symtab->insert(Cmd->Name, Visibility, in declareSymbol()
208 replaceSymbol<Defined>(Sym, nullptr, Cmd->Name, STB_GLOBAL, Visibility, in declareSymbol()
210 Cmd->Sym = cast<Defined>(Sym); in declareSymbol()
211 Cmd->Provide = false; in declareSymbol()
249 if (auto *Cmd = dyn_cast<SymbolAssignment>(Base)) { in declareSymbols() local
250 declareSymbol(Cmd); in declareSymbols()
262 if (auto *Cmd = dyn_cast<SymbolAssignment>(Base2)) in declareSymbols() local
263 declareSymbol(Cmd); in declareSymbols()
270 void LinkerScript::assignSymbol(SymbolAssignment *Cmd, bool InSec) { in assignSymbol() argument
271 if (Cmd->Name == ".") { in assignSymbol()
272 setDot(Cmd->Expression, Cmd->Location, InSec); in assignSymbol()
276 if (!Cmd->Sym) in assignSymbol()
279 ExprValue V = Cmd->Expression(); in assignSymbol()
281 Cmd->Sym->Section = nullptr; in assignSymbol()
282 Cmd->Sym->Value = V.getValue(); in assignSymbol()
284 Cmd->Sym->Section = V.Sec; in assignSymbol()
285 Cmd->Sym->Value = V.getSectionOffset(); in assignSymbol()
377 LinkerScript::computeInputSections(const InputSectionDescription *Cmd) { in computeInputSections() argument
381 for (const SectionPattern &Pat : Cmd->SectionPatterns) { in computeInputSections()
398 if (!Cmd->FilePat.match(Filename) || in computeInputSections()
440 if (auto *Cmd = dyn_cast<InputSectionDescription>(Base)) { in createInputSectionList() local
441 Cmd->Sections = computeInputSections(Cmd); in createInputSectionList()
442 Ret.insert(Ret.end(), Cmd->Sections.begin(), Cmd->Sections.end()); in createInputSectionList()
473 if (auto *Cmd = dyn_cast<SymbolAssignment>(Base)) { in processSectionCommands() local
474 addSymbol(Cmd); in processSectionCommands()
801 if (auto *Cmd = dyn_cast<SymbolAssignment>(Base)) { in assignOffsets() local
802 Cmd->Addr = Dot; in assignOffsets()
803 assignSymbol(Cmd, true); in assignOffsets()
804 Cmd->Size = Dot - Cmd->Addr; in assignOffsets()
809 if (auto *Cmd = dyn_cast<ByteCommand>(Base)) { in assignOffsets() local
810 Cmd->Offset = Dot - Ctx->OutSec->Addr; in assignOffsets()
811 Dot += Cmd->Size; in assignOffsets()
812 expandOutputSection(Cmd->Size); in assignOffsets()
837 if (auto Cmd = dyn_cast<SymbolAssignment>(Base)) in isDiscardable() local
840 if (Cmd->Name != "." && !Cmd->Sym) in isDiscardable()
872 for (BaseCommand *&Cmd : SectionCommands) { in adjustSectionsBeforeSorting()
873 auto *Sec = dyn_cast<OutputSection>(Cmd); in adjustSectionsBeforeSorting()
896 Cmd = nullptr; in adjustSectionsBeforeSorting()
930 auto FirstPtLoad = llvm::find_if(PhdrsCommands, [](const PhdrsCommand &Cmd) { in adjustSectionsAfterSorting() argument
931 return Cmd.Type == PT_LOAD; in adjustSectionsAfterSorting()
987 llvm::any_of(PhdrsCommands, [](const PhdrsCommand &Cmd) { in allocateHeaders() argument
988 return Cmd.HasPhdrs || Cmd.HasFilehdr; in allocateHeaders()
1044 if (auto *Cmd = dyn_cast<SymbolAssignment>(Base)) { in assignAddresses() local
1045 Cmd->Addr = Dot; in assignAddresses()
1046 assignSymbol(Cmd, false); in assignAddresses()
1047 Cmd->Size = Dot - Cmd->Addr; in assignAddresses()
1061 for (const PhdrsCommand &Cmd : PhdrsCommands) { in createPhdrs() local
1062 PhdrEntry *Phdr = make<PhdrEntry>(Cmd.Type, Cmd.Flags ? *Cmd.Flags : PF_R); in createPhdrs()
1064 if (Cmd.HasFilehdr) in createPhdrs()
1066 if (Cmd.HasPhdrs) in createPhdrs()
1069 if (Cmd.LMAExpr) { in createPhdrs()
1070 Phdr->p_paddr = Cmd.LMAExpr().getValue(); in createPhdrs()
1096 for (PhdrsCommand &Cmd : PhdrsCommands) in needsInterpSection()
1097 if (Cmd.Type == PT_INTERP) in needsInterpSection()
1133 std::vector<size_t> LinkerScript::getPhdrIndices(OutputSection *Cmd) { in getPhdrIndices() argument
1136 for (StringRef S : Cmd->Phdrs) { in getPhdrIndices()
1140 error(Cmd->Location + ": section header '" + S + in getPhdrIndices()