[PECOFF] Check for a Characteristics field of a .debug section.
authorRui Ueyama <ruiu@google.com>
Wed, 21 May 2014 19:44:08 +0000 (19:44 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 21 May 2014 19:44:08 +0000 (19:44 +0000)
llvm-svn: 209317

lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

index ae3d2f6..5bca2ea 100644 (file)
@@ -619,8 +619,10 @@ FileCOFF::AtomizeDefinedSymbolsInSection(const coff_section *section,
   // .debug sections. We don't support it yet. Let's discard .debug sections at
   // the very beginning of the process so that we don't spend time on linking
   // blobs that nobody would understand.
-  if (sectionName == ".debug" || sectionName.startswith(".debug$"))
+  if ((section->Characteristics & llvm::COFF::IMAGE_SCN_MEM_DISCARDABLE) &&
+      (sectionName == ".debug" || sectionName.startswith(".debug$"))) {
     return error_code::success();
+  }
 
   DefinedAtom::ContentType type = getContentType(section);
   DefinedAtom::ContentPermissions perms = getPermissions(section);