Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lld/COFF
diff options
context:
space:
mode:
Diffstat (limited to 'lld/COFF')
-rw-r--r--lld/COFF/Chunks.cpp6
-rw-r--r--lld/COFF/Chunks.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index c5cf80ec7758..aa2c0be3ef51 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -216,6 +216,12 @@ void StringChunk::writeTo(uint8_t *Buf) {
memcpy(Buf + FileOff, Str.data(), Str.size());
}
+ImportThunkChunk::ImportThunkChunk(Defined *S) : ImpSymbol(S) {
+ // Intel Optimization Manual says that all branch targets
+ // should be 16-byte aligned. MSVC linker does this too.
+ Align = 16;
+}
+
void ImportThunkChunk::writeTo(uint8_t *Buf) {
memcpy(Buf + FileOff, ImportThunkData, sizeof(ImportThunkData));
// The first two bytes is a JMP instruction. Fill its operand.
diff --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h
index d44c02550836..37a6003cf8ec 100644
--- a/lld/COFF/Chunks.h
+++ b/lld/COFF/Chunks.h
@@ -198,7 +198,7 @@ static const uint8_t ImportThunkData[] = {
// contents will be a JMP instruction to some __imp_ symbol.
class ImportThunkChunk : public Chunk {
public:
- explicit ImportThunkChunk(Defined *S) : ImpSymbol(S) {}
+ explicit ImportThunkChunk(Defined *ImpSymbol);
size_t getSize() const override { return sizeof(ImportThunkData); }
void writeTo(uint8_t *Buf) override;