Skip to content

Commit 8cb0f1e

Browse files
committed
[PECOFF] Set resource table entry in header.
The resource table entry should have the RVA of the embedded resource file. llvm-svn: 212765
1 parent 95b83e9 commit 8cb0f1e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,9 @@ void PECOFFWriter::build(const File &linkedFile) {
981981
if (section->getSectionName() == ".pdata")
982982
dataDirectory->setField(DataDirectoryIndex::EXCEPTION_TABLE,
983983
section->getVirtualAddress(), section->size());
984+
if (section->getSectionName() == ".rsrc")
985+
dataDirectory->setField(DataDirectoryIndex::RESOURCE_TABLE,
986+
section->getVirtualAddress(), section->size());
984987
if (section->getSectionName() == ".idata.a")
985988
dataDirectory->setField(DataDirectoryIndex::IAT,
986989
section->getVirtualAddress(), section->size());

lld/test/pecoff/resource.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@
1313

1414
# Multiple resource files are concatenated.
1515
# RUN: cat %t.exe | grep 'H.e.l.l.o.H.e.l.l.o.'
16+
17+
# RUN: lld -flavor link /out:%t.exe /subsystem:console /entry:start /opt:noref \
18+
# RUN: /manifest:embed -- %t.obj %p/Inputs/resource.res
19+
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
20+
21+
CHECK: ResourceTableRVA: 0x1000
22+
CHECK: ResourceTableSize: 0x208

0 commit comments

Comments
 (0)