[lld] 616007d - [LLD][COFF] Skip sections marked as IMAGE_SCN_LNK_INFO in the output image (#122752)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 08:29:05 PST 2025
Author: Jacek Caban
Date: 2025-01-14T17:28:59+01:00
New Revision: 616007d88f06f0c523239151d5e52bd4ec61db96
URL: https://github.com/llvm/llvm-project/commit/616007d88f06f0c523239151d5e52bd4ec61db96
DIFF: https://github.com/llvm/llvm-project/commit/616007d88f06f0c523239151d5e52bd4ec61db96.diff
LOG: [LLD][COFF] Skip sections marked as IMAGE_SCN_LNK_INFO in the output image (#122752)
Fixes #106275.
Added:
lld/test/COFF/info-sec.s
Modified:
lld/COFF/InputFiles.cpp
Removed:
################################################################################
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index a94c984cfd4870..e7891d3e67f3e4 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -355,7 +355,7 @@ SectionChunk *ObjFile::readSection(uint32_t sectionNumber,
MergeChunk::addSection(symtab.ctx, c);
else if (name == ".rsrc" || name.starts_with(".rsrc$"))
resourceChunks.push_back(c);
- else
+ else if (!(sec->Characteristics & llvm::COFF::IMAGE_SCN_LNK_INFO))
chunks.push_back(c);
return c;
diff --git a/lld/test/COFF/info-sec.s b/lld/test/COFF/info-sec.s
new file mode 100644
index 00000000000000..bdc2e4711b4040
--- /dev/null
+++ b/lld/test/COFF/info-sec.s
@@ -0,0 +1,10 @@
+// REQUIRES: x86
+// Check that sections marked as IMAGE_SCN_LNK_INFO are excluded from the output.
+
+// RUN: llvm-mc -filetype=obj -triple=x86_64-windows %s -o %t.obj
+// RUN: lld-link -machine:amd64 -dll -noentry %t.obj -out:%t.dll
+// RUN: llvm-readobj --headers %t.dll | FileCheck %s
+// CHECK-NOT: Name: .test
+
+ .section .test,"i"
+ .long 1
More information about the llvm-commits
mailing list