[PATCH] [PECOFF] Replace magic number with llvm::COFF::DataDirectoryIndex value

Ron Ofir ron.ofir at gmail.com
Fri Jul 26 09:13:58 PDT 2013


Use llvm::COFF::DataDirectoryIndex instead of magic number

http://llvm-reviews.chandlerc.com/D1225

Files:
  WriterPECOFF.cpp

Index: WriterPECOFF.cpp
===================================================================
--- WriterPECOFF.cpp
+++ WriterPECOFF.cpp
@@ -382,7 +382,8 @@
   }
 
   void setBaseRelocField(uint32_t addr, uint32_t size) {
-    auto *atom = new (_alloc) coff::COFFDataDirectoryAtom(_file, 5);
+    auto *atom = new (_alloc) coff::COFFDataDirectoryAtom(_file,
+        llvm::COFF::DataDirectoryIndex::BASE_RELOCATION_TABLE);
     uint64_t offset = atom->ordinal() * sizeof(llvm::object::data_directory);
     _atomLayouts.push_back(new (_alloc) AtomLayout(atom, offset, offset));
   }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1225.1.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130726/1b971b55/attachment.bin>


More information about the llvm-commits mailing list