[lld] r185130 - [PECOFF][Writer] Fix a bug that the contents of .data and .rdata were swapped.

Rui Ueyama ruiu at google.com
Thu Jun 27 21:15:37 PDT 2013


Author: ruiu
Date: Thu Jun 27 23:15:37 2013
New Revision: 185130

URL: http://llvm.org/viewvc/llvm-project?rev=185130&view=rev
Log:
[PECOFF][Writer] Fix a bug that the contents of .data and .rdata were swapped.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
    lld/trunk/test/pecoff/grouped-sections.test
    lld/trunk/test/pecoff/hello.test

Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=185130&r1=185129&r2=185130&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Thu Jun 27 23:15:37 2013
@@ -455,7 +455,7 @@ public:
     for (const DefinedAtom *atom : linkedFile.defined()) {
       assert(atom->sectionChoice() == DefinedAtom::sectionBasedOnContent);
       if (atom->contentType() == DefinedAtom::typeData &&
-          atom->permissions() == DefinedAtom::permRW_)
+          atom->permissions() == DefinedAtom::permR__)
         appendAtom(atom);
     }
 
@@ -484,9 +484,8 @@ public:
     // section.
     for (const DefinedAtom *atom : linkedFile.defined()) {
       assert(atom->sectionChoice() == DefinedAtom::sectionBasedOnContent);
-
       if (atom->contentType() == DefinedAtom::typeData &&
-          atom->permissions() == DefinedAtom::permR__)
+          atom->permissions() == DefinedAtom::permRW_)
         appendAtom(atom);
     }
 

Modified: lld/trunk/test/pecoff/grouped-sections.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/grouped-sections.test?rev=185130&r1=185129&r2=185130&view=diff
==============================================================================
--- lld/trunk/test/pecoff/grouped-sections.test (original)
+++ lld/trunk/test/pecoff/grouped-sections.test Thu Jun 27 23:15:37 2013
@@ -11,5 +11,5 @@
 # If all the sections will be merged correctly, the resulting ".data"
 # section will have the string "Hello, world".
 
-CHECK: Contents of section .rdata:
+CHECK: Contents of section .data:
 CHECK-NEXT: Hello, world

Modified: lld/trunk/test/pecoff/hello.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/hello.test?rev=185130&r1=185129&r2=185130&view=diff
==============================================================================
--- lld/trunk/test/pecoff/hello.test (original)
+++ lld/trunk/test/pecoff/hello.test Thu Jun 27 23:15:37 2013
@@ -26,9 +26,9 @@ CHECK:   }
 CHECK:   Section {
 CHECK:     Number: 2
 CHECK:     Name: .rdata (2E 72 64 61 74 61 00 00)
-CHECK:     VirtualSize: 0x18
+CHECK:     VirtualSize: 0x0
 CHECK:     VirtualAddress: 0x2000
-CHECK:     RawDataSize: 24
+CHECK:     RawDataSize: 0
 CHECK:     PointerToRawData: 0x400
 CHECK:     PointerToRelocations: 0x0
 CHECK:     PointerToLineNumbers: 0x0
@@ -42,10 +42,10 @@ CHECK:   }
 CHECK:   Section {
 CHECK:     Number: 3
 CHECK:     Name: .data (2E 64 61 74 61 00 00 00)
-CHECK:     VirtualSize: 0x0
-CHECK:     VirtualAddress: 0x3000
-CHECK:     RawDataSize: 0
-CHECK:     PointerToRawData: 0x600
+CHECK:     VirtualSize: 0x18
+CHECK:     VirtualAddress: 0x2000
+CHECK:     RawDataSize: 24
+CHECK:     PointerToRawData: 0x400
 CHECK:     PointerToRelocations: 0x0
 CHECK:     PointerToLineNumbers: 0x0
 CHECK:     RelocationCount: 0





More information about the llvm-commits mailing list