|
reference, declaration → definition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
|
Declarations
tools/lld/ELF/Config.h 312 extern Configuration *config;
References
tools/lld/ELF/Arch/AArch64.cpp 581 btiHeader = (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI);
589 btiEntry = btiHeader && !config->shared;
590 pacEntry = (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_PAC);
674 if (config->andFeatures & (GNU_PROPERTY_AARCH64_FEATURE_1_BTI |
tools/lld/ELF/Arch/ARM.cpp 71 if (config->armVFPArgs == ARMVFPArgKind::Base ||
72 config->armVFPArgs == ARMVFPArgKind::Default)
74 else if (config->armVFPArgs == ARMVFPArgKind::VFP)
110 return config->target1Rel ? R_PC : R_ABS;
112 if (config->target2 == Target2Policy::Rel)
114 if (config->target2 == Target2Policy::Abs)
148 if ((type == R_ARM_ABS32) || (type == R_ARM_TARGET1 && !config->target1Rel))
331 return (config->armJ1J2BranchEncoding) ? 0x1000000 - 0x30000
353 range = config->armJ1J2BranchEncoding ? 0x1000000 : 0x400000;
454 if (!config->armJ1J2BranchEncoding) {
559 if (!config->armJ1J2BranchEncoding) {
tools/lld/ELF/Arch/Mips.cpp 81 if (ELFT::Is64Bits || config->mipsN32Abi)
275 if (config->mipsN32Abi) {
298 uint32_t jalrInst = config->zHazardplt ? 0x0320fc09 : 0x0320f809;
333 uint32_t jrInst = isMipsR6() ? (config->zHazardplt ? 0x03200409 : 0x03200009)
334 : (config->zHazardplt ? 0x03200408 : 0x03200008);
530 if (ELFT::Is64Bits || config->mipsN32Abi)
564 if (config->relocatable) {
572 if (config->relocatable) {
tools/lld/ELF/Arch/MipsArchTree.cpp 74 if (config->is64 && f.flags & EF_MIPS_MICROMIPS)
305 if (config->emulation.empty() || config->is64)
305 if (config->emulation.empty() || config->is64)
307 return config->mipsN32Abi ? EF_MIPS_ABI2 : EF_MIPS_ABI_O32;
370 switch (config->ekind) {
384 bool isMicroMips() { return config->eflags & EF_MIPS_MICROMIPS; }
387 uint32_t arch = config->eflags & EF_MIPS_ARCH;
tools/lld/ELF/Arch/PPC.cpp 58 return read32(config->isLE ? loc : loc - 2);
62 write32(config->isLE ? loc : loc - 2, insn);
86 if (config->isPic) {
tools/lld/ELF/Arch/PPC64.cpp 159 assert(config->tocOptimize);
172 config->isLE ? getRelaTocSymAndAddend<ELF64LE>(tocISB, rel.addend)
284 write32(config->isLE ? loc : loc - 2, insn);
288 return read32(config->isLE ? loc : loc - 2);
344 if (config->ekind == ELF64BEKind)
414 relocateOne(loc + 4 + (config->ekind == ELF64BEKind ? 2 : 0),
507 unsigned offset = (config->ekind == ELF64BEKind) ? 2 : 0;
569 return config->tocOptimize ? R_PPC64_RELAX_TOC : R_GOTREL;
801 if (config->tocOptimize && shouldTocOptimize && ha(val) == 0)
833 if (config->tocOptimize && shouldTocOptimize && ha(val) == 0) {
851 if (config->tocOptimize && shouldTocOptimize && ha(val) == 0) {
911 if (s.isUndefWeak() && !config->shared)
1073 if (stackFrameSize < config->splitStackAdjustSize + INT32_MIN) {
1079 stackFrameSize - config->splitStackAdjustSize;
tools/lld/ELF/Arch/RISCV.cpp 78 if (config->is64) {
103 if (config->is64)
131 if (config->is64)
138 if (config->is64)
154 uint32_t load = config->is64 ? LD : LW;
160 write32le(buf + 20, itype(SRLI, X_T1, X_T1, config->is64 ? 1 : 2));
161 write32le(buf + 24, itype(load, X_T0, X_T0, config->wordsize));
174 write32le(buf + 4, itype(config->is64 ? LD : LW, X_T3, X_T3, lo12(offset)));
219 config->hasStaticTlsModel = true;
241 const unsigned bits = config->wordsize * 8;
tools/lld/ELF/Arch/X86.cpp 81 config->hasStaticTlsModel = true;
195 if (config->isPic) {
219 if (config->isPic) {
544 if (config->zRetpolineplt) {
545 if (config->isPic) {
tools/lld/ELF/Arch/X86_64.cpp 78 config->hasStaticTlsModel = true;
427 return config->isPic ? relExpr : R_RELAX_GOT_PC_NOPIC;
512 assert(!config->isPic);
542 if (!config->is64) {
689 if (config->zRetpolineplt) {
690 if (config->zNow) {
tools/lld/ELF/CallGraphSort.cpp 104 MapVector<SectionPair, uint64_t> &profile = config->callGraphProfile;
235 if (!config->printSymbolOrder.empty()) {
237 raw_fd_ostream os(config->printSymbolOrder, ec, sys::fs::OF_None);
239 error("cannot open " + config->printSymbolOrder + ": " + ec.message());
tools/lld/ELF/Config.h 317 return llvm::makeArrayRef(config->versionDefinitions).slice(2);
321 if (!config->noinhibitExec)
tools/lld/ELF/DWARF.cpp 92 uint32_t symIndex = rel.getSymbol(config->isMips64EL);
tools/lld/ELF/Driver.cpp 94 config = make<Configuration>();
106 config->progName = args[0];
197 if (config->formatBinary) {
242 if (config->isStatic || config->relocatable) {
242 if (config->isStatic || config->relocatable) {
296 if (config->emachine == EM_MIPS && config->gnuHash)
296 if (config->emachine == EM_MIPS && config->gnuHash)
299 if (config->fixCortexA53Errata843419 && config->emachine != EM_AARCH64)
299 if (config->fixCortexA53Errata843419 && config->emachine != EM_AARCH64)
302 if (config->fixCortexA8 && config->emachine != EM_ARM)
302 if (config->fixCortexA8 && config->emachine != EM_ARM)
305 if (config->tocOptimize && config->emachine != EM_PPC64)
305 if (config->tocOptimize && config->emachine != EM_PPC64)
308 if (config->pie && config->shared)
308 if (config->pie && config->shared)
311 if (!config->shared && !config->filterList.empty())
311 if (!config->shared && !config->filterList.empty())
314 if (!config->shared && !config->auxiliaryList.empty())
314 if (!config->shared && !config->auxiliaryList.empty())
317 if (!config->relocatable && !config->defineCommon)
317 if (!config->relocatable && !config->defineCommon)
320 if (config->strip == StripPolicy::All && config->emitRelocs)
320 if (config->strip == StripPolicy::All && config->emitRelocs)
323 if (config->zText && config->zIfuncNoplt)
323 if (config->zText && config->zIfuncNoplt)
326 if (config->relocatable) {
327 if (config->shared)
329 if (config->gcSections)
331 if (config->gdbIndex)
333 if (config->icf != ICFLevel::None)
335 if (config->pie)
337 if (config->exportDynamic)
341 if (config->executeOnly) {
342 if (config->emachine != EM_AARCH64)
345 if (config->singleRoRx && !script->hasSectionsCommand)
349 if (config->zRetpolineplt && config->requireCET)
349 if (config->zRetpolineplt && config->requireCET)
352 if (config->emachine != EM_AARCH64) {
353 if (config->pacPlt)
355 if (config->forceBTI)
491 switch (config->ekind) {
547 if (config->shared)
719 if (config->warnSymbolOrdering)
742 config->callGraphProfile[std::make_pair(from, to)] += count;
759 config->callGraphProfile[{from, to}] += cgpe.cgp_weight;
798 if (!names.insert(s) && config->warnSymbolOrdering)
808 const char *argv[] = {config->progName.data(), opt.data()};
824 config->allowMultipleDefinition =
828 config->allowShlibUndefined =
831 config->auxiliaryList = args::getStrings(args, OPT_auxiliary);
832 config->bsymbolic = args.hasArg(OPT_Bsymbolic);
833 config->bsymbolicFunctions = args.hasArg(OPT_Bsymbolic_functions);
834 config->checkSections =
836 config->chroot = args.getLastArgValue(OPT_chroot);
837 config->compressDebugSections = getCompressDebugSections(args);
838 config->cref = args.hasFlag(OPT_cref, OPT_no_cref, false);
839 config->defineCommon = args.hasFlag(OPT_define_common, OPT_no_define_common,
841 config->demangle = args.hasFlag(OPT_demangle, OPT_no_demangle, true);
842 config->dependentLibraries = args.hasFlag(OPT_dependent_libraries, OPT_no_dependent_libraries, true);
843 config->disableVerify = args.hasArg(OPT_disable_verify);
844 config->discard = getDiscard(args);
845 config->dwoDir = args.getLastArgValue(OPT_plugin_opt_dwo_dir_eq);
846 config->dynamicLinker = getDynamicLinker(args);
847 config->ehFrameHdr =
849 config->emitLLVM = args.hasArg(OPT_plugin_opt_emit_llvm, false);
850 config->emitRelocs = args.hasArg(OPT_emit_relocs);
851 config->callGraphProfileSort = args.hasFlag(
853 config->enableNewDtags =
855 config->entry = args.getLastArgValue(OPT_entry);
856 config->executeOnly =
858 config->exportDynamic =
860 config->filterList = args::getStrings(args, OPT_filter);
861 config->fini = args.getLastArgValue(OPT_fini, "_fini");
862 config->fixCortexA53Errata843419 = args.hasArg(OPT_fix_cortex_a53_843419);
863 config->fixCortexA8 = args.hasArg(OPT_fix_cortex_a8);
864 config->forceBTI = args.hasArg(OPT_force_bti);
865 config->requireCET = args.hasArg(OPT_require_cet);
866 config->gcSections = args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false);
867 config->gnuUnique = args.hasFlag(OPT_gnu_unique, OPT_no_gnu_unique, true);
868 config->gdbIndex = args.hasFlag(OPT_gdb_index, OPT_no_gdb_index, false);
869 config->icf = getICF(args);
870 config->ignoreDataAddressEquality =
872 config->ignoreFunctionAddressEquality =
874 config->init = args.getLastArgValue(OPT_init, "_init");
875 config->ltoAAPipeline = args.getLastArgValue(OPT_lto_aa_pipeline);
876 config->ltoCSProfileGenerate = args.hasArg(OPT_lto_cs_profile_generate);
877 config->ltoCSProfileFile = args.getLastArgValue(OPT_lto_cs_profile_file);
878 config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager);
879 config->ltoNewPassManager = args.hasArg(OPT_lto_new_pass_manager);
880 config->ltoNewPmPasses = args.getLastArgValue(OPT_lto_newpm_passes);
881 config->ltoo = args::getInteger(args, OPT_lto_O, 2);
882 config->ltoObjPath = args.getLastArgValue(OPT_lto_obj_path_eq);
883 config->ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1);
884 config->ltoSampleProfile = args.getLastArgValue(OPT_lto_sample_profile);
885 config->mapFile = args.getLastArgValue(OPT_Map);
886 config->mipsGotSize = args::getInteger(args, OPT_mips_got_size, 0xfff0);
887 config->mergeArmExidx =
889 config->nmagic = args.hasFlag(OPT_nmagic, OPT_no_nmagic, false);
890 config->noinhibitExec = args.hasArg(OPT_noinhibit_exec);
891 config->nostdlib = args.hasArg(OPT_nostdlib);
892 config->oFormatBinary = isOutputFormatBinary(args);
893 config->omagic = args.hasFlag(OPT_omagic, OPT_no_omagic, false);
894 config->optRemarksFilename = args.getLastArgValue(OPT_opt_remarks_filename);
895 config->optRemarksPasses = args.getLastArgValue(OPT_opt_remarks_passes);
896 config->optRemarksWithHotness = args.hasArg(OPT_opt_remarks_with_hotness);
897 config->optRemarksFormat = args.getLastArgValue(OPT_opt_remarks_format);
898 config->optimize = args::getInteger(args, OPT_O, 1);
899 config->orphanHandling = getOrphanHandling(args);
900 config->outputFile = args.getLastArgValue(OPT_o);
901 config->pacPlt = args.hasArg(OPT_pac_plt);
902 config->pie = args.hasFlag(OPT_pie, OPT_no_pie, false);
903 config->printIcfSections =
905 config->printGcSections =
907 config->printSymbolOrder =
909 config->rpath = getRpath(args);
910 config->relocatable = args.hasArg(OPT_relocatable);
911 config->saveTemps = args.hasArg(OPT_save_temps);
912 config->searchPaths = args::getStrings(args, OPT_library_path);
913 config->sectionStartMap = getSectionStartMap(args);
914 config->shared = args.hasArg(OPT_shared);
915 config->singleRoRx = args.hasArg(OPT_no_rosegment);
916 config->soName = args.getLastArgValue(OPT_soname);
917 config->sortSection = getSortSection(args);
918 config->splitStackAdjustSize = args::getInteger(args, OPT_split_stack_adjust_size, 16384);
919 config->strip = getStrip(args);
920 config->sysroot = args.getLastArgValue(OPT_sysroot);
921 config->target1Rel = args.hasFlag(OPT_target1_rel, OPT_target1_abs, false);
922 config->target2 = getTarget2(args);
923 config->thinLTOCacheDir = args.getLastArgValue(OPT_thinlto_cache_dir);
924 config->thinLTOCachePolicy = CHECK(
927 config->thinLTOEmitImportsFiles = args.hasArg(OPT_thinlto_emit_imports_files);
928 config->thinLTOIndexOnly = args.hasArg(OPT_thinlto_index_only) ||
930 config->thinLTOIndexOnlyArg = args.getLastArgValue(OPT_thinlto_index_only_eq);
931 config->thinLTOJobs = args::getInteger(args, OPT_thinlto_jobs, -1u);
932 config->thinLTOObjectSuffixReplace =
934 config->thinLTOPrefixReplace =
936 config->trace = args.hasArg(OPT_trace);
937 config->undefined = args::getStrings(args, OPT_undefined);
938 config->undefinedVersion =
940 config->useAndroidRelrTags = args.hasFlag(
942 config->unresolvedSymbols = getUnresolvedSymbolPolicy(args);
943 config->warnBackrefs =
945 config->warnCommon = args.hasFlag(OPT_warn_common, OPT_no_warn_common, false);
946 config->warnIfuncTextrel =
948 config->warnSymbolOrdering =
950 config->zCombreloc = getZFlag(args, "combreloc", "nocombreloc", true);
951 config->zCopyreloc = getZFlag(args, "copyreloc", "nocopyreloc", true);
952 config->zExecstack = getZFlag(args, "execstack", "noexecstack", false);
953 config->zGlobal = hasZOption(args, "global");
954 config->zHazardplt = hasZOption(args, "hazardplt");
955 config->zIfuncNoplt = hasZOption(args, "ifunc-noplt");
956 config->zInitfirst = hasZOption(args, "initfirst");
957 config->zInterpose = hasZOption(args, "interpose");
958 config->zKeepTextSectionPrefix = getZFlag(
960 config->zNodefaultlib = hasZOption(args, "nodefaultlib");
961 config->zNodelete = hasZOption(args, "nodelete");
962 config->zNodlopen = hasZOption(args, "nodlopen");
963 config->zNow = getZFlag(args, "now", "lazy", false);
964 config->zOrigin = hasZOption(args, "origin");
965 config->zRelro = getZFlag(args, "relro", "norelro", true);
966 config->zRetpolineplt = hasZOption(args, "retpolineplt");
967 config->zRodynamic = hasZOption(args, "rodynamic");
968 config->zSeparate = getZSeparate(args);
969 config->zStackSize = args::getZOptionValue(args, OPT_z, "stack-size", 0);
970 config->zText = getZFlag(args, "text", "notext", true);
971 config->zWxneeded = hasZOption(args, "wxneeded");
985 if (config->ltoo > 3)
986 error("invalid optimization level for LTO: " + Twine(config->ltoo));
987 if (config->ltoPartitions == 0)
989 if (config->thinLTOJobs == 0)
992 if (config->splitStackAdjustSize < 0)
998 std::tie(config->ekind, config->emachine, config->osabi) =
998 std::tie(config->ekind, config->emachine, config->osabi) =
998 std::tie(config->ekind, config->emachine, config->osabi) =
1000 config->mipsN32Abi =
1002 config->emulation = s;
1009 config->sysvHash = true;
1011 config->gnuHash = true;
1013 config->sysvHash = config->gnuHash = true;
1013 config->sysvHash = config->gnuHash = true;
1019 config->mapFile = "-";
1024 if (config->nmagic || config->omagic)
1024 if (config->nmagic || config->omagic)
1025 config->zRelro = false;
1027 std::tie(config->buildId, config->buildIdVector) = getBuildId(args);
1027 std::tie(config->buildId, config->buildIdVector) = getBuildId(args);
1029 std::tie(config->androidPackDynRelocs, config->relrPackDynRelocs) =
1029 std::tie(config->androidPackDynRelocs, config->relrPackDynRelocs) =
1037 config->symbolOrderingFile = getSymbolOrderingFile(*buffer);
1040 config->callGraphProfileSort = false;
1044 assert(config->versionDefinitions.empty());
1045 config->versionDefinitions.push_back({"local", (uint16_t)VER_NDX_LOCAL, {}});
1046 config->versionDefinitions.push_back(
1052 config->versionDefinitions[VER_NDX_LOCAL].patterns.push_back(
1056 config->versionDefinitions[VER_NDX_GLOBAL].patterns.push_back(
1063 if (!config->exportDynamic) {
1069 config->dynamicList.push_back(
1078 config->undefined.push_back(arg->getValue());
1094 ELFKind k = config->ekind;
1095 uint16_t m = config->emachine;
1097 config->copyRelocs = (config->relocatable || config->emitRelocs);
1097 config->copyRelocs = (config->relocatable || config->emitRelocs);
1097 config->copyRelocs = (config->relocatable || config->emitRelocs);
1098 config->is64 = (k == ELF64LEKind || k == ELF64BEKind);
1099 config->isLE = (k == ELF32LEKind || k == ELF64LEKind);
1100 config->endianness = config->isLE ? endianness::little : endianness::big;
1100 config->endianness = config->isLE ? endianness::little : endianness::big;
1101 config->isMips64EL = (k == ELF64LEKind && m == EM_MIPS);
1102 config->isPic = config->pie || config->shared;
1102 config->isPic = config->pie || config->shared;
1102 config->isPic = config->pie || config->shared;
1103 config->picThunk = args.hasArg(OPT_pic_veneer, config->isPic);
1103 config->picThunk = args.hasArg(OPT_pic_veneer, config->isPic);
1104 config->wordsize = config->is64 ? 8 : 4;
1104 config->wordsize = config->is64 ? 8 : 4;
1119 config->isRela = m == EM_AARCH64 || m == EM_AMDGPU || m == EM_HEXAGON ||
1128 config->writeAddends = args.hasFlag(OPT_apply_dynamic_relocs,
1130 !config->isRela;
1132 config->tocOptimize =
1179 config->asNeeded = true;
1182 config->formatBinary = isFormatBinary(arg->getValue());
1185 config->asNeeded = false;
1190 config->isStatic = true;
1193 config->isStatic = false;
1234 stack.emplace_back(config->asNeeded, config->isStatic, inWholeArchive);
1234 stack.emplace_back(config->asNeeded, config->isStatic, inWholeArchive);
1241 std::tie(config->asNeeded, config->isStatic, inWholeArchive) = stack.back();
1241 std::tie(config->asNeeded, config->isStatic, inWholeArchive) = stack.back();
1253 if (config->ekind != ELFNoneKind)
1259 config->ekind = f->ekind;
1260 config->emachine = f->emachine;
1261 config->osabi = f->osabi;
1262 config->mipsN32Abi = config->emachine == EM_MIPS && isMipsN32Abi(f);
1262 config->mipsN32Abi = config->emachine == EM_MIPS && isMipsN32Abi(f);
1275 if (config->nmagic || config->omagic) {
1275 if (config->nmagic || config->omagic) {
1290 if (config->nmagic || config->omagic) {
1290 if (config->nmagic || config->omagic) {
1296 if (val > config->maxPageSize)
1297 val = config->maxPageSize;
1315 if ((v % config->maxPageSize) != 0)
1453 if (config->icf == ICFLevel::Safe || !(d->section->flags & SHF_EXECINSTR))
1474 if (config->icf == ICFLevel::All && config->ignoreDataAddressEquality)
1474 if (config->icf == ICFLevel::All && config->ignoreDataAddressEquality)
1542 if (!config->sectionStartMap.empty())
1545 if (config->emachine == EM_MIPS)
1673 if (config->emachine != EM_386 && config->emachine != EM_X86_64 &&
1673 if (config->emachine != EM_386 && config->emachine != EM_X86_64 &&
1674 config->emachine != EM_AARCH64)
1680 if (config->forceBTI && !(features & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) {
1683 } else if (!features && config->requireCET)
1690 if (config->pacPlt)
1702 if (config->emachine == EM_MIPS)
1703 config->sysvHash = true;
1705 config->sysvHash = config->gnuHash = true;
1705 config->sysvHash = config->gnuHash = true;
1709 if (config->outputFile.empty())
1710 config->outputFile = "a.out";
1715 if (auto e = tryCreateFile(config->outputFile))
1716 error("cannot open output file " + config->outputFile + ": " + e.message());
1717 if (auto e = tryCreateFile(config->mapFile))
1718 error("cannot open map file " + config->mapFile + ": " + e.message());
1725 config->warnMissingEntry =
1726 (!config->entry.empty() || (!config->shared && !config->relocatable));
1726 (!config->entry.empty() || (!config->shared && !config->relocatable));
1726 (!config->entry.empty() || (!config->shared && !config->relocatable));
1727 if (config->entry.empty() && !config->relocatable)
1727 if (config->entry.empty() && !config->relocatable)
1728 config->entry = (config->emachine == EM_MIPS) ? "__start" : "_start";
1728 config->entry = (config->emachine == EM_MIPS) ? "__start" : "_start";
1747 config->hasDynSymTab =
1748 !sharedFiles.empty() || config->isPic || config->exportDynamic;
1748 !sharedFiles.empty() || config->isPic || config->exportDynamic;
1756 for (StringRef arg : config->undefined)
1761 if (Symbol *sym = symtab->find(config->entry))
1815 if (!config->relocatable)
1823 if (!config->relocatable)
1838 if (config->thinLTOIndexOnly)
1844 if (config->emitLLVM)
1870 return config->strip != StripPolicy::None &&
1880 config->andFeatures = getAndFeatures<ELFT>();
1887 config->eflags = target->calcEFlags();
1892 config->maxPageSize = getMaxPageSize(args);
1898 config->commonPageSize = getCommonPageSize(args);
1900 config->imageBase = getImageBase(args);
1902 if (config->emachine == EM_ARM) {
1906 if (config->armHasBlx == false)
1912 if (!config->relocatable)
1936 if (!config->relocatable)
1959 if (config->icf != ICFLevel::None) {
1965 if (config->callGraphProfileSort) {
tools/lld/ELF/DriverUtils.cpp 148 outs(), (config->progName + " [options] file...").str().c_str(), "lld",
157 outs() << config->progName << ": supported targets: elf\n";
210 path::append(s, config->sysroot, path1.substr(1), path2);
220 for (StringRef dir : config->searchPaths)
229 for (StringRef dir : config->searchPaths) {
230 if (!config->isStatic)
tools/lld/ELF/EhFrame.cpp 125 return config->wordsize;
tools/lld/ELF/ICF.cpp 240 ra[i].getType(config->isMips64EL) != rb[i].getType(config->isMips64EL))
240 ra[i].getType(config->isMips64EL) != rb[i].getType(config->isMips64EL))
442 if (config->printIcfSections)
tools/lld/ELF/InputFiles.cpp 106 if (!config->chroot.empty() && path.startswith("/"))
107 path = saver.save(config->chroot + path);
133 if (file->ekind == config->ekind && file->emachine == config->emachine) {
133 if (file->ekind == config->ekind && file->emachine == config->emachine) {
134 if (config->emachine != EM_MIPS)
136 if (isMipsN32Abi(file) == config->mipsN32Abi)
140 if (!config->emulation.empty()) {
141 error(toString(file) + " is incompatible with " + config->emulation);
181 if (config->trace)
204 switch (config->ekind) {
252 switch (config->ekind) {
431 if (config->optimize == 0 && !config->relocatable)
431 if (config->optimize == 0 && !config->relocatable)
485 if (!config->dependentLibraries)
521 if ((sec.sh_flags & SHF_EXCLUDE) && !config->relocatable) {
529 else if (config->icf == ICFLevel::Safe)
564 if (config->relocatable)
648 if (config->armVFPArgs != arg && config->armVFPArgs != ARMVFPArgKind::Default)
648 if (config->armVFPArgs != arg && config->armVFPArgs != ARMVFPArgKind::Default)
651 config->armVFPArgs = arg;
679 config->armHasBlx = true;
686 config->armHasBlx = true;
687 config->armJ1J2BranchEncoding = true;
691 config->armHasMovtMovw = true;
729 uint32_t featureAndType = config->emachine == EM_AARCH64
795 if (config->emachine != EM_ARM)
799 attributes.Parse(contents, /*isLittle*/ config->ekind == ELF32LEKind);
813 if (config->relocatable)
854 if (config->relocatable) {
886 if (config->emitRelocs) {
931 if (config->relocatable) {
961 if (name == ".note.gnu.build-id" && config->buildId != BuildIdKind::None)
967 if (name == ".eh_frame" && !config->relocatable)
1281 if (config->emachine == EM_MIPS && idx == VER_NDX_LOCAL &&
1365 if (config->thinLTOIndexOnly)
1516 if (getELFKind(this->mb, archiveName) != config->ekind) {
1559 StringRef suffix = config->thinLTOObjectSuffixReplace.first;
1560 StringRef repl = config->thinLTOObjectSuffixReplace.second;
tools/lld/ELF/InputFiles.h 219 uint32_t symIndex = rel.getSymbol(config->isMips64EL);
344 isNeeded(!config->asNeeded) {}
tools/lld/ELF/InputSection.cpp 98 if (!config->relocatable)
241 if (config->is64) {
300 return (config->outputFile + ":(" + secAndOffset + ")")
413 RelType type = rel.getType(config->isMips64EL);
427 config->isMips64EL);
468 if (config->emachine == EM_MIPS && config->relocatable &&
468 if (config->emachine == EM_MIPS && config->relocatable &&
486 else if (config->relocatable && type != target->noneRel)
622 switch (config->emachine) {
626 return s.getVA(0) + config->wordsize * 2 +
627 ((tls->p_vaddr - config->wordsize * 2) & (tls->p_align - 1));
739 if (config->emachine == EM_ARM)
741 else if (config->emachine == EM_AARCH64)
743 else if (config->emachine == EM_PPC)
836 RelType type = rel.getType(config->isMips64EL);
842 if (config->emachine == EM_386 && type == R_386_GOTPC)
891 const unsigned bits = config->is64 ? 64 : 32;
913 if (config->relocatable)
923 const unsigned bits = config->wordsize * 8;
tools/lld/ELF/InputSection.h 222 : inputOff(off), live(live || !config->gcSections), hash(hash >> 1) {}
tools/lld/ELF/LTO.cpp 63 config->thinLTOPrefixReplace.first,
64 config->thinLTOPrefixReplace.second);
81 else if (config->relocatable)
83 else if (config->isPic)
89 c.DisableVerify = config->disableVerify;
91 c.OptLevel = config->ltoo;
94 c.CGOptLevel = args::getCGOptLevel(config->ltoo);
97 c.OptPipeline = config->ltoNewPmPasses;
98 c.AAPipeline = config->ltoAAPipeline;
101 c.RemarksFilename = config->optRemarksFilename;
102 c.RemarksPasses = config->optRemarksPasses;
103 c.RemarksWithHotness = config->optRemarksWithHotness;
104 c.RemarksFormat = config->optRemarksFormat;
106 c.SampleProfile = config->ltoSampleProfile;
107 c.UseNewPM = config->ltoNewPassManager;
108 c.DebugPassManager = config->ltoDebugPassManager;
109 c.DwoDir = config->dwoDir;
111 c.CSIRProfile = config->ltoCSProfileFile;
112 c.RunCSIRInstr = config->ltoCSProfileGenerate;
114 if (config->emitLLVM) {
116 if (std::unique_ptr<raw_fd_ostream> os = openFile(config->outputFile))
122 if (config->saveTemps)
123 checkError(c.addSaveTemps(config->outputFile.str() + ".",
130 if (!config->thinLTOIndexOnlyArg.empty())
131 indexFile = openFile(config->thinLTOIndexOnlyArg);
135 if (config->thinLTOIndexOnly) {
138 config->thinLTOPrefixReplace.first, config->thinLTOPrefixReplace.second,
138 config->thinLTOPrefixReplace.first, config->thinLTOPrefixReplace.second,
139 config->thinLTOEmitImportsFiles, indexFile.get(), onIndexWrite);
140 } else if (config->thinLTOJobs != -1U) {
141 backend = lto::createInProcessThinBackend(config->thinLTOJobs);
145 config->ltoPartitions);
160 bool isExec = !config->shared && !config->relocatable;
160 bool isExec = !config->shared && !config->relocatable;
162 if (config->thinLTOIndexOnly)
188 r.VisibleToRegularObj = config->relocatable || sym->isUsedInRegularObj ||
228 if (config->thinLTOEmitImportsFiles)
244 if (!config->thinLTOCacheDir.empty())
246 lto::localCache(config->thinLTOCacheDir,
263 if (config->thinLTOEmitImportsFiles)
267 if (config->thinLTOIndexOnly) {
270 if (!config->ltoObjPath.empty())
271 saveBuffer(buf[0], config->ltoObjPath);
281 if (!config->thinLTOCacheDir.empty())
282 pruneCache(config->thinLTOCacheDir, config->thinLTOCachePolicy);
282 pruneCache(config->thinLTOCacheDir, config->thinLTOCachePolicy);
284 if (!config->ltoObjPath.empty()) {
285 saveBuffer(buf[0], config->ltoObjPath);
287 saveBuffer(buf[i], config->ltoObjPath + Twine(i));
290 if (config->saveTemps) {
291 saveBuffer(buf[0], config->outputFile + ".lto.o");
293 saveBuffer(buf[i], config->outputFile + Twine(i) + ".lto.o");
tools/lld/ELF/LinkerScript.cpp 401 sortSections(vec, config->sortSection);
649 if (config->relocatable && (isec->flags & SHF_LINK_ORDER)) {
681 if (config->orphanHandling == OrphanHandlingPolicy::Error)
683 else if (config->orphanHandling == OrphanHandlingPolicy::Warn)
696 if (config->relocatable)
710 if (config->relocatable && (isec->flags & SHF_LINK_ORDER))
1022 return alignDown(min, config->maxPageSize);
1048 bool paged = !config->omagic && !config->nmagic;
1048 bool paged = !config->omagic && !config->nmagic;
1052 min = alignDown(min - headerSize, config->maxPageSize);
1086 dot = config->imageBase.getValueOr(0);
tools/lld/ELF/MapFile.cpp 47 if (config->is64)
142 if (config->mapFile.empty())
147 raw_fd_ostream os(config->mapFile, ec, sys::fs::OF_None);
149 error("cannot open " + config->mapFile + ": " + ec.message());
159 int w = config->is64 ? 16 : 8;
231 if (!config->cref)
tools/lld/ELF/MarkLive.cpp 80 rel.getType(config->isMips64EL));
231 markSymbol(symtab->find(config->entry));
232 markSymbol(symtab->find(config->init));
233 markSymbol(symtab->find(config->fini));
234 for (StringRef s : config->undefined)
322 if (!config->gcSections) {
376 if (config->printGcSections)
tools/lld/ELF/OutputSections.cpp 46 if (config->emachine != EM_ARM || !(flags & SHF_ARM_PURECODE))
127 getELFSectionTypeName(config->emachine, isec->type) +
129 getELFSectionTypeName(config->emachine, type));
138 config->emachine == EM_ARM ? (uint64_t)SHF_ARM_PURECODE : 0;
230 if (config->oFormatBinary)
261 if (!config->compressDebugSections || (flags & SHF_ALLOC) ||
342 assert(config->relocatable);
374 if (!config->copyRelocs || (type != SHT_RELA && type != SHT_REL))
tools/lld/ELF/Relocations.cpp 163 if (config->emachine == EM_MIPS)
168 config->shared) {
179 bool canRelax = config->emachine != EM_ARM && config->emachine != EM_RISCV;
179 bool canRelax = config->emachine != EM_ARM && config->emachine != EM_RISCV;
188 bool isLocalInExecutable = !sym.isPreemptible && !config->shared;
197 if (canRelax && !config->shared) {
218 if (expr == R_DTPREL && !config->shared) {
240 if (!canRelax || config->shared) {
253 uint64_t offsetOff = off + config->wordsize;
384 return target->usesOnlyLowPageBits(type) || !config->isPic;
388 if (!config->isPic)
605 RelType type = rel.getType(config->isMips64EL);
611 uint32_t symIndex = rel.getSymbol(config->isMips64EL);
616 if (ri->getType(config->isMips64EL) == pairTy &&
617 ri->getSymbol(config->isMips64EL) == symIndex)
633 RelType type = rel.getType(config->isMips64EL);
642 if (config->emachine == EM_PPC64 && config->isPic && type == R_PPC64_TOC)
642 if (config->emachine == EM_PPC64 && config->isPic && type == R_PPC64_TOC)
644 if (config->emachine == EM_MIPS)
853 if (config->unresolvedSymbols == UnresolvedPolicy::Ignore && canBeExternal)
861 if (config->emachine == EM_PPC64 &&
866 (config->unresolvedSymbols == UnresolvedPolicy::Warn && canBeExternal) ||
867 config->noinhibitExec;
883 type |= (rel++)->getType(config->isMips64EL) << (8 * n++);
976 !sym.isPreemptible && (!config->isPic || isAbsolute(sym));
984 if (!sym.isTls() && !sym.isPreemptible && config->isPic && !isAbsolute(sym)) {
1009 return ((sym.isFunc() && config->ignoreFunctionAddressEquality) ||
1010 (sym.isObject() && config->ignoreDataAddressEquality));
1038 (!config->shared && sym.isUndefWeak())) {
1043 bool canWrite = (sec.flags & SHF_WRITE) || !config->zText;
1050 if (config->emachine == EM_MIPS && rel == target->symbolicRel)
1070 if (config->emachine == EM_MIPS)
1078 if (!config->shared) {
1088 if (!config->zCopyreloc)
1127 if (config->pie && config->emachine == EM_386)
1127 if (config->pie && config->emachine == EM_386)
1143 if (config->isPic) {
1168 uint32_t symIndex = rel.getSymbol(config->isMips64EL);
1173 if (config->mipsN32Abi) {
1176 type = rel.getType(config->isMips64EL);
1205 if (config->emachine == EM_PPC64 && isPPC64SmallCodeModelTocReloc(type))
1208 if (sym.isGnuIFunc() && !config->zText && config->warnIfuncTextrel) {
1208 if (sym.isGnuIFunc() && !config->zText && config->warnIfuncTextrel) {
1229 if (!sym.isPreemptible && (!sym.isGnuIFunc() || config->zIfuncNoplt)) {
1235 if (config->emachine == EM_PPC && expr == R_PPC32_PLTREL)
1262 if (sym.isGnuIFunc() && config->zIfuncNoplt) {
1277 if (config->emachine == EM_MIPS) {
1358 if (config->zRetpolineplt)
1399 if (config->emachine == EM_RISCV ||
1400 (config->emachine == EM_PPC64 && sec.name == ".toc"))
1817 if (config->emachine == EM_PPC && rel.type == R_PPC_PLTREL24)
tools/lld/ELF/ScriptParser.cpp 48 if (config->sysroot == "")
52 if (!sys::fs::equivalent(config->sysroot, path))
174 config->hasDynamicList = true;
191 config->dynamicList.push_back(v);
281 StringRef path = (config->sysroot + s).toStringRef(pathData);
291 if (config->sysroot.empty())
294 driver->addFile(saver.save(config->sysroot + "/" + s.substr(1)),
310 bool orig = config->asNeeded;
311 config->asNeeded = true;
314 config->asNeeded = orig;
321 if (config->entry.empty())
322 config->entry = tok;
329 config->undefined.push_back(unquote(next()));
371 if (config->outputFile.empty())
372 config->outputFile = unquote(tok);
414 config->osabi = ELFOSABI_FREEBSD;
416 std::tie(config->ekind, config->emachine) = parseBfdName(s);
416 std::tie(config->ekind, config->emachine) = parseBfdName(s);
417 if (config->emachine == EM_NONE)
420 config->mipsN32Abi = true;
473 if (!config->nostdlib)
474 config->searchPaths.push_back(unquote(tok));
527 config->singleRoRx = true;
575 config->formatBinary = false;
577 config->formatBinary = true;
1038 return config->commonPageSize;
1049 return [] { return config->maxPageSize; };
1348 config->versionDefinitions[VER_NDX_LOCAL].patterns.push_back(pat);
1350 config->versionDefinitions[VER_NDX_GLOBAL].patterns.push_back(pat);
1363 config->versionDefinitions[VER_NDX_LOCAL].patterns.push_back(pat);
1369 ver.id = config->versionDefinitions.size();
1370 config->versionDefinitions.push_back(ver);
tools/lld/ELF/SymbolTable.cpp 159 for (SymbolVersion &ver : config->dynamicList) {
181 if (!config->undefinedVersion)
192 return ("version '" + config->versionDefinitions[ver].name + "'").str();
236 for (VersionDefinition &v : config->versionDefinitions)
243 for (VersionDefinition &v : llvm::reverse(config->versionDefinitions))
250 for (VersionDefinition &v : config->versionDefinitions)
tools/lld/ELF/Symbols.cpp 29 if (elf::config->demangle)
108 if (config->emachine == EM_MIPS && isMicroMips() &&
112 if (d.isTls() && !config->relocatable) {
151 uint64_t Symbol::getGotOffset() const { return gotIndex * config->wordsize; }
161 return pltIndex * config->wordsize;
162 return (pltIndex + target->gotPltHeaderEntriesNum) * config->wordsize;
167 return ppc64BranchltIndex * config->wordsize;
177 if (config->emachine == EM_MIPS && isMicroMips())
185 ppc64BranchltIndex * config->wordsize;
244 if (config->shared && versionId != VER_NDX_LOCAL)
274 if (config->relocatable)
279 if (!config->gnuUnique && binding == STB_GNU_UNIQUE)
285 if (!config->hasDynSymTab)
292 if (isUndefWeak() && config->pie && sharedFiles.empty())
316 if (!config->warnSymbolOrdering)
325 config->unresolvedSymbols == UnresolvedPolicy::Ignore)
475 bool backref = config->warnBackrefs && other.file &&
535 if (config->warnCommon)
541 if (config->warnCommon)
547 if (config->warnCommon)
567 if (config->allowMultipleDefinition)
tools/lld/ELF/Symbols.h 223 return config->shared || config->exportDynamic;
223 return config->shared || config->exportDynamic;
245 used(!config->gcSections), needsTocRestore(false),
tools/lld/ELF/SyntheticSections.cpp 57 return config->is64 ? read64(buf) : read32(buf);
61 if (config->is64)
161 if (!config->relocatable)
218 if (!config->relocatable)
256 StringRef s = saver.save(config->dynamicLinker);
273 switch (config->buildId) {
282 return config->buildIdVector.size();
305 uint32_t featureAndType = config->emachine == EM_AARCH64
310 write32(buf + 4, config->is64 ? 16 : 12); // Content size
315 write32(buf + 24, config->andFeatures); // Feature flags
316 if (config->is64)
320 size_t GnuPropertySection::getSize() const { return config->is64 ? 32 : 28; }
451 size_t aligned = alignTo(d.size(), config->wordsize);
463 switch (config->ekind) {
487 off += alignTo(rec->cie->size, config->wordsize);
491 off += alignTo(fde->size, config->wordsize);
600 : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, config->wordsize,
628 tlsIndexOff = numEntries * config->wordsize;
634 return this->getVA() + b.globalDynIndex * config->wordsize;
638 return b.globalDynIndex * config->wordsize;
642 size = numEntries * config->wordsize;
742 return index * config->wordsize;
750 return g.tls.lookup(sym) * config->wordsize;
752 return g.global.lookup(sym) * config->wordsize;
753 return g.local16.lookup({sym, addend}) * config->wordsize;
758 return g.dynTlsSymbols.lookup(nullptr) * config->wordsize;
765 return g.dynTlsSymbols.lookup(sym) * config->wordsize;
798 if (count * config->wordsize > config->mipsGotSize)
798 if (count * config->wordsize > config->mipsGotSize)
808 size = headerEntriesNum * config->wordsize;
810 size += g.getEntriesNum() * config->wordsize;
943 uint64_t offset = p.second * config->wordsize;
949 uint64_t offset = p.second * config->wordsize;
951 if (!config->isPic)
959 if (!s->isPreemptible && !config->isPic)
966 offset += config->wordsize;
978 uint64_t offset = p.second * config->wordsize;
981 if (!config->isPic)
988 uint64_t offset = (l.second.firstIndex + pi) * config->wordsize;
994 uint64_t offset = p.second * config->wordsize;
1004 return !config->relocatable;
1013 return getVA() + gots[*f->mipsGotIndex].startIndex * config->wordsize +
1032 writeUint(buf + config->wordsize, (uint64_t)1 << (config->wordsize * 8 - 1));
1032 writeUint(buf + config->wordsize, (uint64_t)1 << (config->wordsize * 8 - 1));
1038 writeUint(buf + i * config->wordsize, va);
1065 if (p.first == nullptr && !config->isPic)
1071 if (!config->isPic)
1084 : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, config->wordsize,
1086 if (config->emachine == EM_PPC) {
1088 } else if (config->emachine == EM_PPC64) {
1100 return (target->gotPltHeaderEntriesNum + entries.size()) * config->wordsize;
1105 buf += target->gotPltHeaderEntriesNum * config->wordsize;
1108 buf += config->wordsize;
1120 if (config->emachine == EM_ARM)
1125 if (config->emachine == EM_PPC64)
1135 config->emachine == EM_PPC64 ? SHT_NOBITS : SHT_PROGBITS,
1136 config->wordsize, getIgotPltName()) {}
1144 return entries.size() * config->wordsize;
1150 buf += config->wordsize;
1194 : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_DYNAMIC, config->wordsize,
1202 if (config->emachine == EM_MIPS || config->zRodynamic)
1202 if (config->emachine == EM_MIPS || config->zRodynamic)
1279 for (StringRef s : config->filterList)
1281 for (StringRef s : config->auxiliaryList)
1284 if (!config->rpath.empty())
1285 addInt(config->enableNewDtags ? DT_RUNPATH : DT_RPATH,
1286 part.dynStrTab->addString(config->rpath));
1293 if (!config->soName.empty())
1294 addInt(DT_SONAME, part.dynStrTab->addString(config->soName));
1296 if (!config->soName.empty())
1297 addInt(DT_NEEDED, part.dynStrTab->addString(config->soName));
1304 if (config->bsymbolic)
1306 if (config->zGlobal)
1308 if (config->zInitfirst)
1310 if (config->zInterpose)
1312 if (config->zNodefaultlib)
1314 if (config->zNodelete)
1316 if (config->zNodlopen)
1318 if (config->zNow) {
1322 if (config->zOrigin) {
1326 if (!config->zText)
1328 if (config->hasStaticTlsModel)
1344 if (!config->shared && !config->relocatable && !config->zRodynamic)
1344 if (!config->shared && !config->relocatable && !config->zRodynamic)
1344 if (!config->shared && !config->relocatable && !config->zRodynamic)
1356 bool isRela = config->isRela;
1363 if (config->emachine != EM_MIPS) {
1365 if (config->zCombreloc && numRelativeRels)
1370 addInSec(config->useAndroidRelrTags ? DT_ANDROID_RELR : DT_RELR,
1372 addSize(config->useAndroidRelrTags ? DT_ANDROID_RELRSZ : DT_RELRSZ,
1374 addInt(config->useAndroidRelrTags ? DT_ANDROID_RELRENT : DT_RELRENT,
1386 switch (config->emachine) {
1397 addInt(DT_PLTREL, config->isRela ? DT_RELA : DT_REL);
1400 if (config->emachine == EM_AARCH64) {
1401 if (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)
1403 if (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_PAC)
1411 if (!config->zText)
1432 if (Symbol *b = symtab->find(config->init))
1435 if (Symbol *b = symtab->find(config->fini))
1456 if (config->emachine == EM_MIPS) {
1470 if (!config->pie)
1480 if (config->emachine == EM_PPC)
1484 if (config->emachine == EM_PPC64 && in.plt->isNeeded()) {
1531 : SyntheticSection(SHF_ALLOC, type, config->wordsize, name),
1546 if (config->writeAddends && (expr != R_ADDEND || addend != 0))
1576 config->useAndroidRelrTags ? SHT_ANDROID_RELR : SHT_RELR,
1577 config->wordsize, ".relr.dyn") {}
1583 if (config->isRela)
1586 p->setSymbolAndType(rel.getSymIndex(symTab), rel.type, config->isMips64EL);
1591 : RelocationBaseSection(name, config->isRela ? SHT_RELA : SHT_REL,
1592 config->isRela ? DT_RELA : DT_REL,
1593 config->isRela ? DT_RELASZ : DT_RELSZ),
1595 this->entsize = config->isRela ? sizeof(Elf_Rela) : sizeof(Elf_Rel);
1615 buf += config->isRela ? sizeof(Elf_Rela) : sizeof(Elf_Rel);
1623 name, config->isRela ? SHT_ANDROID_RELA : SHT_ANDROID_REL,
1624 config->isRela ? DT_ANDROID_RELA : DT_ANDROID_REL,
1625 config->isRela ? DT_ANDROID_RELASZ : DT_ANDROID_RELSZ) {
1694 if (r.getType(config->isMips64EL) == target->relativeRel)
1716 } while (i != e && (i - 1)->r_offset + config->wordsize == i->r_offset);
1739 if (config->isRela)
1761 (!config->isRela || i->r_addend == j->r_addend))
1763 if (j - i < 3 || (config->isRela && i->r_addend != 0))
1776 config->isRela ? RELOCATION_GROUP_HAS_ADDEND_FLAG : 0;
1793 if (config->isRela) {
1802 add(config->wordsize);
1804 if (config->isRela) {
1822 if (config->isRela) {
1849 if (config->isRela) {
1870 this->entsize = config->wordsize;
1971 config->wordsize,
2010 } else if (config->emachine == EM_MIPS) {
2093 if (!config->defineCommon)
2133 if (config->emachine == EM_PPC64)
2169 if (config->emachine == EM_MIPS) {
2191 if (config->relocatable)
2270 : SyntheticSection(SHF_ALLOC, SHT_GNU_HASH, config->wordsize, ".gnu.hash") {
2283 maskWords = NextPowerOf2(numBits / (config->wordsize * 8));
2287 size += config->wordsize * maskWords; // Bloom filter
2307 buf += config->wordsize * maskWords;
2319 unsigned c = config->is64 ? 64 : 32;
2324 uint64_t val = readUint(buf + i * config->wordsize);
2327 writeUint(buf + i * config->wordsize, val);
2451 (config->emachine == EM_PPC || config->emachine == EM_PPC64)
2451 (config->emachine == EM_PPC || config->emachine == EM_PPC64)
2454 headerSize(!isIplt || config->zRetpolineplt ? target->pltHeaderSize : 0),
2458 if (config->emachine == EM_SPARCV9)
2463 if (config->emachine == EM_PPC) {
2604 DWARFDebugPubTable table(obj, *pub, config->isLE, true);
2859 if (!config->soName.empty())
2860 return config->soName;
2861 return config->outputFile;
3128 bool shouldTailMerge = (flags & SHF_STRINGS) && config->optimize >= 2;
3146 : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, config->wordsize,
3151 config->wordsize, ".ARM.exidx") {}
3185 if (config->emitRelocs && isec->type == SHT_REL)
3270 if (config->mergeArmExidx) {
3355 config->wordsize, ".text.thunk") {
3428 config->isPic ? SHT_NOBITS : SHT_PROGBITS, 8,
3445 if (config->isPic)
3470 if (config->emachine == EM_MIPS) {
3471 if (!config->isPic && !config->relocatable &&
3471 if (!config->isPic && !config->relocatable &&
3472 (config->eflags & (EF_MIPS_PIC | EF_MIPS_CPIC)) == EF_MIPS_CPIC)
3477 if (config->emachine == EM_AMDGPU) {
3496 eHdr->e_ident[EI_CLASS] = config->is64 ? ELFCLASS64 : ELFCLASS32;
3497 eHdr->e_ident[EI_DATA] = config->isLE ? ELFDATA2LSB : ELFDATA2MSB;
3499 eHdr->e_ident[EI_OSABI] = config->osabi;
3501 eHdr->e_machine = config->emachine;
3503 eHdr->e_flags = config->eflags;
3508 if (!config->relocatable) {
tools/lld/ELF/SyntheticSections.h 949 size_t getSize() const override { return config->wordsize; }
tools/lld/ELF/Target.cpp 40 StringRef s = getELFRelocationTypeName(elf::config->emachine, type);
50 switch (config->emachine) {
65 switch (config->ekind) {
110 switch (config->ekind) {
181 if (config->imageBase)
182 return *config->imageBase;
183 return config->isPic ? 0 : defaultImageBase;
tools/lld/ELF/Target.h 236 return llvm::support::endian::read16(p, config->endianness);
240 return llvm::support::endian::read32(p, config->endianness);
244 return llvm::support::endian::read64(p, config->endianness);
248 llvm::support::endian::write16(p, v, config->endianness);
252 llvm::support::endian::write32(p, v, config->endianness);
256 llvm::support::endian::write64(p, v, config->endianness);
tools/lld/ELF/Thunks.cpp 712 if (!config->isPic) {
750 if (!config->isPic)
762 return !config->isPic || (isec.file == file && rel.addend == addend);
805 if (config->picThunk)
822 if (config->picThunk)
840 if (config->isPic)
866 if (!config->armHasMovtMovw) {
867 if (!config->armJ1J2BranchEncoding)
877 if (config->picThunk)
883 if (config->picThunk)
909 if (config->picThunk)
918 if (config->emachine == EM_AARCH64)
921 if (config->emachine == EM_ARM)
924 if (config->emachine == EM_MIPS)
927 if (config->emachine == EM_PPC)
930 if (config->emachine == EM_PPC64)
tools/lld/ELF/Writer.cpp 95 if (config->relocatable)
116 if (config->zKeepTextSectionPrefix)
138 return !sharedFiles.empty() && !config->dynamicLinker.empty() &&
219 if (config->emachine == EM_MIPS) {
238 } else if (config->emachine == EM_PPC) {
253 (config->emachine == EM_PPC64) ? ".TOC." : "_GLOBAL_OFFSET_TABLE_";
263 if (config->emachine == EM_PPC64)
332 Out::programHeaders->alignment = config->wordsize;
334 if (config->strip != StripPolicy::All) {
353 if (config->emachine == EM_MIPS) {
354 if (!config->shared && config->hasDynSymTab) {
354 if (!config->shared && config->hasDynSymTab) {
366 StringRef relaDynName = config->isRela ? ".rela.dyn" : ".rel.dyn";
383 if (config->buildId != BuildIdKind::None) {
391 if (config->androidPackDynRelocs)
395 make<RelocationSection<ELFT>>(relaDynName, config->zCombreloc);
397 if (config->hasDynSymTab) {
412 if (config->gnuHash) {
417 if (config->sysvHash) {
427 if (config->relrPackDynRelocs) {
432 if (!config->relocatable) {
433 if (config->ehFrameHdr) {
441 if (config->emachine == EM_ARM && !config->relocatable) {
441 if (config->emachine == EM_ARM && !config->relocatable) {
453 in.partEnd = make<BssSection>(".part.end", config->maxPageSize, 1);
466 if (config->emachine == EM_MIPS) {
474 if (config->emachine == EM_PPC) {
479 if (config->emachine == EM_PPC64) {
491 if (ElfSym::globalOffsetTable && config->emachine != EM_MIPS) {
498 if (config->gdbIndex)
504 config->isRela ? ".rela.plt" : ".rel.plt", /*sort=*/false);
514 config->androidPackDynRelocs ? in.relaPlt->name : relaDynName,
523 if (config->andFeatures)
531 if (config->relocatable)
545 if (config->discard != DiscardPolicy::All)
548 if (config->copyRelocs)
575 if (!config->oFormatBinary)
583 if (config->relocatable)
587 if (config->checkSections)
598 if (!config->oFormatBinary) {
599 if (config->zSeparate != SeparateSegmentKind::None)
627 if (config->discard == DiscardPolicy::None)
632 if (config->emitRelocs)
645 if (config->discard == DiscardPolicy::Locals)
742 if (!config->zRelro)
792 return config->zNow;
846 if (config->sectionStartMap.count(sec->name))
930 if (config->emachine == EM_PPC64) {
954 if (config->emachine == EM_MIPS) {
975 return config->sectionStartMap.lookup(a->name) <
976 config->sectionStartMap.lookup(b->name);
996 if (config->relocatable || needsInterpSection())
1004 config->isRela ? "__rela_iplt_start" : "__rel_iplt_start",
1008 config->isRela ? "__rela_iplt_end" : "__rel_iplt_end",
1202 if (!config->callGraphProfile.empty())
1205 if (config->symbolOrderingFile.empty())
1217 int priority = -config->symbolOrderingFile.size();
1218 for (StringRef s : config->symbolOrderingFile)
1251 if (config->warnSymbolOrdering)
1352 if (config->emachine == EM_PPC64 && name == ".toc") {
1388 if (config->relocatable)
1513 if (!config->relocatable && config->emachine == EM_ARM &&
1513 if (!config->relocatable && config->emachine == EM_ARM &&
1566 if (config->fixCortexA53Errata843419) {
1571 if (config->fixCortexA8) {
1658 if (!config->shared)
1662 if (config->hasDynamicList)
1666 if (config->bsymbolic || (config->bsymbolicFunctions && b.isFunc()))
1666 if (config->bsymbolic || (config->bsymbolicFunctions && b.isFunc()))
1680 if (!config->relocatable) {
1703 if (config->emachine == EM_RISCV && !config->shared) {
1703 if (config->emachine == EM_RISCV && !config->shared) {
1710 if (config->emachine == EM_X86_64) {
1748 if (!config->relocatable) {
1758 if (!config->allowShlibUndefined) {
1826 auto i = config->sectionStartMap.find(sec->name);
1827 if (i != config->sectionStartMap.end())
1845 if (!config->relocatable && !config->oFormatBinary) {
1845 if (!config->relocatable && !config->oFormatBinary) {
1849 if (config->emachine == EM_ARM) {
1853 if (config->emachine == EM_MIPS) {
1907 if (!script->hasSectionsCommand && !config->relocatable)
1954 if (!config->executeOnly)
2037 if (config->omagic)
2039 if (config->executeOnly && (flags & PF_X))
2041 if (config->singleRoRx && !(flags & PF_W))
2065 if (!config->nmagic && !config->omagic) {
2065 if (!config->nmagic && !config->omagic) {
2180 if (config->zExecstack)
2182 addHdr(PT_GNU_STACK, perm)->p_memsz = config->zStackSize;
2188 if (config->zWxneeded)
2244 if (config->zSeparate == SeparateSegmentKind::Loadable ||
2245 (config->zSeparate == SeparateSegmentKind::Code && prev &&
2249 return alignTo(script->getDot(), config->maxPageSize);
2266 return alignTo(script->getDot(), config->maxPageSize) +
2267 alignTo(script->getDot() % config->maxPageSize,
2272 return alignTo(script->getDot(), config->maxPageSize) +
2273 script->getDot() % config->maxPageSize;
2329 fileSize = alignTo(off, config->wordsize);
2354 if (config->zSeparate != SeparateSegmentKind::None && lastRX &&
2356 off = alignTo(off, config->commonPageSize);
2359 sectionHeaderOff = alignTo(off, config->wordsize);
2411 p->p_memsz = alignTo(p->p_offset + p->p_memsz, config->commonPageSize) -
2476 (!config->oFormatBinary || (sec->flags & SHF_ALLOC)))
2483 if (config->relocatable)
2517 if (Symbol *b = symtab->find(config->entry))
2522 if (to_integer(config->entry, addr))
2527 if (config->warnMissingEntry)
2528 warn("cannot find entry symbol " + config->entry + "; defaulting to 0x" +
2534 if (config->warnMissingEntry)
2535 warn("cannot find entry symbol " + config->entry +
2541 if (config->isPic)
2543 if (config->relocatable)
2587 uint64_t maxSize = config->is64 ? INT64_MAX : UINT32_MAX;
2593 unlinkAsync(config->outputFile);
2595 if (!config->relocatable)
2598 FileOutputBuffer::create(config->outputFile, fileSize, flags);
2601 error("failed to open " + config->outputFile + ": " +
2632 config->commonPageSize),
2634 config->commonPageSize));
2646 alignTo(last->p_filesz, config->commonPageSize);
2701 if (config->buildId == BuildIdKind::Hexstring) {
2703 part.buildId->writeBuildId(config->buildIdVector);
2712 switch (config->buildId) {
tools/lld/ELF/Writer.h 33 : p_align(type == llvm::ELF::PT_LOAD ? config->maxPageSize : 0),