[lld] r195692 - [PECOFF] Skip sections with LNK_INFO.

Rui Ueyama ruiu at google.com
Mon Nov 25 14:43:42 PST 2013


Author: ruiu
Date: Mon Nov 25 16:43:42 2013
New Revision: 195692

URL: http://llvm.org/viewvc/llvm-project?rev=195692&view=rev
Log:
[PECOFF] Skip sections with LNK_INFO.

According to the PE/COFF spec, a section with IMAGE_SCN_LNK_INFO should only
appear in an object file, and not allowed in an executable. So I believe
treating it as the same way as IMAGE_SCN_LNK_INFO is the right thing.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=195692&r1=195691&r2=195692&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Mon Nov 25 16:43:42 2013
@@ -594,9 +594,10 @@ FileCOFF::AtomizeDefinedSymbolsInSection
   if (sectionName == ".debug$S")
     return error_code::success();
 
-  // A section with IMAGE_SCN_LNK_REMOVE attribute will never become
+  // A section with IMAGE_SCN_LNK_{INFO,REMOVE} attribute will never become
   // a part of the output image. That's what the COFF spec says.
-  if (section->Characteristics & llvm::COFF::IMAGE_SCN_LNK_REMOVE)
+  if (section->Characteristics & llvm::COFF::IMAGE_SCN_LNK_INFO ||
+      section->Characteristics & llvm::COFF::IMAGE_SCN_LNK_REMOVE)
     return error_code::success();
 
   DefinedAtom::ContentType type = getContentType(section);





More information about the llvm-commits mailing list