diff options
Diffstat (limited to 'contrib/llvm-project/lld/ELF/Config.h')
-rw-r--r-- | contrib/llvm-project/lld/ELF/Config.h | 65 |
1 files changed, 61 insertions, 4 deletions
diff --git a/contrib/llvm-project/lld/ELF/Config.h b/contrib/llvm-project/lld/ELF/Config.h index 72b7be8165e0..c593880d5cd3 100644 --- a/contrib/llvm-project/lld/ELF/Config.h +++ b/contrib/llvm-project/lld/ELF/Config.h @@ -29,7 +29,12 @@ namespace lld { namespace elf { class InputFile; +class BinaryFile; +class BitcodeFile; +class ELFFileBase; +class SharedFile; class InputSectionBase; +class Symbol; enum ELFKind : uint8_t { ELFNoneKind, @@ -121,6 +126,7 @@ struct Configuration { llvm::Optional<uint64_t> optRemarksHotnessThreshold = 0; llvm::StringRef optRemarksPasses; llvm::StringRef optRemarksFormat; + llvm::StringRef optStatsFilename; llvm::StringRef progName; llvm::StringRef printArchiveStats; llvm::StringRef printSymbolOrder; @@ -138,6 +144,7 @@ struct Configuration { std::vector<VersionDefinition> versionDefinitions; std::vector<llvm::StringRef> auxiliaryList; std::vector<llvm::StringRef> filterList; + std::vector<llvm::StringRef> passPlugins; std::vector<llvm::StringRef> searchPaths; std::vector<llvm::StringRef> symbolOrderingFile; std::vector<llvm::StringRef> thinLTOModulesToCompile; @@ -148,7 +155,7 @@ struct Configuration { uint64_t> callGraphProfile; bool allowMultipleDefinition; - bool androidPackDynRelocs; + bool androidPackDynRelocs = false; bool armHasBlx = false; bool armHasMovtMovw = false; bool armJ1J2BranchEncoding = false; @@ -160,7 +167,6 @@ struct Configuration { bool compressDebugSections; bool cref; std::vector<std::pair<llvm::GlobPattern, uint64_t>> deadRelocInNonAlloc; - bool defineCommon; bool demangle = true; bool dependentLibraries; bool disableVerify; @@ -185,7 +191,6 @@ struct Configuration { bool ltoPGOWarnMismatch; bool ltoDebugPassManager; bool ltoEmitAsm; - bool ltoNewPassManager; bool ltoUniqueBasicBlockSectionNames; bool ltoWholeProgramVisibility; bool mergeArmExidx; @@ -197,6 +202,7 @@ struct Configuration { bool nostdlib; bool oFormatBinary; bool omagic; + bool opaquePointers; bool optEB = false; bool optEL = false; bool optimizeBBJumps; @@ -207,7 +213,8 @@ struct Configuration { bool printIcfSections; bool relax; bool relocatable; - bool relrPackDynRelocs; + bool relrGlibc = false; + bool relrPackDynRelocs = false; bool saveTemps; std::vector<std::pair<llvm::GlobPattern, uint32_t>> shuffleSections; bool singleRoRx; @@ -218,6 +225,7 @@ struct Configuration { bool target1Rel; bool trace; bool thinLTOEmitImportsFiles; + bool thinLTOEmitIndexFiles; bool thinLTOIndexOnly; bool timeTraceEnabled; bool tocOptimize; @@ -312,6 +320,9 @@ struct Configuration { // if that's true.) bool isMips64EL; + // True if we need to reserve two .got entries for local-dynamic TLS model. + bool needsTlsLd = false; + // True if we need to set the DF_STATIC_TLS flag to an output file, which // works as a hint to the dynamic loader that the shared object contains code // compiled with the initial-exec TLS model. @@ -341,11 +352,57 @@ struct Configuration { // 4 for ELF32, 8 for ELF64. int wordsize; + + // Mode of MTE to write to the ELF note. Should be one of NT_MEMTAG_ASYNC (for + // async), NT_MEMTAG_SYNC (for sync), or NT_MEMTAG_LEVEL_NONE (for none). If + // async or sync is enabled, write the ELF note specifying the default MTE + // mode. + int androidMemtagMode; + // Signal to the dynamic loader to enable heap MTE. + bool androidMemtagHeap; + // Signal to the dynamic loader that this binary expects stack MTE. Generally, + // this means to map the primary and thread stacks as PROT_MTE. Note: This is + // not supported on Android 11 & 12. + bool androidMemtagStack; }; // The only instance of Configuration struct. extern std::unique_ptr<Configuration> config; +struct DuplicateSymbol { + const Symbol *sym; + const InputFile *file; + InputSectionBase *section; + uint64_t value; +}; + +struct Ctx { + SmallVector<std::unique_ptr<MemoryBuffer>> memoryBuffers; + SmallVector<ELFFileBase *, 0> objectFiles; + SmallVector<SharedFile *, 0> sharedFiles; + SmallVector<BinaryFile *, 0> binaryFiles; + SmallVector<BitcodeFile *, 0> bitcodeFiles; + SmallVector<BitcodeFile *, 0> lazyBitcodeFiles; + // Duplicate symbol candidates. + SmallVector<DuplicateSymbol, 0> duplicates; + // Symbols in a non-prevailing COMDAT group which should be changed to an + // Undefined. + SmallVector<std::pair<Symbol *, unsigned>, 0> nonPrevailingSyms; + // True if SHT_LLVM_SYMPART is used. + std::atomic<bool> hasSympart{false}; + // A tuple of (reference, extractedFile, sym). Used by --why-extract=. + SmallVector<std::tuple<std::string, const InputFile *, const Symbol &>, 0> + whyExtractRecords; + // A mapping from a symbol to an InputFile referencing it backward. Used by + // --warn-backrefs. + llvm::DenseMap<const Symbol *, + std::pair<const InputFile *, const InputFile *>> + backwardReferences; +}; + +// The only instance of Ctx struct. +extern std::unique_ptr<Ctx> ctx; + // The first two elements of versionDefinitions represent VER_NDX_LOCAL and // VER_NDX_GLOBAL. This helper returns other elements. static inline ArrayRef<VersionDefinition> namedVersionDefs() { |