[PATCH] llvm-readobj: print COFF import table

Rui Ueyama ruiu at google.com
Thu Oct 2 10:03:00 PDT 2014


There's no notion of VA/RVA flag in the import table.
Maybe you are talking about the delay-load import table?
That's different from the (regular) import table.

================
Comment at: tools/llvm-readobj/COFFDumper.cpp:887-888
@@ +886,4 @@
+void COFFDumper::printCOFFImports() {
+  for (auto I = Obj->import_directory_begin(), E = Obj->import_directory_end();
+       I != E; ++I) {
+    DictScope Import(W, "Import");
----------------
majnemer wrote:
> We should probably add an `iterator_range` for this, then you can use a range-based for loop.
Yeah, maybe we should, but not in this patch. All the other iterators in COFFObjects.cpp are written this way, so they should be updated all at once.

================
Comment at: tools/llvm-readobj/COFFDumper.cpp:890
@@ +889,3 @@
+    DictScope Import(W, "Import");
+    StringRef name;
+    if (error(I->getName(name))) return;
----------------
majnemer wrote:
> `Name`
Done

================
Comment at: tools/llvm-readobj/COFFDumper.cpp:893
@@ +892,3 @@
+    W.printString("Name", name);
+    uint32_t addr1, addr2;
+    if (error(I->getImportLookupTableRVA(addr1))) return;
----------------
majnemer wrote:
> `Addr1` and `Addr2`
> 
> Alternatively, you could do:
>     if (error(I->getImportLookupTableRVA(Addr))) return;
>     W.printHex("ImportLookupTableRVA", Addr);
>     if (error(I->getImportAddressTableRVA(Addr))) return;
>     W.printHex("ImportAddressTableRVA", Addr);
Done

http://reviews.llvm.org/D5569






More information about the llvm-commits mailing list