OLD | NEW |
1 //===- COFFObjectFile.cpp - COFF object file implementation -----*- C++ -*-===// | 1 //===- COFFObjectFile.cpp - COFF object file implementation -----*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares the COFFObjectFile class. | 10 // This file declares the COFFObjectFile class. |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 else | 414 else |
415 ret.p = reinterpret_cast<uintptr_t>( | 415 ret.p = reinterpret_cast<uintptr_t>( |
416 reinterpret_cast<const coff_relocation*>( | 416 reinterpret_cast<const coff_relocation*>( |
417 base() + sec->PointerToRelocations) | 417 base() + sec->PointerToRelocations) |
418 + sec->NumberOfRelocations); | 418 + sec->NumberOfRelocations); |
419 | 419 |
420 return relocation_iterator(RelocationRef(ret, this)); | 420 return relocation_iterator(RelocationRef(ret, this)); |
421 } | 421 } |
422 | 422 |
423 COFFObjectFile::COFFObjectFile(MemoryBuffer *Object, error_code &ec) | 423 COFFObjectFile::COFFObjectFile(MemoryBuffer *Object, error_code &ec) |
424 : ObjectFile(Binary::isCOFF, Object, ec) | 424 : ObjectFile(Binary::ID_COFF, Object, ec) |
425 , Header(0) | 425 , Header(0) |
426 , SectionTable(0) | 426 , SectionTable(0) |
427 , SymbolTable(0) | 427 , SymbolTable(0) |
428 , StringTable(0) | 428 , StringTable(0) |
429 , StringTableSize(0) { | 429 , StringTableSize(0) { |
430 // Check that we at least have enough room for a header. | 430 // Check that we at least have enough room for a header. |
431 if (!checkSize(Data, ec, sizeof(coff_file_header))) return; | 431 if (!checkSize(Data, ec, sizeof(coff_file_header))) return; |
432 | 432 |
433 // The actual starting location of the COFF header in the file. This can be | 433 // The actual starting location of the COFF header in the file. This can be |
434 // non-zero in PE/COFF files. | 434 // non-zero in PE/COFF files. |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 753 } |
754 | 754 |
755 namespace llvm { | 755 namespace llvm { |
756 | 756 |
757 ObjectFile *ObjectFile::createCOFFObjectFile(MemoryBuffer *Object) { | 757 ObjectFile *ObjectFile::createCOFFObjectFile(MemoryBuffer *Object) { |
758 error_code ec; | 758 error_code ec; |
759 return new COFFObjectFile(Object, ec); | 759 return new COFFObjectFile(Object, ec); |
760 } | 760 } |
761 | 761 |
762 } // end namespace llvm | 762 } // end namespace llvm |
OLD | NEW |