forked from OSchip/llvm-project
COFF: Fix the import table Hint/Name field.
llvm-svn: 238719
This commit is contained in:
parent
68216c680d
commit
5b25edddfe
|
@ -171,8 +171,11 @@ void ImportThunkChunk::applyRelocations(uint8_t *Buf) {
|
|||
write32le(Buf + FileOff + 2, Operand);
|
||||
}
|
||||
|
||||
HintNameChunk::HintNameChunk(StringRef N, uint16_t H)
|
||||
: Name(N), Hint(H), Size(RoundUpToAlignment(Name.size() + 4, 2)) {}
|
||||
size_t HintNameChunk::getSize() const {
|
||||
// Starts with 2 byte Hint field, followed by a null-terminated string,
|
||||
// ends with 0 or 1 byte padding.
|
||||
return RoundUpToAlignment(Name.size() + 3, 2);
|
||||
}
|
||||
|
||||
void HintNameChunk::writeTo(uint8_t *Buf) {
|
||||
write16le(Buf + FileOff, Hint);
|
||||
|
|
|
@ -194,14 +194,13 @@ private:
|
|||
// A chunk for the import descriptor table.
|
||||
class HintNameChunk : public Chunk {
|
||||
public:
|
||||
HintNameChunk(StringRef Name, uint16_t Hint);
|
||||
size_t getSize() const override { return Size; }
|
||||
HintNameChunk(StringRef N, uint16_t H) : Name(N), Hint(H) {}
|
||||
size_t getSize() const override;
|
||||
void writeTo(uint8_t *Buf) override;
|
||||
|
||||
private:
|
||||
StringRef Name;
|
||||
uint16_t Hint;
|
||||
size_t Size;
|
||||
};
|
||||
|
||||
// A chunk for the import descriptor table.
|
||||
|
|
Loading…
Reference in New Issue