[llvm-bugs] [Bug 48345] New: linker segfaults when using -shared on AMDGPU kernel
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 30 17:52:52 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48345
Bug ID: 48345
Summary: linker segfaults when using -shared on AMDGPU kernel
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: fwinter at jlab.org
CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com
When linking a module containing a really trivial function with ld.lld I get:
$ ld.lld -shared module.o -o module.so
ld.lld: /home/users/coe0193/llvm-project/lld/ELF/Arch/AMDGPU.cpp:48: virtual
uint32_t {anonymous}::AMDGPU::calcEFlags() const: Assertion
`!objectFiles.empty()' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0. Program arguments:
/home/users/coe0193/install/llvm-trunk-x86-amdgpu-debug/bin/ld.lld -shared
module_empty.o -o module_empty.so
#0 0x0000155552e30eed llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/users/coe0193/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:22
#1 0x0000155552e30fa4 PrintStackTraceSignalHandler(void*)
/home/users/coe0193/llvm-project/llvm/lib/Support/Unix/Signals.inc:630:1
#2 0x0000155552e2efa6 llvm::sys::RunSignalHandlers()
/home/users/coe0193/llvm-project/llvm/lib/Support/Signals.cpp:71:20
#3 0x0000155552e30934 SignalHandler(int)
/home/users/coe0193/llvm-project/llvm/lib/Support/Unix/Signals.inc:405:1
#4 0x000015555511ddd0 __restore_rt (/lib64/libpthread.so.0+0x12dd0)
#5 0x0000155551d6170f raise (/lib64/libc.so.6+0x3770f)
#6 0x0000155551d4bb25 abort (/lib64/libc.so.6+0x21b25)
#7 0x0000155551d4b9f9 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x219f9)
#8 0x0000155551d59cc6 (/lib64/libc.so.6+0x2fcc6)
#9 0x000015555476b887 (anonymous namespace)::AMDGPU::calcEFlags() const
/home/users/coe0193/llvm-project/lld/ELF/Arch/AMDGPU.cpp:49:41
#10 0x00001555547cc335 void
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(llvm::opt::InputArgList&)
/home/users/coe0193/llvm-project/lld/ELF/Driver.cpp:2209:3
#11 0x00001555547b1ed2 lld::elf::LinkerDriver::main(llvm::ArrayRef<char
const*>) /home/users/coe0193/llvm-project/lld/ELF/Driver.cpp:558:7
#12 0x00001555547ae1ad lld::elf::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&, llvm::raw_ostream&)
/home/users/coe0193/llvm-project/lld/ELF/Driver.cpp:125:3
#13 0x000000000040810a lldMain(int, char const**, llvm::raw_ostream&,
llvm::raw_ostream&, bool)
/home/users/coe0193/llvm-project/lld/tools/lld/lld.cpp:153:12
#14 0x0000000000408581 main
/home/users/coe0193/llvm-project/lld/tools/lld/lld.cpp:211:19
#15 0x0000155551d4d6a3 __libc_start_main (/lib64/libc.so.6+0x236a3)
#16 0x00000000004073ee _start
(/home/users/coe0193/install/llvm-trunk-x86-amdgpu-debug/bin/ld.lld+0x4073ee)
Aborted (core dumped)
This bug is present in LLVM 11 release as well as in LLVM 12 current trunk (as
of Nov. 30th 2020).
On Linux I built llvm-project with
cmake ../llvm-project/llvm \
-DCMAKE_INSTALL_PREFIX="$HOME/install/llvm-trunk-x86-amdgpu-debug" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DCMAKE_BUILD_TYPE="Debug" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DLLVM_TARGETS_TO_BUILD="X86;AMDGPU"
To provoke the bug I created a small module written in LLVM IR containing a
simple AMDGPU kernel function, like
module.ll:
define amdgpu_kernel void @test() {
entry:
ret void
}
Then I compile this module with
$ clang -target amdgcn-amd-amdhsa -mcpu=gfx908 module.ll -o module.o
And try to link a shared library for it:
$ ld.lld -shared module.o -o module.so
This crashes the linker with the above back trace.
Please help!
Frank
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201201/73ea78d1/attachment.html>
More information about the llvm-bugs
mailing list