diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-11-28 01:30:07 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-11-28 01:30:07 +0000 |
commit | 1621c20ffccd14ec2a2e0fe6510eacd035701d70 (patch) | |
tree | 04d490e4ff994ac321576159ca615cf89495b8b3 /lld/COFF/Chunks.cpp | |
parent | b108dbcc91d1008b9ee9d945298f53434c9a0cb9 (diff) | |
download | bcm5719-llvm-1621c20ffccd14ec2a2e0fe6510eacd035701d70.tar.gz bcm5719-llvm-1621c20ffccd14ec2a2e0fe6510eacd035701d70.zip |
Reland r319090, "COFF: Do not create SectionChunks for discarded comdat sections." with a fix for debug sections.
If /debug was not specified, readSection will return a null
pointer for debug sections. If the debug section is associative with
another section, we need to make sure that the section returned from
readSection is not a null pointer before adding it as an associative
section.
Differential Revision: https://reviews.llvm.org/D40533
llvm-svn: 319133
Diffstat (limited to 'lld/COFF/Chunks.cpp')
-rw-r--r-- | lld/COFF/Chunks.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index e83a8c6e458..df98a041cd5 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -38,9 +38,6 @@ SectionChunk::SectionChunk(ObjFile *F, const coff_section *H) Alignment = Header->getAlignment(); - // Chunks may be discarded during comdat merging. - Discarded = false; - // If linker GC is disabled, every chunk starts out alive. If linker GC is // enabled, treat non-comdat sections as roots. Generally optimized object // files will be built with -ffunction-sections or /Gy, so most things worth @@ -362,12 +359,8 @@ bool SectionChunk::isCOMDAT() const { void SectionChunk::printDiscardedMessage() const { // Removed by dead-stripping. If it's removed by ICF, ICF already // printed out the name, so don't repeat that here. - if (Sym && this == Repl) { - if (Discarded) - message("Discarded comdat symbol " + Sym->getName()); - else if (!Live) - message("Discarded " + Sym->getName()); - } + if (Sym && this == Repl) + message("Discarded " + Sym->getName()); } StringRef SectionChunk::getDebugName() { |