[lld] r187281 - [PECOFF] Skip a section if there's no atom in the section.

Rui Ueyama ruiu at google.com
Fri Jul 26 17:37:50 PDT 2013


Author: ruiu
Date: Fri Jul 26 19:37:50 2013
New Revision: 187281

URL: http://llvm.org/viewvc/llvm-project?rev=187281&view=rev
Log:
[PECOFF] Skip a section if there's no atom in the section.

Some sections, such as with IMAGE_SCN_LNK_REMOVE attribute, is skipped
in the first pass. Such sections need to be skipped in the latter passes.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
    lld/trunk/test/pecoff/Inputs/hello.obj.yaml

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=187281&r1=187280&r2=187281&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Fri Jul 26 19:37:50 2013
@@ -334,6 +334,13 @@ private:
     for (auto si = _obj->begin_sections(), se = _obj->end_sections(); si != se;
          si.increment(ec)) {
       const coff_section *section = _obj->getCOFFSection(si);
+
+      // Skip there's no atom for the section. Currently we do not create any
+      // atoms for some sections, such as "debug$S", and such sections need to
+      // be skipped here too.
+      if (sectionToAtoms.find(section) == sectionToAtoms.end())
+        continue;
+
       for (auto ri = si->begin_relocations(), re = si->end_relocations();
            ri != re; ri.increment(ec)) {
         const coff_relocation *rel = _obj->getCOFFRelocation(ri);

Modified: lld/trunk/test/pecoff/Inputs/hello.obj.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/hello.obj.yaml?rev=187281&r1=187280&r2=187281&view=diff
==============================================================================
--- lld/trunk/test/pecoff/Inputs/hello.obj.yaml (original)
+++ lld/trunk/test/pecoff/Inputs/hello.obj.yaml Fri Jul 26 19:37:50 2013
@@ -28,6 +28,10 @@ sections:
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
     Alignment:       1
     SectionData:     04000000F1000000650000002A00011100000000433A5C63796777696E5C686F6D655C727569755C72656C6F635C68656C6C6F2E6F626A0037003C1103020000030000000000000000000A0000001B9D01004D6963726F736F667420285229204D6163726F20417373656D626C65720000000000
+    Relocations:
+      - VirtualAddress:  4
+        SymbolName:      ignored
+        Type:            IMAGE_REL_I386_DIR32
   - Name:            .drectve
     Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
     Alignment:       2147483648





More information about the llvm-commits mailing list