[PATCH] D56931: lld-link: Store comdat selection in SectionChunk, reject more invalid associated comdats

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 22 18:42:20 PST 2019


pcc added inline comments.


================
Comment at: lld/COFF/InputFiles.cpp:229
 
-  if (Parent == PendingComdat) {
-    // This can happen if an associative comdat refers to another associative
-    // comdat that appears after it (invalid per COFF spec) or to a section
-    // without any symbols.
+  auto DiagAssoc = [this, Sym, ParentIndex]() {
     StringRef Name, ParentName;
----------------
For lambdas only used locally within a function we normally use an implicit capture with `[&]`.


================
Comment at: lld/COFF/InputFiles.cpp:258
+    SectionChunk *C = readSection(SectionNumber, Def, "");
+    C->Selection = IMAGE_COMDAT_SELECT_ASSOCIATIVE;
+    SparseChunks[SectionNumber] = C;
----------------
Maybe move this inside `readSection` and do `C->Selection = Def->Selection;`?


================
Comment at: lld/test/COFF/associative-comdat-order.s:1
-# RUN: yaml2obj < %s > %t.obj
-# RUN: not lld-link /include:symbol /dll /noentry /nodefaultlib %t.obj /out:%t.exe 2>&1 | FileCheck %s
-
 # Tests that an associative comdat being associated with another
 # associated comdat later in the file produces an error.
----------------
(Sorry didn't notice this on your other patch)

This isn't an assembly file, so the extension should be `.test`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56931/new/

https://reviews.llvm.org/D56931





More information about the llvm-commits mailing list