diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:33:45 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:33:45 +0000 |
commit | 4ea16835ba66f2240d050ffcaee44cee6c97cab9 (patch) | |
tree | d2f3d66f3352a3ec22362de0b7a5c1366fc25df8 /COFF/Chunks.h | |
parent | 15f7a1a3796209b21af2817fdf11ca9932165c70 (diff) | |
download | src-4ea16835ba66f2240d050ffcaee44cee6c97cab9.tar.gz src-4ea16835ba66f2240d050ffcaee44cee6c97cab9.zip |
Vendor import of lld trunk r306325:vendor/lld/lld-trunk-r306325
Notes
Notes:
svn path=/vendor/lld/dist/; revision=320382
svn path=/vendor/lld/lld-trunk-r306325/; revision=320383; tag=vendor/lld/lld-trunk-r306325
Diffstat (limited to 'COFF/Chunks.h')
-rw-r--r-- | COFF/Chunks.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/COFF/Chunks.h b/COFF/Chunks.h index f7412517765c..54fffc5f6d08 100644 --- a/COFF/Chunks.h +++ b/COFF/Chunks.h @@ -64,7 +64,6 @@ public: uint64_t getRVA() const { return RVA; } uint32_t getAlign() const { return Align; } void setRVA(uint64_t V) { RVA = V; } - void setOutputSectionOff(uint64_t V) { OutputSectionOff = V; } // Returns true if this has non-zero data. BSS chunks return // false. If false is returned, the space occupied by this chunk @@ -97,17 +96,19 @@ protected: Chunk(Kind K = OtherKind) : ChunkKind(K) {} const Kind ChunkKind; + // The alignment of this chunk. The writer uses the value. + uint32_t Align = 1; + // The RVA of this chunk in the output. The writer sets a value. uint64_t RVA = 0; +public: // The offset from beginning of the output section. The writer sets a value. uint64_t OutputSectionOff = 0; +protected: // The output section for this chunk. OutputSection *Out = nullptr; - - // The alignment of this chunk. The writer uses the value. - uint32_t Align = 1; }; // A chunk corresponding a section of an input file. @@ -159,13 +160,29 @@ public: StringRef getDebugName() override; void setSymbol(DefinedRegular *S) { if (!Sym) Sym = S; } + // Returns true if the chunk was not dropped by GC or COMDAT deduplication. + bool isLive() { return Live && !Discarded; } + // Used by the garbage collector. - bool isLive() { return !Config->DoGC || Live; } void markLive() { + assert(Config->DoGC && "should only mark things live from GC"); assert(!isLive() && "Cannot mark an already live section!"); Live = true; } + // Returns true if this chunk was dropped by COMDAT deduplication. + bool isDiscarded() const { return Discarded; } + + // Used by the SymbolTable when discarding unused comdat sections. This is + // redundant when GC is enabled, as all comdat sections will start out dead. + void markDiscarded() { Discarded = true; } + + // True if this is a codeview debug info chunk. These will not be laid out in + // the image. Instead they will end up in the PDB, if one is requested. + bool isCodeView() const { + return SectionName == ".debug" || SectionName.startswith(".debug$"); + } + // Allow iteration over the bodies of this chunk's relocated symbols. llvm::iterator_range<symbol_iterator> symbols() const { return llvm::make_range(symbol_iterator(File, Relocs.begin()), @@ -196,6 +213,9 @@ private: llvm::iterator_range<const coff_relocation *> Relocs; size_t NumRelocs; + // True if this chunk was discarded because it was a duplicate comdat section. + bool Discarded; + // Used by the garbage collector. bool Live; |