Skip to content

Commit 96aac67

Browse files
[lld] Error on unsupported split stack (#88063)
Targets with no `-fstack-split` support now emit `ld.lld: error: target doesn't support split stacks` instead of `UNREACHABLE executed` with a backtrace asking the user to report a bug. Resolves #88061
1 parent a42a2ca commit 96aac67

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lld/ELF/Target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ bool TargetInfo::needsThunk(RelExpr expr, RelType type, const InputFile *file,
141141

142142
bool TargetInfo::adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
143143
uint8_t stOther) const {
144-
llvm_unreachable("Target doesn't support split stacks.");
144+
fatal("target doesn't support split stacks");
145145
}
146146

147147
bool TargetInfo::inBranchRange(RelType type, uint64_t src, uint64_t dst) const {

lld/test/ELF/riscv-split-stack.s

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# REQUIRES: riscv
2+
3+
# RUN: split-file %s %t
4+
# RUN: llvm-mc -filetype=obj -triple=riscv64 %t/main.s -o %t.64.o
5+
# RUN: llvm-mc -filetype=obj -triple=riscv64 %t/callee.s -o %t.64.2.o
6+
# RUN: not ld.lld %t.64.o %t.64.2.o -o %t.64 2>&1 | FileCheck %s
7+
# CHECK: error: target doesn't support split stacks
8+
9+
#--- main.s
10+
.globl _start
11+
.type _start,@function
12+
_start:
13+
call test
14+
ret
15+
end:
16+
.size _start, end-_start
17+
.section ".note.GNU-split-stack","",@progbits
18+
19+
20+
#--- callee.s
21+
.globl test
22+
.type test,@function
23+
test:
24+
ret

0 commit comments

Comments
 (0)