Skip to content

Commit 8ba3ea4

Browse files
committed
stub -> dosStub and parseStub -> parseDosStub
1 parent 0d1b1cc commit 8ba3ea4

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

lld/COFF/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct Configuration {
115115
enum ManifestKind { Default, SideBySide, Embed, No };
116116
bool is64() const { return llvm::COFF::is64Bit(machine); }
117117

118-
std::unique_ptr<MemoryBuffer> stub;
118+
std::unique_ptr<MemoryBuffer> dosStub;
119119
llvm::COFF::MachineTypes machine = IMAGE_FILE_MACHINE_UNKNOWN;
120120
bool machineInferred = false;
121121
size_t wordsize;

lld/COFF/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2420,7 +2420,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
24202420

24212421
// Handle /stub
24222422
if (auto *arg = args.getLastArg(OPT_stub))
2423-
parseStub(arg->getValue());
2423+
parseDosStub(arg->getValue());
24242424

24252425
// Handle /functionpadmin
24262426
for (auto *arg : args.filtered(OPT_functionpadmin, OPT_functionpadmin_opt))

lld/COFF/Driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class LinkerDriver {
237237
void parseAligncomm(StringRef);
238238

239239
// Parses a MS-DOS stub file
240-
void parseStub(StringRef path);
240+
void parseDosStub(StringRef path);
241241

242242
// Parses a string in the form of "[:<integer>]"
243243
void parseFunctionPadMin(llvm::opt::Arg *a);

lld/COFF/DriverUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void LinkerDriver::parseAligncomm(StringRef s) {
246246
std::max(ctx.config.alignComm[std::string(name)], 1 << v);
247247
}
248248

249-
void LinkerDriver::parseStub(StringRef path) {
249+
void LinkerDriver::parseDosStub(StringRef path) {
250250
std::unique_ptr<MemoryBuffer> stub =
251251
CHECK(MemoryBuffer::getFile(path), "could not open " + path);
252252
size_t bufferSize = stub->getBufferSize();
@@ -262,7 +262,7 @@ void LinkerDriver::parseStub(StringRef path) {
262262
Err(ctx) << "/stub: invalid DOS signature: " << path;
263263
if (bufferSize % 8 != 0)
264264
Err(ctx) << "/stub: stub must be aligned to 8 bytes: " << path;
265-
ctx.config.stub = std::move(stub);
265+
ctx.config.dosStub = std::move(stub);
266266
}
267267

268268
// Parses /functionpadmin option argument.

lld/COFF/Writer.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,8 @@ void Writer::sortSections() {
10371037
}
10381038

10391039
void Writer::calculateStubDependentSizes() {
1040-
if (ctx.config.stub)
1041-
dosStubSize = ctx.config.stub->getBufferSize();
1040+
if (ctx.config.dosStub)
1041+
dosStubSize = ctx.config.dosStub->getBufferSize();
10421042
else
10431043
dosStubSize = sizeof(dos_header) + sizeof(dosProgram);
10441044

@@ -1685,12 +1685,13 @@ template <typename PEHeaderTy> void Writer::writeHeader() {
16851685
auto *dos = reinterpret_cast<dos_header *>(buf);
16861686

16871687
// Write DOS program.
1688-
if (config->stub) {
1689-
memcpy(buf, config->stub->getBufferStart(), config->stub->getBufferSize());
1688+
if (config->dosStub) {
1689+
memcpy(buf, config->dosStub->getBufferStart(),
1690+
config->dosStub->getBufferSize());
16901691
// MS link.exe accepts an invalid `e_lfanew` (AddressOfNewExeHeader) and
16911692
// updates it automatically. Replicate the same behaviour.
1692-
dos->AddressOfNewExeHeader = config->stub->getBufferSize();
1693-
buf += config->stub->getBufferSize();
1693+
dos->AddressOfNewExeHeader = config->dosStub->getBufferSize();
1694+
buf += config->dosStub->getBufferSize();
16941695
} else {
16951696
buf += sizeof(dos_header);
16961697
dos->Magic[0] = 'M';

0 commit comments

Comments
 (0)