Issue 88061
Summary [LLD] Unreachable executed with `-fsplit-stack`
Labels lld
Assignees
Reporter patrick-rivos
    Testcase:
```c
int strcmp();
int main(int a, char *b[]) { strcmp(b[1], ""); }
```

Backtrace:
```
Target doesn't support split stacks.
UNREACHABLE executed at /scratch/tc-testing/tc-apr-4/llvm/lld/ELF/Target.cpp:144!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
 #0 0x000057fbb776f630 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/ld.lld+0x6a7630)
 #1 0x000057fbb776ca3f llvm::sys::RunSignalHandlers() (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/ld.lld+0x6a4a3f)
 #2 0x000057fbb776cb95 SignalHandler(int) Signals.cpp:0:0
 #3 0x000073eaf8a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000073eaf8a969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x000073eaf8a969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x000073eaf8a969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x000073eaf8a42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x000073eaf8a287f3 abort ./stdlib/abort.c:81:7
 #9 0x000057fbb770890e (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/ld.lld+0x64090e)
#10 0x000057fbb79f5672 (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/ld.lld+0x92d672)
#11 0x000057fbb7944ce3 void lld::elf::InputSectionBase::adjustSplitStackFunctionPrologues<llvm::object::ELFType<(llvm::endianness)1, true>>(unsigned char*, unsigned char*) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/ld.lld+0x87cce3)
#12 0x000057fbb7945145 void lld::elf::InputSectionBase::relocate<llvm::object::ELFType<(llvm::endianness)1, true>>(unsigned char*, unsigned char*) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/ld.lld+0x87d145)
#13 0x000057fbb796cc4c std::_Function_handler<void (), void lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true>>(unsigned char*, llvm::parallel::TaskGroup&)::'lambda1'()>::_M_invoke(std::_Any_data const&) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/ld.lld+0x8a4c4c)
#14 0x000057fbba3d9eaa std::_Function_handler<void (), llvm::parallel::TaskGroup::spawn(std::function<void ()>, bool)::'lambda'()>::_M_invoke(std::_Any_data const&) Parallel.cpp:0:0
#15 0x000057fbba3da0c8 llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::work(llvm::ThreadPoolStrategy, unsigned int) Parallel.cpp:0:0
#16 0x000073eaf8edc253 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc253)
#17 0x000073eaf8a94ac3 start_thread ./nptl/pthread_create.c:442:8
#18 0x000073eaf8b26850 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:83:0
clang: error: unable to execute command: Aborted (core dumped)
clang: error: linker command failed due to signal (use -v to see invocation)
```

Currently targets that don't support split stacks panic and ask the user to report a bug. I think this should be downgraded to a simple "ld.lld: error". I'll send a PR shortly.

Godbolt: https://godbolt.org/z/zv63a9s4x

Found via fuzzer
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to