Skip to content

Commit 616007d

Browse files
authored
[LLD][COFF] Skip sections marked as IMAGE_SCN_LNK_INFO in the output image (#122752)
Fixes #106275.
1 parent 97cf5aa commit 616007d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lld/COFF/InputFiles.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ SectionChunk *ObjFile::readSection(uint32_t sectionNumber,
355355
MergeChunk::addSection(symtab.ctx, c);
356356
else if (name == ".rsrc" || name.starts_with(".rsrc$"))
357357
resourceChunks.push_back(c);
358-
else
358+
else if (!(sec->Characteristics & llvm::COFF::IMAGE_SCN_LNK_INFO))
359359
chunks.push_back(c);
360360

361361
return c;

lld/test/COFF/info-sec.s

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// REQUIRES: x86
2+
// Check that sections marked as IMAGE_SCN_LNK_INFO are excluded from the output.
3+
4+
// RUN: llvm-mc -filetype=obj -triple=x86_64-windows %s -o %t.obj
5+
// RUN: lld-link -machine:amd64 -dll -noentry %t.obj -out:%t.dll
6+
// RUN: llvm-readobj --headers %t.dll | FileCheck %s
7+
// CHECK-NOT: Name: .test
8+
9+
.section .test,"i"
10+
.long 1

0 commit comments

Comments
 (0)