| Rui Ueyama | 9e56839 | 2013-05-28 18:13:31 +0000 | [diff] [blame] | 1 | //===- lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp -----------------------===// | 
|  | 2 | // | 
|  | 3 | //                             The LLVM Linker | 
|  | 4 | // | 
|  | 5 | // This file is distributed under the University of Illinois Open Source | 
|  | 6 | // License. See LICENSE.TXT for details. | 
|  | 7 | // | 
|  | 8 | //===----------------------------------------------------------------------===// | 
|  | 9 |  | 
|  | 10 | #include "lld/ReaderWriter/PECOFFTargetInfo.h" | 
|  | 11 |  | 
|  | 12 | #include "lld/ReaderWriter/Reader.h" | 
|  | 13 | #include "lld/ReaderWriter/Writer.h" | 
|  | 14 |  | 
|  | 15 | #include "llvm/Support/Debug.h" | 
|  | 16 |  | 
|  | 17 | namespace lld { | 
|  | 18 |  | 
|  | 19 | error_code PECOFFTargetInfo::parseFile( | 
|  | 20 | std::unique_ptr<MemoryBuffer> &mb, | 
|  | 21 | std::vector<std::unique_ptr<File>> &result) const { | 
|  | 22 | return _reader->parseFile(mb, result); | 
|  | 23 | } | 
|  | 24 |  | 
|  | 25 | bool PECOFFTargetInfo::validate(raw_ostream &diagnostics) { | 
| Rui Ueyama | eb0cc96 | 2013-06-08 03:59:00 +0000 | [diff] [blame] | 26 | if (_stackReserve < _stackCommit) { | 
|  | 27 | diagnostics << "Invalid stack size: reserve size must be equal to or " | 
|  | 28 | << "greater than commit size, but got " | 
|  | 29 | << _stackCommit << " and " << _stackReserve << ".\n"; | 
|  | 30 | return true; | 
|  | 31 | } | 
|  | 32 |  | 
| Rui Ueyama | 9dd08d9 | 2013-06-08 22:59:10 +0000 | [diff] [blame] | 33 | if (_heapReserve < _heapCommit) { | 
|  | 34 | diagnostics << "Invalid heap size: reserve size must be equal to or " | 
|  | 35 | << "greater than commit size, but got " | 
|  | 36 | << _heapCommit << " and " << _heapReserve << ".\n"; | 
|  | 37 | return true; | 
|  | 38 | } | 
|  | 39 |  | 
| Rui Ueyama | 9e56839 | 2013-05-28 18:13:31 +0000 | [diff] [blame] | 40 | _reader = createReaderPECOFF(*this); | 
|  | 41 | _writer = createWriterPECOFF(*this); | 
|  | 42 | return false; | 
|  | 43 | } | 
|  | 44 |  | 
|  | 45 | Writer &PECOFFTargetInfo::writer() const { | 
|  | 46 | return *_writer; | 
|  | 47 | } | 
|  | 48 |  | 
|  | 49 | ErrorOr<Reference::Kind> | 
|  | 50 | PECOFFTargetInfo::relocKindFromString(StringRef str) const { | 
|  | 51 | return make_error_code(yaml_reader_error::illegal_value); | 
|  | 52 | } | 
|  | 53 |  | 
|  | 54 | ErrorOr<std::string> | 
|  | 55 | PECOFFTargetInfo::stringFromRelocKind(Reference::Kind kind) const { | 
|  | 56 | return make_error_code(yaml_reader_error::illegal_value); | 
|  | 57 | } | 
|  | 58 |  | 
|  | 59 | } // end namespace lld |