[PECOFF] Fix x64 export table.
Export table entry is 64 bit wide in x64. If MSB is 1, it means it's imported by ordinal. The shift value was wrong. llvm-svn: 218728
This commit is contained in:
parent
32b0f365a2
commit
14798caac6
|
@ -51,7 +51,7 @@ std::vector<uint8_t> HintNameAtom::assembleRawContent(uint16_t hint,
|
|||
}
|
||||
|
||||
std::vector<uint8_t>
|
||||
ImportTableEntryAtom::assembleRawContent(uint32_t rva, bool is64) {
|
||||
ImportTableEntryAtom::assembleRawContent(uint64_t rva, bool is64) {
|
||||
// The element size of the import table is 32 bit in PE and 64 bit
|
||||
// in PE+. In PE+, bits 62-31 are filled with zero.
|
||||
if (is64) {
|
||||
|
@ -99,7 +99,8 @@ std::vector<ImportTableEntryAtom *> ImportDirectoryAtom::createImportTableAtoms(
|
|||
ImportTableEntryAtom *entry = nullptr;
|
||||
if (atom->importName().empty()) {
|
||||
// Import by ordinal
|
||||
uint32_t hint = (1U << 31) | atom->hint();
|
||||
uint64_t hint = atom->hint();
|
||||
hint |= _is64 ? (uint64_t(1) << 63) : (uint64_t(1) << 31);
|
||||
entry = new (_alloc) ImportTableEntryAtom(context, hint, sectionName);
|
||||
} else {
|
||||
// Import by name
|
||||
|
|
|
@ -83,7 +83,7 @@ private:
|
|||
|
||||
class ImportTableEntryAtom : public IdataAtom {
|
||||
public:
|
||||
ImportTableEntryAtom(Context &ctx, uint32_t contents, StringRef sectionName)
|
||||
ImportTableEntryAtom(Context &ctx, uint64_t contents, StringRef sectionName)
|
||||
: IdataAtom(ctx, assembleRawContent(contents, ctx.is64)),
|
||||
_sectionName(sectionName) {}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
std::vector<uint8_t> assembleRawContent(uint32_t contents, bool is64);
|
||||
std::vector<uint8_t> assembleRawContent(uint64_t contents, bool is64);
|
||||
StringRef _sectionName;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue