summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-07-10 21:43:19 +0000
committerRui Ueyama <ruiu@google.com>2014-07-10 21:43:19 +0000
commit8cb0f1e3c0cc762985281ae1914887ef0d791bc2 (patch)
tree8dde42c9450ef5aa817c0bfa44be520542b20be9
parent95b83e917e40bafd7e5bf0a4cdc592745b3b1fcc (diff)
downloadbcm5719-llvm-8cb0f1e3c0cc762985281ae1914887ef0d791bc2.tar.gz
bcm5719-llvm-8cb0f1e3c0cc762985281ae1914887ef0d791bc2.zip
[PECOFF] Set resource table entry in header.
The resource table entry should have the RVA of the embedded resource file. llvm-svn: 212765
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp3
-rw-r--r--lld/test/pecoff/resource.test7
2 files changed, 10 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index 83fbaa99446..65ab03f4c24 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -981,6 +981,9 @@ void PECOFFWriter::build(const File &linkedFile) {
if (section->getSectionName() == ".pdata")
dataDirectory->setField(DataDirectoryIndex::EXCEPTION_TABLE,
section->getVirtualAddress(), section->size());
+ if (section->getSectionName() == ".rsrc")
+ dataDirectory->setField(DataDirectoryIndex::RESOURCE_TABLE,
+ section->getVirtualAddress(), section->size());
if (section->getSectionName() == ".idata.a")
dataDirectory->setField(DataDirectoryIndex::IAT,
section->getVirtualAddress(), section->size());
diff --git a/lld/test/pecoff/resource.test b/lld/test/pecoff/resource.test
index 4d26a67c990..bb0f13e8c69 100644
--- a/lld/test/pecoff/resource.test
+++ b/lld/test/pecoff/resource.test
@@ -13,3 +13,10 @@
# Multiple resource files are concatenated.
# RUN: cat %t.exe | grep 'H.e.l.l.o.H.e.l.l.o.'
+
+# RUN: lld -flavor link /out:%t.exe /subsystem:console /entry:start /opt:noref \
+# RUN: /manifest:embed -- %t.obj %p/Inputs/resource.res
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
+
+CHECK: ResourceTableRVA: 0x1000
+CHECK: ResourceTableSize: 0x208
OpenPOWER on IntegriCloud