Skip to content

[LLD][COFF] Keep hasData true in NullChunk constructor #124368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lld/COFF/DLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class ImportDirectoryChunk : public NonSectionChunk {
class NullChunk : public NonSectionChunk {
public:
explicit NullChunk(size_t n, uint32_t align) : size(n) {
hasData = false;
setAlignment(align);
}
explicit NullChunk(COFFLinkerContext &ctx)
Expand Down
13 changes: 13 additions & 0 deletions lld/test/COFF/arm64ec-import.test
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,19 @@ BASERELOC-NEXT: Type: DIR64
BASERELOC-NEXT: Address: 0x5020
BASERELOC-NEXT: }


Build with -filealign:8 to enable precise size checking.

RUN: lld-link -machine:arm64ec -dll -noentry -out:out-size.dll loadconfig-arm64ec.obj icall.obj hybmp.obj \
RUN: test.obj test-arm64ec.lib test2-arm64ec.lib -filealign:8

RUN: llvm-readobj --headers out-size.dll | FileCheck --check-prefix=RDATA-HEADER %s

RDATA-HEADER: Name: .rdata (2E 72 64 61 74 61 00 00)
RDATA-HEADER-NEXT: VirtualSize: 0x2030
RDATA-HEADER-NEXT: VirtualAddress: 0x3000
RDATA-HEADER-NEXT: RawDataSize: 8240

#--- test.s
.section .test, "r"
.globl arm64ec_data_sym
Expand Down
Loading