<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - lld-link crash when build openssl with LTO"
href="https://bugs.llvm.org/show_bug.cgi?id=42626">42626</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lld-link crash when build openssl with LTO
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>COFF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>steven.shi@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hello,
We met a lld-link crash problem when build 32bits openssl1.0 with LTO in uefi
firmware. We narrow down and figure out a simple test case to reproduce this
problem as blow. Please advise. Thank you!
$ cat main.c
void TlsDriverEntryPoint ()
{
unsigned char *ret = 0;
const unsigned char cryptopro_ext[17] = {0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01};
int length =17;
const char *Source;
Source = (void*)cryptopro_ext;
while (length--) {
*(ret++) = *(Source++);
}
}
$ cat memcpy.c
typedef unsigned int size_t;
void *memcpy(void *dest, const void *src, size_t n)
{
return 0;
}
$ cat makefile
CC_FLAGS= -Oz -flto -target i686-unknown-windows
CC = /home/jshi19/llvm/llvm-project/releaseinstall/bin/clang
DLINK_FLAGS = /MACHINE:X86 /DLL /ENTRY:TlsDriverEntryPoint
DLINK = /home/jshi19/llvm/llvm-project/releaseinstall/bin/lld-link
SLINK_FLAGS =
SLINK = /home/jshi19/llvm/llvm-project/releaseinstall/bin/llvm-lib
build:
"$(CC)" $(CC_FLAGS) -c -o main.obj main.c
"$(CC)" $(CC_FLAGS) -c -o memcpy.obj memcpy.c
"$(SLINK)" $(SLINK_FLAGS) /OUT:main.lib main.obj
"$(SLINK)" $(SLINK_FLAGS) /OUT:memcpy.lib memcpy.obj
"$(DLINK)" /OUT:f.dll $(DLINK_FLAGS) main.lib memcpy.lib
$ make
"/home/jshi19/llvm/llvm-project/releaseinstall/bin/clang" -Oz -flto -target
i686-unknown-windows -c -o main.obj main.c
"/home/jshi19/llvm/llvm-project/releaseinstall/bin/clang" -Oz -flto -target
i686-unknown-windows -c -o memcpy.obj memcpy.c
"/home/jshi19/llvm/llvm-project/releaseinstall/bin/llvm-lib" /OUT:main.lib
main.obj
"/home/jshi19/llvm/llvm-project/releaseinstall/bin/llvm-lib" /OUT:memcpy.lib
memcpy.obj
"/home/jshi19/llvm/llvm-project/releaseinstall/bin/lld-link" /OUT:f.dll
/MACHINE:X86 /DLL /ENTRY:TlsDriverEntryPoint main.lib memcpy.lib
Stack dump:
0. Program arguments:
/home/jshi19/llvm/llvm-project/releaseinstall/bin/lld-link /OUT:f.dll
/MACHINE:X86 /DLL /ENTRY:TlsDriverEntryPoint main.lib memcpy.lib
#0 0x000055f11ed8585a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jshi19/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:498:0
#1 0x000055f11ed83684 llvm::sys::RunSignalHandlers()
/home/jshi19/llvm/llvm-project/llvm/lib/Support/Signals.cpp:68:0
#2 0x000055f11ed837c2 SignalHandler(int)
/home/jshi19/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:357:0
#3 0x00007f172a5f2890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x000055f11edd8025 lld::coff::DefinedRegular::getChunk() const
/home/jshi19/llvm/llvm-project/lld/COFF/Symbols.h:176:0
#5 0x000055f11edd8025 operator()
/home/jshi19/llvm/llvm-project/lld/COFF/MarkLive.cpp:46:0
#6 0x000055f11edd8025 lld::coff::markLive(llvm::ArrayRef<lld::coff::Chunk*>)
/home/jshi19/llvm/llvm-project/lld/COFF/MarkLive.cpp:55:0
#7 0x000055f11edb763e std::vector<lld::coff::Chunk*,
std::allocator<lld::coff::Chunk*> >::~vector()
/usr/include/c++/7/bits/stl_vector.h:434:0
#8 0x000055f11edb763e lld::coff::LinkerDriver::link(llvm::ArrayRef<char
const*>) /home/jshi19/llvm/llvm-project/lld/COFF/Driver.cpp:1840:0
#9 0x000055f11edb7d08 lld::coff::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&) /home/jshi19/llvm/llvm-project/lld/COFF/Driver.cpp:78:0
#10 0x000055f11ecfa044 main
/home/jshi19/llvm/llvm-project/lld/tools/lld/lld.cpp:155:0
#11 0x00007f17290c9b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#12 0x000055f11ed555ba _start
(/home/jshi19/llvm/llvm-project/releaseinstall/bin/lld-link+0x25a5ba)
Segmentation fault (core dumped)
makefile:12: recipe for target 'build' failed
make: *** [build] Error 139</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>