summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-06-28 04:15:37 +0000
committerRui Ueyama <ruiu@google.com>2013-06-28 04:15:37 +0000
commit4251055a66ca2b42594b42cb24634f789d22973b (patch)
tree6f866e35ac83bc7395946821606c156ed77dfc06
parentfed750ff3b59152c8d147034ee5aaea5e1cc5c24 (diff)
downloadbcm5719-llvm-4251055a66ca2b42594b42cb24634f789d22973b.tar.gz
bcm5719-llvm-4251055a66ca2b42594b42cb24634f789d22973b.zip
[PECOFF][Writer] Fix a bug that the contents of .data and .rdata were swapped.
llvm-svn: 185130
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp5
-rw-r--r--lld/test/pecoff/grouped-sections.test2
-rw-r--r--lld/test/pecoff/hello.test12
3 files changed, 9 insertions, 10 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index f06bd8ff151..6ed30fadabd 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -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);
}
diff --git a/lld/test/pecoff/grouped-sections.test b/lld/test/pecoff/grouped-sections.test
index ef694cecbac..665c0d04c00 100644
--- a/lld/test/pecoff/grouped-sections.test
+++ b/lld/test/pecoff/grouped-sections.test
@@ -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
diff --git a/lld/test/pecoff/hello.test b/lld/test/pecoff/hello.test
index 621fb585e0c..9359e8e2b23 100644
--- a/lld/test/pecoff/hello.test
+++ b/lld/test/pecoff/hello.test
@@ -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
OpenPOWER on IntegriCloud