Skip to content

Commit 64622b9

Browse files
authored
Update Writer.cpp
1 parent 5fffaf6 commit 64622b9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lld/COFF/Writer.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -837,20 +837,21 @@ void Writer::addSyntheticIdata() {
837837

838838
// The loader assumes a specific order of data.
839839
// Add each type in the correct order.
840-
add(".idata$2", idata.dirs);
841-
add(".idata$4", idata.lookups);
840+
add(ctx.config.driver ? "INIT$2" : ".idata$2", idata.dirs);
841+
add(ctx.config.driver ? "INIT$4" : ".idata$4", idata.lookups);
842842
add(".idata$5", idata.addresses);
843843
if (!idata.hints.empty())
844-
add(".idata$6", idata.hints);
845-
add(".idata$7", idata.dllNames);
844+
add(ctx.config.driver ? "INIT$6" : ".idata$6", idata.hints);
845+
add(ctx.config.driver ? "INIT$7" : ".idata$7", idata.dllNames);
846846
}
847847

848848
// Locate the first Chunk and size of the import directory list and the
849849
// IAT.
850850
void Writer::locateImportTables() {
851851
uint32_t rdata = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ;
852852

853-
if (PartialSection *importDirs = findPartialSection(".idata$2", rdata)) {
853+
if (PartialSection *importDirs = findPartialSection(
854+
ctx.config.driver ? "INIT$2" : ".idata$2", rdata)) {
854855
if (!importDirs->chunks.empty())
855856
importTableStart = importDirs->chunks.front();
856857
for (Chunk *c : importDirs->chunks)

0 commit comments

Comments
 (0)