Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lld/COFF/DLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ Chunk *DelayLoadContents::newThunkChunk(DefinedImportData *s,
}
}

EdataContents::EdataContents(COFFLinkerContext &ctx) : ctx(ctx) {
void createEdataChunks(COFFLinkerContext &ctx, std::vector<Chunk *> &chunks) {
unsigned baseOrdinal = 1 << 16, maxOrdinal = 0;
for (Export &e : ctx.config.exports) {
baseOrdinal = std::min(baseOrdinal, (unsigned)e.ordinal);
Expand Down
16 changes: 2 additions & 14 deletions lld/COFF/DLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,8 @@ class DelayLoadContents {
COFFLinkerContext &ctx;
};

// Windows-specific.
// EdataContents creates all chunks for the DLL export table.
class EdataContents {
public:
EdataContents(COFFLinkerContext &ctx);
std::vector<Chunk *> chunks;

uint64_t getRVA() { return chunks[0]->getRVA(); }
uint64_t getSize() {
return chunks.back()->getRVA() + chunks.back()->getSize() - getRVA();
}

COFFLinkerContext &ctx;
};
// Create all chunks for the DLL export table.
void createEdataChunks(COFFLinkerContext &ctx, std::vector<Chunk *> &chunks);

} // namespace lld::coff

Expand Down
7 changes: 4 additions & 3 deletions lld/COFF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ struct ChunkRange {
class Writer {
public:
Writer(COFFLinkerContext &c)
: buffer(c.e.outputBuffer), delayIdata(c), edata(c), ctx(c) {}
: buffer(c.e.outputBuffer), delayIdata(c), ctx(c) {}
void run();

private:
Expand Down Expand Up @@ -298,7 +298,6 @@ class Writer {
Chunk *iatStart = nullptr;
uint64_t iatSize = 0;
DelayLoadContents delayIdata;
EdataContents edata;
bool setNoSEHCharacteristic = false;
uint32_t tlsAlignment = 0;

Expand Down Expand Up @@ -1325,7 +1324,9 @@ void Writer::createExportTable() {
if (ctx.config.hadExplicitExports)
Warn(ctx) << "literal .edata sections override exports";
} else if (!ctx.config.exports.empty()) {
for (Chunk *c : edata.chunks)
std::vector<Chunk *> edataChunks;
createEdataChunks(ctx, edataChunks);
for (Chunk *c : edataChunks)
edataSec->addChunk(c);
}
if (!edataSec->chunks.empty()) {
Expand Down
Loading