Lines Matching +full:pre +full:- +full:packaged

1 //===- InputFiles.cpp -----------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
65 if (f->toStringCache.empty()) { in toString()
66 if (f->archiveName.empty()) in toString()
67 f->toStringCache = f->getName(); in toString()
69 (f->archiveName + "(" + f->getName() + ")").toVector(f->toStringCache); in toString()
72 return std::string(f->toStringCache); in toString()
141 if (config->armVFPArgs != arg && config->armVFPArgs != ARMVFPArgKind::Default) in updateARMVFPArgs()
144 config->armVFPArgs = arg; in updateARMVFPArgs()
149 // - Use of BLX instruction for interworking between ARM and Thumb state.
150 // - Use of the extended Thumb branch encoding in relocation.
151 // - Use of the MOVT/MOVW instructions in Thumb Thunks.
174 config->armHasBlx = true; in updateSupportedARMFeatures()
175 // Architectures used in pre-Cortex processors do not support in updateSupportedARMFeatures()
177 // of Architecture v6T2 (arm1156t2-s and arm1156t2f-s) that do. in updateSupportedARMFeatures()
181 config->armHasBlx = true; in updateSupportedARMFeatures()
182 config->armJ1J2BranchEncoding = true; in updateSupportedARMFeatures()
185 // of v6-M and v6S-M have the MOVT and MOVW instructions. in updateSupportedARMFeatures()
186 config->armHasMovtMovw = true; in updateSupportedARMFeatures()
190 // Only ARMv8-M or later architectures have CMSE support. in updateSupportedARMFeatures()
197 config->armCMSESupport = true; in updateSupportedARMFeatures()
206 config->armHasArmISA |= armISA && *armISA >= ARMBuildAttrs::Allowed; in updateSupportedARMFeatures()
207 config->armHasThumb2ISA |= thumb && *thumb >= ARMBuildAttrs::AllowThumb32; in updateSupportedARMFeatures()
212 // All files within the same --{start,end}-group get the same group ID. in InputFile()
221 // The --chroot option changes our virtual root directory. in readFile()
222 // This is useful when you are dealing with files created by --reproduce. in readFile()
223 if (!config->chroot.empty() && path.starts_with("/")) in readFile()
224 path = saver().save(config->chroot + path); in readFile()
227 auto it = config->remapInputs.find(path); in readFile()
228 if (it != config->remapInputs.end()) { in readFile()
229 path = it->second; in readFile()
232 for (const auto &[pat, toFile] : config->remapInputsWildcards) { in readFile()
250 config->dependencyFiles.insert(llvm::CachedHashString(path)); in readFile()
259 MemoryBufferRef mbref = (*mbOrErr)->getMemBufferRef(); in readFile()
263 tar->append(relativeToRoot(path), mbref.getBuffer()); in readFile()
271 if (!file->isElf() && !isa<BitcodeFile>(file)) in isCompatible()
274 if (file->ekind == config->ekind && file->emachine == config->emachine) { in isCompatible()
275 if (config->emachine != EM_MIPS) in isCompatible()
277 if (isMipsN32Abi(file) == config->mipsN32Abi) in isCompatible()
282 !config->bfdname.empty() ? config->bfdname : config->emulation; in isCompatible()
307 if (file->lazy) { in doParseFile()
310 f->parseLazy(); in doParseFile()
312 cast<ObjFile<ELFT>>(file)->parseLazy(); in doParseFile()
317 if (config->trace) in doParseFile()
320 if (file->kind() == InputFile::ObjKind) { in doParseFile()
322 cast<ObjFile<ELFT>>(file)->parse(); in doParseFile()
324 f->parse<ELFT>(); in doParseFile()
327 f->parse(); in doParseFile()
330 cast<BinaryFile>(file)->parse(); in doParseFile()
351 llvm::TimeTraceScope timeScope("Parse input files", files[i]->getName()); in doParseFiles()
379 return createFileLineMsg(info->FileName, info->Line); in getSrcMsgAux()
384 return createFileLineMsg(fileLine->first, fileLine->second); in getSrcMsgAux()
425 if (!config->dependentLibraries) in addDependentLibrary()
449 if (s != &InputSection::discarded && s->flags & SHF_ALLOC) in handleSectionGroup()
459 // Connect the members in a circular doubly-linked list via in handleSectionGroup()
468 prev->nextInSectionGroup = s; in handleSectionGroup()
474 prev->nextInSectionGroup = head; in handleSectionGroup()
495 return getDwarf()->getVariableLoc(name); in getVariableLoc()
505 ArrayRef<InputSectionBase *> sections = s->file->getSections(); in getDILineInfo()
513 return getDwarf()->getDILineInfo(offset, sectionIndex); in getDILineInfo()
518 this->ekind = ekind; in ELFFileBase()
570 firstGlobal = symtabSec->sh_info; in init()
584 this->getObj().getSectionIndex(sym, getELFSyms<ELFT>(), shndxTable), in getSectionIndex()
589 object::ELFFile<ELFT> obj = this->getObj(); in parse()
591 if (this->justSymbols) { in parse()
605 if (sec.sh_type == SHT_LLVM_DEPENDENT_LIBRARIES && !config->relocatable) { in parse()
608 this->getObj().template getSectionContentsAsArray<char>(sec), this); in parse()
621 this->sections[i] = &InputSection::discarded; in parse()
625 if (sec.sh_type == SHT_ARM_ATTRIBUTES && config->emachine == EM_ARM) { in parse()
628 check(this->getObj().getSectionContents(sec)); in parse()
630 this->sections[i] = &InputSection::discarded; in parse()
646 this->sections[i] = in.attributes.get(); in parse()
657 this->sections[i] = &InputSection::discarded; in parse()
678 if (!config->resolveGroups) in parse()
679 this->sections[i] = createInputSection( in parse()
689 this->sections[secIndex] = &InputSection::discarded; in parse()
703 typename ELFT::SymRange symbols = this->getELFSyms<ELFT>(); in getShtGroupSignature()
707 return CHECK(sym.getName(this->stringTable), this); in getShtGroupSignature()
712 // On a regular link we don't merge sections if -O0 (default is -O1). This in shouldMerge()
716 // Doing the same for -r would create a problem as it would combine sections in shouldMerge()
719 // usable SHF_MERGE sections, tools like (llvm-)?dwarfdump get confused when in shouldMerge()
722 // to be more trouble than it is worth. Instead, we just use the regular (-O1) in shouldMerge()
723 // logic for -r. in shouldMerge()
724 if (config->optimize == 0 && !config->relocatable) in shouldMerge()
730 // We'll avoid a mess by handling them as if they were non-mergeable. in shouldMerge()
736 // the section does not hold a table of fixed-size entries". We know in shouldMerge()
754 // This is for --just-symbols.
756 // --just-symbols is a very minor feature that allows you to link your
772 // Allow all processor-specific types. This is different from GNU ld. in isKnownSpecificSectionType()
784 if (this->sections[i] == &InputSection::discarded) in initializeSections()
790 // if -r is given, we'll let the final link discard such sections. in initializeSections()
792 if ((sec.sh_flags & SHF_EXCLUDE) && !config->relocatable) { in initializeSections()
796 // We ignore the address-significance table if we know that the object in initializeSections()
797 // file was created by objcopy or ld -r. This is because these tools in initializeSections()
799 // in the address-significance table, which refers to symbols by index. in initializeSections()
801 this->addrsigSec = &sec; in initializeSections()
802 else if (config->icf == ICFLevel::Safe) in initializeSections()
804 ": --icf=safe conservatively ignores " in initializeSections()
808 "(likely created using objcopy or ld -r)"); in initializeSections()
810 this->sections[i] = &InputSection::discarded; in initializeSections()
816 if (!config->relocatable) in initializeSections()
819 cantFail(this->getELFSyms<ELFT>()[sec.sh_info].getName(stringTable)); in initializeSections()
823 symtab.comdatGroups.find(CachedHashStringRef(signature))->second == in initializeSections()
844 this->sections[i] = in initializeSections()
852 if (config->relocatable && !config->fatLTOObjects) { in initializeSections()
858 this->sections[i] = in initializeSections()
862 else if (config->rejectMismatch && in initializeSections()
864 errorOrWarn(toString(this->sections[i]) + ": unknown section type 0x" + in initializeSections()
878 if (this->sections[i] == &InputSection::discarded) in initializeSections()
896 // simply handle such sections as non-mergeable ones. Degrading like this in initializeSections()
900 ms->file, ms->flags, ms->type, ms->addralign, in initializeSections()
901 ms->contentMaybeDecompress(), ms->name); in initializeSections()
905 if (s->relSecIdx != 0) in initializeSections()
909 s->relSecIdx = i; in initializeSections()
912 // `nullptr` for the normal case. However, if -r or --emit-relocs is in initializeSections()
914 // tools specify --emit-relocs to obtain the information.) in initializeSections()
915 if (config->copyRelocs) { in initializeSections()
919 // --gc-sections), the relocation section should be discarded as well. in initializeSections()
920 s->dependentSections.push_back(isec); in initializeSections()
933 linkSec = this->sections[sec.sh_link]; in initializeSections()
937 // A SHF_LINK_ORDER section is discarded if its linked-to section is in initializeSections()
939 InputSection *isec = cast<InputSection>(this->sections[i]); in initializeSections()
940 linkSec->dependentSections.push_back(isec); in initializeSections()
942 error("a section " + isec->name + in initializeSections()
943 " with SHF_LINK_ORDER should not refer a non-regular section: " + in initializeSections()
948 handleSectionGroup<ELFT>(this->sections, entries); in initializeSections()
953 // - Feature flags (32 bits) representing x86 or AArch64 features for
954 // hardware-assisted call flow control;
955 // - AArch64 PAuth ABI core info (16 bytes).
964 Twine::utohexstr(place - sec.content().data()) + "): " + msg); in readGnuProperty()
970 data.size() < nhdr->getSize(sec.addralign)) in readGnuProperty()
974 if (nhdr->n_type != NT_GNU_PROPERTY_TYPE_0 || note.getName() != "GNU") { in readGnuProperty()
975 data = data.slice(nhdr->getSize(sec.addralign)); in readGnuProperty()
979 uint32_t featureAndType = config->emachine == EM_AARCH64 in readGnuProperty()
983 // Read a body of a NOTE record, which consists of type-length-value fields. in readGnuProperty()
1002 } else if (config->emachine == EM_AARCH64 && in readGnuProperty()
1021 data = data.slice(nhdr->getSize(sec.addralign)); in readGnuProperty()
1027 if (info < this->sections.size()) { in getRelocTarget()
1028 InputSectionBase *target = this->sections[info]; in getRelocTarget()
1052 // The GNU linker uses .note.GNU-stack section as a marker indicating in createInputSection()
1056 // make the stack non-executable. Most object files have this section as in createInputSection()
1059 // But making the stack non-executable is a norm today for security in createInputSection()
1062 // explicitly told to do otherwise (by -z execstack). Because the stack in createInputSection()
1063 // executable-ness is controlled solely by command line options, in createInputSection()
1064 // .note.GNU-stack sections are simply ignored. in createInputSection()
1065 if (name == ".note.GNU-stack") in createInputSection()
1068 // Object files that use processor features such as Intel Control-Flow in createInputSection()
1084 // for split stack will include a .note.GNU-split-stack section. in createInputSection()
1085 if (name == ".note.GNU-split-stack") { in createInputSection()
1086 if (config->relocatable) { in createInputSection()
1088 "cannot mix split-stack and non-split-stack in a relocatable link"); in createInputSection()
1091 this->splitStack = true; in createInputSection()
1097 // include a .note.GNU-no-split-stack section. in createInputSection()
1098 if (name == ".note.GNU-no-split-stack") { in createInputSection()
1099 this->someNoSplitStack = true; in createInputSection()
1103 // Strip existing .note.gnu.build-id sections so that the output won't have in createInputSection()
1104 // more than one build-id. This is not usually a problem because input in createInputSection()
1105 // object files normally don't have .build-id sections, but you can create in createInputSection()
1106 // such files by "ld.{bfd,gold,lld} -r --build-id", and we want to guard in createInputSection()
1108 if (name == ".note.gnu.build-id") in createInputSection()
1115 if (name == ".eh_frame" && !config->relocatable) in createInputSection()
1127 ArrayRef<Elf_Sym> eSyms = this->getELFSyms<ELFT>(); in initializeSymbols()
1138 // Perform symbol resolution on non-local symbols. in initializeSymbols()
1155 sym->isUsedInRegularObj = true; in initializeSymbols()
1158 fatal(toString(this) + ": common symbol '" + sym->getName() + in initializeSymbols()
1161 sym->resolve( in initializeSymbols()
1167 sym->resolve(Defined{this, StringRef(), binding, stOther, type, value, size, in initializeSymbols()
1171 // Undefined symbols (excluding those defined relative to non-prevailing in initializeSymbols()
1180 sym->resolve(Undefined{this, StringRef(), eSym.getBinding(), eSym.st_other, in initializeSymbols()
1182 sym->isUsedInRegularObj = true; in initializeSymbols()
1183 sym->referenced = true; in initializeSymbols()
1197 ArrayRef<Elf_Sym> eSyms = this->getELFSyms<ELFT>(); in initSectionsAndLocalSyms()
1208 error(toString(this) + ": non-local symbol (" + Twine(i) + in initSectionsAndLocalSyms()
1226 symbols[i]->partition = 1; in initSectionsAndLocalSyms()
1227 symbols[i]->isUsedInRegularObj = true; in initSectionsAndLocalSyms()
1235 ArrayRef<Elf_Sym> eSyms = this->getELFSyms<ELFT>(); in postParse()
1249 // a STT_TLS symbol is replaced by a non-STT_TLS symbol, vice versa. in postParse()
1255 // Handle non-COMMON defined symbol below. !sym.file allows a symbol in postParse()
1295 // no non-tentative definitions to dominate it. When we hold a tentative
1313 // (pre F90) FORTRAN code that is packaged into an archive.
1332 obj->init(); in isNonCommonDef()
1333 StringRef stringtable = obj->getStringTable(); in isNonCommonDef()
1335 for (auto sym : obj->template getGlobalELFSyms<ELFT>()) { in isNonCommonDef()
1364 isNeeded(!config->asNeeded) {} in SharedFile()
1378 const uint8_t *verdef = base + sec->sh_offset; in parseVerdefs()
1379 for (unsigned i = 0, e = sec->sh_info; i != e; ++i) { in parseVerdefs()
1381 verdef += curVerdef->vd_next; in parseVerdefs()
1382 unsigned verdefIndex = curVerdef->vd_ndx; in parseVerdefs()
1392 // implement sophisticated error checking like in llvm-readobj because the value
1402 for (unsigned i = 0; i != sec->sh_info; ++i) { in parseVerneed()
1406 const uint8_t *vernauxBuf = verneedBuf + vn->vn_aux; in parseVerneed()
1407 for (unsigned j = 0; j != vn->vn_cnt; ++j) { in parseVerneed()
1411 if (aux->vna_name >= this->stringTable.size()) in parseVerneed()
1413 uint16_t version = aux->vna_other & VERSYM_VERSION; in parseVerneed()
1416 verneeds[version] = aux->vna_name; in parseVerneed()
1417 vernauxBuf += aux->vna_next; in parseVerneed()
1419 verneedBuf += vn->vn_next; in parseVerneed()
1462 const ELFFile<ELFT> obj = this->getObj<ELFT>(); in parse()
1495 // Search for a DT_SONAME tag to initialize this->soName. in parse()
1499 if (val >= this->stringTable.size()) in parse()
1501 dtNeeded.push_back(this->stringTable.data() + val); in parse()
1504 if (val >= this->stringTable.size()) in parse()
1506 soName = this->stringTable.data() + val; in parse()
1517 // --as-needed, --no-as-needed takes precedence over --as-needed because a in parse()
1518 // user can add an extra DSO with --no-as-needed to force it to be added to in parse()
1520 it->second->isNeeded |= isNeeded; in parse()
1532 size_t size = numELFSyms - firstGlobal; in parse()
1549 ArrayRef<Elf_Sym> syms = this->getGlobalELFSyms<ELFT>(); in parse()
1554 // symbols in each symbol table, and the index of first non-local symbol in parse()
1555 // is stored to sh_info. If a local symbol appears after some non-local in parse()
1582 s->exportDynamic = true; in parse()
1584 config->unresolvedSymbolsInShlib != UnresolvedPolicy::Ignore) in parse()
1594 if (config->emachine == EM_MIPS && name == "_gp_disp") in parse()
1607 s->dsoDefined = true; in parse()
1608 if (s->file == this) in parse()
1609 s->versionId = ver; in parse()
1619 reinterpret_cast<const Elf_Verdef *>(verdefs[idx])->getAux()->vda_name; in parse()
1625 s->dsoDefined = true; in parse()
1626 if (s->file == this) in parse()
1627 s->versionId = idx; in parse()
1704 this->archiveName = archiveName; in BitcodeFile()
1705 this->lazy = lazy; in BitcodeFile()
1708 if (config->thinLTOIndexOnly) in BitcodeFile()
1725 Triple t(obj->getTargetTriple()); in BitcodeFile()
1754 if (objSym.isUndefined() || (c != -1 && !keptComdats[c])) { in createBitcodeSymbol()
1756 sym->resolve(newSym); in createBitcodeSymbol()
1757 sym->referenced = true; in createBitcodeSymbol()
1762 sym->resolve(CommonSymbol{&f, StringRef(), binding, visibility, STT_OBJECT, in createBitcodeSymbol()
1769 sym->resolve(newSym); in createBitcodeSymbol()
1774 for (std::pair<StringRef, Comdat::SelectionKind> s : obj->getComdatTable()) { in parse()
1782 numSymbols = obj->symbols().size(); in parse()
1787 for (auto [i, irSym] : llvm::enumerate(obj->symbols())) in parse()
1790 for (auto [i, irSym] : llvm::enumerate(obj->symbols())) in parse()
1794 for (auto l : obj->getDependentLibraries()) in parse()
1799 numSymbols = obj->symbols().size(); in parseLazy()
1801 for (auto [i, irSym] : llvm::enumerate(obj->symbols())) in parseLazy()
1804 sym->resolve(LazySymbol{*this}); in parseLazy()
1810 for (auto [i, irSym] : llvm::enumerate(obj->symbols())) { in postParse()
1816 if (c != -1 && !keptComdats[c]) in postParse()
1830 // user programs can access blobs by name. Non-alphanumeric in parse()
1853 // References from an internal file do not lead to --warn-backrefs in createInternalFile()
1855 file->groupId = 0; in createInternalFile()
1878 f->init(); in createObjFile()
1879 f->lazy = lazy; in createObjFile()
1884 const ArrayRef<typename ELFT::Sym> eSyms = this->getELFSyms<ELFT>(); in parseLazy()
1888 // resolve() may trigger this->extract() if an existing symbol is an undefined in parseLazy()
1895 symbols[i]->resolve(LazySymbol{*this}); in parseLazy()
1909 auto [suffix, repl] = config->thinLTOObjectSuffixReplace; in replaceThinLTOSuffix()