[lld] [LLD][COFF] Align import directory chunk. (PR #80014)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 06:53:09 PST 2024
https://github.com/cjacek created https://github.com/llvm/llvm-project/pull/80014
None
>From 11b0cc8a540c5fb294b8da42b396f1104f1dc680 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Tue, 30 Jan 2024 02:45:41 +0100
Subject: [PATCH] [LLD][COFF] Align import directory chunk.
---
lld/COFF/DLL.cpp | 2 +-
lld/test/COFF/pdb-publics-import.test | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp
index 6b516d8c6d5ef..d0b74ac445499 100644
--- a/lld/COFF/DLL.cpp
+++ b/lld/COFF/DLL.cpp
@@ -110,7 +110,7 @@ class OrdinalOnlyChunk : public NonSectionChunk {
// A chunk for the import descriptor table.
class ImportDirectoryChunk : public NonSectionChunk {
public:
- explicit ImportDirectoryChunk(Chunk *n) : dllName(n) {}
+ explicit ImportDirectoryChunk(Chunk *n) : dllName(n) { setAlignment(4); }
size_t getSize() const override { return sizeof(ImportDirectoryTableEntry); }
void writeTo(uint8_t *buf) const override {
diff --git a/lld/test/COFF/pdb-publics-import.test b/lld/test/COFF/pdb-publics-import.test
index 83f087b662186..3f3ab3662f8f1 100644
--- a/lld/test/COFF/pdb-publics-import.test
+++ b/lld/test/COFF/pdb-publics-import.test
@@ -115,7 +115,7 @@ CHECK-NEXT: characteristics =
CHECK-NEXT: initialized data
CHECK-NEXT: read permissions
CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$2`
-CHECK-NEXT: length = 40, addr = 0002:0061
+CHECK-NEXT: length = 40, addr = 0002:0064
CHECK-NEXT: characteristics =
CHECK-NEXT: initialized data
CHECK-NEXT: read permissions
@@ -162,9 +162,9 @@ CHECK-NEXT: SC[.rdata] | mod = 3, 0002:0000, size = 28, data crc = 0, reloc c
CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
CHECK-NEXT: SC[.rdata] | mod = 3, 0002:0028, size = 33, data crc = 0, reloc crc = 0
CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
-CHECK-NEXT: SC[.rdata] | mod = 3, 0002:0061, size = 20, data crc = 0, reloc crc = 0
+CHECK-NEXT: SC[.rdata] | mod = 3, 0002:0064, size = 20, data crc = 0, reloc crc = 0
CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
-CHECK-NEXT: SC[.rdata] | mod = 3, 0002:0081, size = 20, data crc = 0, reloc crc = 0
+CHECK-NEXT: SC[.rdata] | mod = 3, 0002:0084, size = 20, data crc = 0, reloc crc = 0
CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
CHECK-NEXT: SC[.rdata] | mod = 3, 0002:0104, size = 8, data crc = 0, reloc crc = 0
CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
More information about the llvm-commits
mailing list