[PATCH] D40533: Reland r319090, "COFF: Do not create SectionChunks for discarded comdat sections." with a fix for debug sections.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 17:22:12 PST 2017


pcc added a comment.

Diff against previous patch:

  diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
  index 0ecfbdaf7373..d0c7bcaefe06 100644
  --- a/lld/COFF/InputFiles.cpp
  +++ b/lld/COFF/InputFiles.cpp
  @@ -208,7 +208,8 @@ void ObjFile::readAssociativeDefinition(
     int32_t SectionNumber = Sym.getSectionNumber();
     if (Parent) {
       SparseChunks[SectionNumber] = readSection(SectionNumber, Def);
  -    Parent->addAssociative(SparseChunks[SectionNumber]);
  +    if (SparseChunks[SectionNumber])
  +      Parent->addAssociative(SparseChunks[SectionNumber]);
     } else {
       SparseChunks[SectionNumber] = nullptr;
     }
  diff --git a/lld/test/COFF/pdb-comdat.test b/lld/test/COFF/pdb-comdat.test
  index a3283d206ab8..655f215e0199 100644
  --- a/lld/test/COFF/pdb-comdat.test
  +++ b/lld/test/COFF/pdb-comdat.test
  @@ -107,3 +107,6 @@ REORDER-LABEL:   Mod 0001 | `{{.*}}pdb_comdat_main.obj`:
   REORDER:       c:\src\llvm-project\build\pdb_comdat_main.c
   REORDER-NOT:       c:\src\llvm-project\build\foo.h
   REORDER-LABEL:   Mod 0002 | `* Linker *`:
  +
  +Make sure that we don't crash on non-prevailing debug sections if -debug is not enabled.
  +RUN: lld-link pdb_comdat_main.obj pdb_comdat_bar.obj -out:%t.exe -nodefaultlib -entry:main


https://reviews.llvm.org/D40533





More information about the llvm-commits mailing list