forked from OSchip/llvm-project
[PECOFF] Verify parameter in validateImpl() not in the driver.
llvm-svn: 189877
This commit is contained in:
parent
d3b3d71a3a
commit
530488c92a
|
@ -290,13 +290,6 @@ bool WinLinkDriver::parse(int argc, const char *argv[],
|
|||
// Currently we just ignore the value of size parameter.
|
||||
if (parseMemoryOption(inputArg->getValue(), addr, size))
|
||||
return true;
|
||||
// It's an error if the base address is not multiple of 64K.
|
||||
// TODO: move this to validation of LinkingContext
|
||||
if (addr & 0xffff) {
|
||||
diagnostics << "Base address have to be multiple of 64K, but got "
|
||||
<< addr << "\n";
|
||||
return true;
|
||||
}
|
||||
ctx.setBaseAddress(addr);
|
||||
break;
|
||||
case OPT_stack: {
|
||||
|
|
|
@ -48,6 +48,13 @@ bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// It's an error if the base address is not multiple of 64K.
|
||||
if (_baseAddress & 0xffff) {
|
||||
diagnostics << "Base address have to be multiple of 64K, but got "
|
||||
<< _baseAddress << "\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
_reader = createReaderPECOFF(*this);
|
||||
_writer = createWriterPECOFF(*this);
|
||||
return false;
|
||||
|
|
|
@ -9,3 +9,9 @@
|
|||
DEFAULT: ImageBase: 0x400000
|
||||
|
||||
BASE: ImageBase: 0x800000
|
||||
|
||||
|
||||
# RUN: not lld -flavor link /base:3 -- %t.obj >& %t.log
|
||||
# RUN: FileCheck -check-prefix=ERROR %s < %t.log
|
||||
|
||||
ERROR: Base address have to be multiple of 64K, but got 3
|
||||
|
|
Loading…
Reference in New Issue