[lld] r189877 - [PECOFF] Verify parameter in validateImpl() not in the driver.
Rui Ueyama
ruiu at google.com
Tue Sep 3 15:57:00 PDT 2013
Author: ruiu
Date: Tue Sep 3 17:57:00 2013
New Revision: 189877
URL: http://llvm.org/viewvc/llvm-project?rev=189877&view=rev
Log:
[PECOFF] Verify parameter in validateImpl() not in the driver.
Modified:
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
lld/trunk/test/pecoff/baseaddr.test
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=189877&r1=189876&r2=189877&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Sep 3 17:57:00 2013
@@ -290,13 +290,6 @@ bool WinLinkDriver::parse(int argc, cons
// 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: {
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=189877&r1=189876&r2=189877&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Tue Sep 3 17:57:00 2013
@@ -48,6 +48,13 @@ bool PECOFFLinkingContext::validateImpl(
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;
Modified: lld/trunk/test/pecoff/baseaddr.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/baseaddr.test?rev=189877&r1=189876&r2=189877&view=diff
==============================================================================
--- lld/trunk/test/pecoff/baseaddr.test (original)
+++ lld/trunk/test/pecoff/baseaddr.test Tue Sep 3 17:57:00 2013
@@ -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
More information about the llvm-commits
mailing list