This is an archive of the discontinued LLVM Phabricator instance.

llvm-readobj: print COFF imported symbols
ClosedPublic

Authored by ruiu on Oct 2 2014, 12:44 PM.

Details

Reviewers
majnemer
Summary

llvm-readobj: print COFF imported symbols

This patch defines a new iterator for the imported symbols.
Make a change to COFFDumper to use that iterator to print
out imported symbols and its ordinals.

Diff Detail

Event Timeline

ruiu updated this revision to Diff 14342.Oct 2 2014, 12:44 PM
ruiu retitled this revision from to llvm-readobj: print COFF imported symbols.
ruiu updated this object.
ruiu edited the test plan for this revision. (Show Details)
ruiu added a reviewer: majnemer.
ruiu added a subscriber: Unknown Object (MLST).
majnemer added inline comments.Oct 2 2014, 2:37 PM
include/llvm/Object/COFF.h
164–187

As we discussed, the following might be a better approach:

template <typename IntTy>
struct import_lookup_table_entry {
  IntTy Data;

  bool isOrdinal() const { return Data < 0; }

  uint16_t getOrdinal() const {
    assert(isOrdinal() && "ILT entry is not an ordinal!");
    return static_cast<uint16_t>(Data);
  }

  uint32_t getHintNameRVA() const {
    assert(!isOrdinal() && "ILT entry is not a Hint/Name RVA!");
    return static_cast<uint32_t>(Data);
  }
}

typedef import_lookup_table_entry<support::slittle32_t> import_lookup_table_entry32;
typedef import_lookup_table_entry<support::slittle64_t> import_lookup_table_entry64;
183

Data

185

This should probably be 63, not 62. It's probably better to just make data signed.

lib/Object/COFFObjectFile.cpp
1063

This should be a little endian cast.

1067

Here too.

tools/llvm-readobj/COFFDumper.cpp
898–899

Range iterator would be nice here too.

ruiu updated this revision to Diff 14350.Oct 2 2014, 2:51 PM
ruiu added inline comments.
include/llvm/Object/COFF.h
164–187

Done.

183

There's existing code that refers to this field in import_lookup_table_entry32, so I'll rename it in a different patch.

185

Done.

lib/Object/COFFObjectFile.cpp
1063

Done.

1067

Done.

majnemer accepted this revision.Oct 2 2014, 3:10 PM
majnemer edited edge metadata.

LGTM with changes applied.

include/llvm/Object/COFF.h
167

Please capitalize this.

This revision is now accepted and ready to land.Oct 2 2014, 3:10 PM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r218915.