Lines Matching full:config

11 #include "Config.h"
29 #include "llvm/Config/llvm-config.h"
153 assert(ctx.config.machine != IMAGE_FILE_MACHINE_UNKNOWN);
154 if (ctx.config.machine == I386)
160 return getMachineArchType(ctx.config.machine);
218 if (ctx.config.mingw) {
354 (!ctx.config.mingw && sym.contains('@'));
380 if (ctx.config.machine == I386 && ctx.config.mingw) {
387 ctx.config.exports.push_back(exp);
418 ctx.config.entry = addUndefined(mangle(arg->getValue()));
427 ctx.config.manifestDependencies.insert(arg->getValue());
433 ctx.config.noDefaultLibs.insert(findLib(arg->getValue()).lower());
436 ctx.config.writeCheckSum = true;
442 parseNumbers(arg->getValue(), &ctx.config.stackReserve,
443 &ctx.config.stackCommit);
447 parseSubsystem(arg->getValue(), &ctx.config.subsystem,
448 &ctx.config.majorSubsystemVersion,
449 &ctx.config.minorSubsystemVersion, &gotVersion);
451 ctx.config.majorOSVersion = ctx.config.majorSubsystemVersion;
452 ctx.config.minorOSVersion = ctx.config.minorSubsystemVersion;
475 if (ctx.config.vfs)
476 if (auto statOrErr = ctx.config.vfs->status(filename))
544 if (ctx.config.mingw && ret == filename)
553 if (ctx.config.noDefaultLibAll)
559 if (ctx.config.noDefaultLibs.count(path.lower()))
703 ctx.config.gcroot.push_back(b);
732 assert(ctx.config.subsystem != IMAGE_SUBSYSTEM_UNKNOWN &&
735 if (ctx.config.mingw)
736 return mangle(ctx.config.subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI
740 if (ctx.config.subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
757 if (ctx.config.dll)
759 if (ctx.config.mingw)
782 if (ctx.config.is64())
783 return ctx.config.dll ? 0x180000000 : 0x140000000;
784 return ctx.config.dll ? 0x10000000 : 0x400000;
895 StringRef outFile = ctx.config.outputFile;
900 if (!ctx.config.implib.empty())
901 return std::string(ctx.config.implib);
902 SmallString<128> out = StringRef(ctx.config.outputFile);
917 if (ctx.config.importName.empty()) {
918 out.assign(sys::path::filename(ctx.config.outputFile));
922 out.assign(ctx.config.importName);
925 (ctx.config.dll || asLib) ? ".dll" : ".exe");
934 for (Export &e1 : ctx.config.exports) {
952 if (!ctx.config.incremental) {
953 checkError(writeImportLibrary(libName, path, exports, ctx.config.machine,
954 ctx.config.mingw));
963 checkError(writeImportLibrary(libName, path, exports, ctx.config.machine,
964 ctx.config.mingw));
975 ctx.config.machine, ctx.config.mingw)) {
998 mb->getMemBufferRef(), ctx.config.machine, ctx.config.mingw));
1003 if (ctx.config.outputFile.empty())
1004 ctx.config.outputFile = std::string(saver().save(m.OutputFile));
1005 ctx.config.importName = std::string(saver().save(m.ImportName));
1007 ctx.config.imageBase = m.ImageBase;
1009 ctx.config.stackReserve = m.StackReserve;
1011 ctx.config.stackCommit = m.StackCommit;
1013 ctx.config.heapReserve = m.HeapReserve;
1015 ctx.config.heapCommit = m.HeapCommit;
1017 ctx.config.majorImageVersion = m.MajorImageVersion;
1019 ctx.config.minorImageVersion = m.MinorImageVersion;
1021 ctx.config.majorOSVersion = m.MajorOSVersion;
1023 ctx.config.minorOSVersion = m.MinorOSVersion;
1047 ctx.config.exports.push_back(e2);
1099 if (ctx.config.machine == I386 && !isDecorated(s))
1103 if (ctx.config.warnMissingOrderSymbol)
1106 ctx.config.order[s] = INT_MIN + ctx.config.order.size();
1130 if (ctx.config.warnMissingOrderSymbol)
1152 ctx.config.callGraphProfile[{from, to}] += count;
1182 ctx.config.callGraphProfile[{from, to}] += count;
1199 for (Export &r : ctx.config.exports)
1240 sys::path::filename(ctx.config.pdbPath, sys::path::Style::windows);
1242 sys::path::extension(ctx.config.outputFile, sys::path::Style::windows);
1253 while (cursor < ctx.config.pdbAltPath.size()) {
1255 if ((firstMark = ctx.config.pdbAltPath.find('%', cursor)) ==
1257 (secondMark = ctx.config.pdbAltPath.find('%', firstMark + 1)) ==
1260 buf.append(ctx.config.pdbAltPath.substr(cursor));
1266 buf.append(ctx.config.pdbAltPath.substr(cursor, firstMark - cursor));
1268 ctx.config.pdbAltPath.substr(firstMark, secondMark - firstMark + 1);
1282 ctx.config.pdbAltPath = buf;
1297 if (!ctx.config.mingw &&
1328 if (!ctx.config.dll)
1331 if (!ctx.config.exports.empty())
1357 ctx.config.gcroot.push_back(def);
1367 ctx.config.exports.push_back(e);
1420 Configuration *config = &ctx.config;
1444 config->timeTraceEnabled = args.hasArg(OPT_time_trace_eq);
1445 config->timeTraceGranularity =
1448 if (config->timeTraceEnabled)
1449 timeTraceProfilerInitialize(config->timeTraceGranularity, argsArr[0]);
1458 config->mllvmOpts.emplace_back(arg->getValue());
1475 config->vfs = getVFS(args);
1492 config->thinLTOJobs = v.str();
1496 config->showTiming = true;
1498 config->showSummary = args.hasArg(OPT_summary);
1499 config->printSearchPaths = args.hasArg(OPT_print_search_paths);
1511 config->mingw = args.hasArg(OPT_lldmingw);
1512 if (config->mingw)
1534 config->noEntry = true;
1545 if (!config->mingw) {
1568 config->warnMissingOrderSymbol = false;
1570 config->warnDebugInfoUnusable = false;
1572 config->warnLocallyDefinedImported = false;
1574 config->warnLongSectionNames = false;
1581 config->outputFile = arg->getValue();
1585 config->verbose = true;
1586 errorHandler().verbose = config->verbose;
1590 config->forceUnresolved = true;
1594 config->forceMultiple = true;
1598 config->forceMultipleRes = true;
1602 if (config->mingw)
1603 config->warnLongSectionNames = false;
1623 config->debug = false;
1624 config->incremental = false;
1625 config->includeDwarfChunks = false;
1626 config->debugGHashes = false;
1627 config->writeSymtab = false;
1631 config->debug = true;
1632 config->incremental = true;
1633 config->includeDwarfChunks = true;
1635 config->debugGHashes = true;
1639 config->debug = true;
1640 config->incremental = true;
1641 config->includeDwarfChunks = true;
1642 config->writeSymtab = true;
1643 config->warnLongSectionNames = false;
1646 config->includeDwarfChunks = false;
1648 config->writeSymtab = true;
1651 config->writeSymtab = false;
1659 config->demangle = args.hasFlag(OPT_demangle, OPT_demangle_no, true);
1662 config->debugTypes = parseDebugTypes(args);
1665 config->driverUponly = args.hasArg(OPT_driver_uponly) ||
1668 config->driverWdm = args.hasArg(OPT_driver_wdm) ||
1671 config->driver =
1672 config->driverUponly || config->driverWdm || args.hasArg(OPT_driver);
1677 config->pdbPath = arg->getValue();
1679 config->pdbAltPath = arg->getValue();
1683 config->natvisFiles = args.getAllArgValues(OPT_natvis);
1689 config->namedStreams[name] = file;
1694 config->pdbSourcePath = arg->getValue();
1704 config->noEntry = true;
1711 config->dll = true;
1712 config->manifestID = 2;
1721 config->dynamicBase = false;
1732 config->relocatable = false;
1733 config->dynamicBase = false;
1738 config->appContainer =
1745 config->machine = getMachineType(arg->getValue());
1746 if (config->machine == IMAGE_FILE_MACHINE_UNKNOWN)
1756 config->noDefaultLibs.insert(findLib(arg->getValue()).lower());
1761 config->noDefaultLibAll = true;
1765 parseNumbers(arg->getValue(), &config->imageBase);
1769 parseNumbers(arg->getValue(), &config->fileAlign);
1770 if (!isPowerOf2_64(config->fileAlign))
1771 error("/filealign: not a power of two: " + Twine(config->fileAlign));
1776 parseNumbers(arg->getValue(), &config->stackReserve, &config->stackCommit);
1784 parseNumbers(arg->getValue(), &config->heapReserve, &config->heapCommit);
1788 parseVersion(arg->getValue(), &config->majorImageVersion,
1789 &config->minorImageVersion);
1793 parseSubsystem(arg->getValue(), &config->subsystem,
1794 &config->majorSubsystemVersion,
1795 &config->minorSubsystemVersion);
1799 parseVersion(arg->getValue(), &config->majorOSVersion,
1800 &config->minorOSVersion);
1802 config->majorOSVersion = config->majorSubsystemVersion;
1803 config->minorOSVersion = config->minorSubsystemVersion;
1809 config->timestamp = 0;
1810 config->repro = true;
1812 config->repro = false;
1814 if (value.getAsInteger(0, config->timestamp))
1819 config->repro = false;
1823 if (value.getAsInteger(0, config->timestamp))
1827 config->timestamp = time(nullptr);
1841 config->implib = arg->getValue();
1843 config->noimplib = args.hasArg(OPT_noimplib);
1877 if (s.getAsInteger(10, config->ltoo) || config->ltoo > 3)
1880 config->ltoCgo.emplace();
1881 if (s.getAsInteger(10, *config->ltoCgo) || *config->ltoCgo > 3)
1886 config->thinLTOJobs = s.str();
1888 if (s.getAsInteger(10, config->ltoPartitions) ||
1889 config->ltoPartitions == 0)
1898 config->doGC = doGC;
1899 config->doICF = *icfLevel;
1900 config->tailMerge =
1901 (tailMerge == 1 && config->doICF != ICFLevel::None) || tailMerge == 2;
1902 config->ltoDebugPassManager = ltoDebugPM;
1906 config->saveTemps = true;
1912 config->emit = EmitKind::Obj;
1914 config->emit = EmitKind::LLVM;
1916 config->emit = EmitKind::ASM;
1923 config->killAt = true;
1927 config->ltoCache = arg->getValue();
1931 config->ltoCachePolicy = CHECK(
1952 if (isArm64EC(config->machine))
1955 if (config->mingw) {
1967 parseNumbers(arg->getValue(), &config->align);
1968 if (!isPowerOf2_64(config->align))
1980 config->manifestDependencies.insert(arg->getValue());
1985 config->manifest = Configuration::SideBySide;
1996 config->manifestFile = arg->getValue();
2000 config->manifestInput.push_back(arg->getValue());
2002 if (!config->manifestInput.empty() &&
2003 config->manifest != Configuration::Embed) {
2008 config->dwoDir = args.getLastArgValue(OPT_dwodir);
2010 config->thinLTOEmitImportsFiles = args.hasArg(OPT_thinlto_emit_imports_files);
2011 config->thinLTOIndexOnly = args.hasArg(OPT_thinlto_index_only) ||
2013 config->thinLTOIndexOnlyArg =
2015 std::tie(config->thinLTOPrefixReplaceOld, config->thinLTOPrefixReplaceNew,
2016 config->thinLTOPrefixReplaceNativeObject) =
2018 config->thinLTOObjectSuffixReplace =
2020 config->ltoObjPath = args.getLastArgValue(OPT_lto_obj_path);
2021 config->ltoCSProfileGenerate = args.hasArg(OPT_lto_cs_profile_generate);
2022 config->ltoCSProfileFile = args.getLastArgValue(OPT_lto_cs_profile_file);
2023 config->ltoSampleProfileName = args.getLastArgValue(OPT_lto_sample_profile);
2025 config->ltoPGOWarnMismatch = args.hasFlag(OPT_lto_pgo_warn_mismatch,
2027 config->allowBind = args.hasFlag(OPT_allowbind, OPT_allowbind_no, true);
2028 config->allowIsolation =
2030 config->incremental =
2032 !config->doGC && config->doICF == ICFLevel::None &&
2034 config->integrityCheck =
2036 config->cetCompat = args.hasFlag(OPT_cetcompat, OPT_cetcompat_no, false);
2037 config->nxCompat = args.hasFlag(OPT_nxcompat, OPT_nxcompat_no, true);
2040 config->terminalServerAware =
2041 !config->dll && args.hasFlag(OPT_tsaware, OPT_tsaware_no, true);
2042 config->autoImport =
2043 args.hasFlag(OPT_auto_import, OPT_auto_import_no, config->mingw);
2044 config->pseudoRelocs = args.hasFlag(
2045 OPT_runtime_pseudo_reloc, OPT_runtime_pseudo_reloc_no, config->mingw);
2046 config->callGraphProfileSort = args.hasFlag(
2048 config->stdcallFixup =
2049 args.hasFlag(OPT_stdcall_fixup, OPT_stdcall_fixup_no, config->mingw);
2050 config->warnStdcallFixup = !args.hasArg(OPT_stdcall_fixup);
2051 config->allowDuplicateWeak =
2053 OPT_lld_allow_duplicate_weak_no, config->mingw);
2058 if (config->incremental && args.hasArg(OPT_profile)) {
2060 config->incremental = false;
2063 if (config->incremental && args.hasArg(OPT_order)) {
2065 config->incremental = false;
2068 if (config->incremental && config->doGC) {
2071 config->incremental = false;
2074 if (config->incremental && config->doICF != ICFLevel::None) {
2077 config->incremental = false;
2141 if (config->machine == IMAGE_FILE_MACHINE_UNKNOWN) {
2143 config->machine = AMD64;
2146 config->wordsize = config->is64() ? 8 : 4;
2148 if (config->printSearchPaths) {
2173 config->writeCheckSum = true;
2176 if (config->machine == I386) {
2177 config->safeSEH = args.hasFlag(OPT_safeseh, OPT_safeseh_no, !config->mingw);
2178 config->noSEH = args.hasArg(OPT_noseh);
2198 config->largeAddressAware = args.hasFlag(
2199 OPT_largeaddressaware, OPT_largeaddressaware_no, config->is64());
2202 config->highEntropyVA =
2203 config->is64() &&
2206 if (!config->dynamicBase &&
2207 (config->machine == ARMNT || isAnyArm64(config->machine)))
2209 machineToStr(config->machine));
2216 if (config->machine == I386) {
2222 config->exports.push_back(e);
2228 // parseModuleDefs mutates Config object.
2235 if (!config->noimplib)
2243 if (config->subsystem == IMAGE_SUBSYSTEM_UNKNOWN) {
2245 config->subsystem = inferSubsystem();
2246 if (config->subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
2256 config->entry = addUndefined(mangle(arg->getValue()));
2257 } else if (!config->entry && !config->noEntry) {
2259 StringRef s = (config->machine == I386) ? "__DllMainCRTStartup@12"
2261 config->entry = addUndefined(s);
2262 } else if (config->driverWdm) {
2264 config->entry = addUndefined(mangle("_NtProcessStartup"));
2271 config->entry = addUndefined(s);
2281 config->delayLoads.insert(StringRef(arg->getValue()).lower());
2282 if (config->machine == I386) {
2283 config->delayLoadHelper = addUndefined("___delayLoadHelper2@8");
2285 config->delayLoadHelper = addUndefined("__delayLoadHelper2");
2291 if (config->outputFile.empty()) {
2292 config->outputFile = getOutputPath(
2294 config->dll, config->driver);
2298 if (auto e = tryCreateFile(config->outputFile)) {
2299 error("cannot open output file " + config->outputFile + ": " + e.message());
2303 config->lldmapFile = getMapFile(args, OPT_lldmap, OPT_lldmap_file);
2304 config->mapFile = getMapFile(args, OPT_map, OPT_map_file);
2306 if (config->mapFile != "" && args.hasArg(OPT_map_info)) {
2310 config->mapInfo = true;
2316 if (config->lldmapFile != "" && config->lldmapFile == config->mapFile) {
2317 warn("/lldmap and /map have the same output file '" + config->mapFile +
2319 config->lldmapFile.clear();
2325 config->buildIDHash = BuildIDHash::Binary;
2329 if (config->pdbPath.empty()) {
2330 config->pdbPath = config->outputFile;
2331 sys::path::replace_extension(config->pdbPath, ".pdb");
2336 if (config->pdbAltPath.empty()) {
2337 config->pdbAltPath = config->pdbPath;
2342 sys::fs::make_absolute(config->pdbAltPath);
2343 sys::path::remove_dots(config->pdbAltPath);
2348 config->buildIDHash = BuildIDHash::PDB;
2352 if (config->imageBase == uint64_t(-1))
2353 config->imageBase = getDefaultImageBase();
2356 if (config->machine == I386) {
2374 if (isArm64EC(config->machine)) {
2381 if (config->pseudoRelocs) {
2385 if (config->mingw) {
2389 if (config->debug || config->buildIDHash != BuildIDHash::None)
2401 if (config->entry)
2402 mangleMaybe(config->entry);
2405 for (Export &e : config->exports) {
2415 for (auto pair : config->alternateNames) {
2458 if (config->autoImport || config->stdcallFixup) {
2487 if (!ctx.bitcodeFileInstances.empty() && !config->forceUnresolved)
2492 config->hadExplicitExports = !config->exports.empty();
2493 if (config->mingw) {
2506 config->gcroot.push_back(d);
2512 if (config->emit != EmitKind::Obj || config->thinLTOIndexOnly)
2528 if (config->mingw) {
2549 if (!config->exports.empty() || config->dll) {
2552 if (!config->noimplib && (!config->mingw || !config->implib.empty()))
2559 writeDefFile(arg->getValue(), config->exports);
2562 for (auto pair : config->alignComm) {
2585 if (config->manifest == Configuration::Embed)
2587 else if (config->manifest == Configuration::SideBySide ||
2588 (config->manifest == Configuration::Default &&
2589 !config->manifestDependencies.empty()))
2599 config->callGraphProfileSort = false;
2603 if (config->callGraphProfileSort) {
2613 config->printSymbolOrder = arg->getValue();
2618 if (config->doGC) {
2619 if (config->mingw) {
2631 config->gcroot.push_back(d);
2643 if (config->doICF != ICFLevel::None) {
2653 if (config->showTiming)
2656 if (config->timeTraceEnabled) {
2661 args.getLastArgValue(OPT_time_trace_eq).str(), config->outputFile));