Skip to content

Commit 5f82bf9

Browse files
author
git apple-llvm automerger
committed
Merge commit 'f0a687d821c1' from llvm.org/release/17.x into stable/20230725
2 parents 9b0c8df + f0a687d commit 5f82bf9

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

lld/COFF/InputFiles.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ std::optional<Symbol *> ObjFile::createDefined(
661661
if (prevailing) {
662662
SectionChunk *c = readSection(sectionNumber, def, getName());
663663
sparseChunks[sectionNumber] = c;
664+
if (!c)
665+
return nullptr;
664666
c->sym = cast<DefinedRegular>(leader);
665667
c->selection = selection;
666668
cast<DefinedRegular>(leader)->data = &c->repl;

lld/test/COFF/comdat-drectve.s

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# REQUIRES: x86
2+
3+
# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
4+
5+
# RUN: lld-link %t.obj -out:%t.exe -debug:symtab -subsystem:console
6+
# RUN: llvm-readobj --coff-exports %t.exe | FileCheck %s
7+
8+
# CHECK: Name: exportedFunc
9+
10+
## This assembly snippet has been reduced from what Clang generates from
11+
## this C snippet, with -fsanitize=address. Normally, the .drectve
12+
## section would be a regular section - but when compiled with
13+
## -fsanitize=address, it becomes a comdat section.
14+
##
15+
# void exportedFunc(void) {}
16+
# void mainCRTStartup(void) {}
17+
# static __attribute__((section(".drectve"), used)) const char export_chkstk[] =
18+
# "-export:exportedFunc";
19+
20+
.text
21+
.globl exportedFunc
22+
exportedFunc:
23+
retq
24+
25+
.globl mainCRTStartup
26+
mainCRTStartup:
27+
retq
28+
29+
.section .drectve,"dr",one_only,export_chkstk
30+
export_chkstk:
31+
.asciz "-export:exportedFunc"

0 commit comments

Comments
 (0)