diff options
author | Reid Kleckner <rnk@google.com> | 2019-05-23 20:26:41 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-05-23 20:26:41 +0000 |
commit | 14f4ff6e8972ddc7755c72f6bfc2ba372ac9638f (patch) | |
tree | c70aecdf3ec6c2ffe56e1e0f49c7267ea495c089 | |
parent | edb52e2e7d075b1fec13034deaa56d3c32d100ac (diff) | |
download | llvm-14f4ff6e8972ddc7755c72f6bfc2ba372ac9638f.zip llvm-14f4ff6e8972ddc7755c72f6bfc2ba372ac9638f.tar.gz llvm-14f4ff6e8972ddc7755c72f6bfc2ba372ac9638f.tar.bz2 |
[COFF] Move KeepUnique bit from Chunk to SectionChunk, NFC
The KeepUnique bit is used during ICF, which only operates on
SectionChunks, so only SectionChunks need it. This frees up a byte in
Chunk, which I plan to use in a follow-up change.
llvm-svn: 361549
-rw-r--r-- | lld/COFF/Chunks.h | 12 | ||||
-rw-r--r-- | lld/COFF/Driver.cpp | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h index 8525fee..d15638e 100644 --- a/lld/COFF/Chunks.h +++ b/lld/COFF/Chunks.h @@ -122,14 +122,9 @@ public: protected: Chunk(Kind K = OtherKind) : ChunkKind(K) {} - const Kind ChunkKind; -public: - // Whether this section needs to be kept distinct from other sections during - // ICF. This is set by the driver using address-significance tables. - bool KeepUnique = false; + const Kind ChunkKind; -protected: // The alignment of this chunk, stored in log2 form. The writer uses the // value. uint8_t P2Align = 0; @@ -137,7 +132,6 @@ protected: // The RVA of this chunk in the output. The writer sets a value. uint32_t RVA = 0; -protected: // The output section for this chunk. OutputSection *Out = nullptr; }; @@ -283,6 +277,10 @@ public: // Used by the garbage collector. bool Live; + // Whether this section needs to be kept distinct from other sections during + // ICF. This is set by the driver using address-significance tables. + bool KeepUnique = false; + // The COMDAT selection if this is a COMDAT chunk. llvm::COFF::COMDATType Selection = (llvm::COFF::COMDATType)0; diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 39d476c..0069843 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -858,7 +858,7 @@ static void parseOrderFile(StringRef Arg) { static void markAddrsig(Symbol *S) { if (auto *D = dyn_cast_or_null<Defined>(S)) - if (Chunk *C = D->getChunk()) + if (SectionChunk *C = dyn_cast_or_null<SectionChunk>(D->getChunk())) C->KeepUnique = true; } |