<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 - clang-13 -static-pie AND -fuse-ld=lld produce unusable a.out"
href="https://bugs.llvm.org/show_bug.cgi?id=52201">52201</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-13 -static-pie AND -fuse-ld=lld produce unusable a.out
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ryutaroh@ict.e.titech.ac.jp
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>This is originally reported to the downstream Debian BTS as
<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996752">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996752</a>
I am unsure if this issue comes from rcrt1.o (crt1.o for static-pie) and/or
ld-lld, instead of clang-13.
I wanted to choose 13 as "Version", but LLVM BTS does not offer 13 as an
option.
Below is a verbatim copy from Debian #996752
Dear Maintainer,
The following transcript should be self-explanatory.
gcc-11 also procudes unusable a.out with -static-pie as
<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996659">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996659</a>
This issue could be a duplicate of #996659
but I am unsure.
This could also be an issue of lld-13 instead of clang-13...
$ clang-13 -g -static-pie -fPIE hello.c
$ ./a.out
hello world!
$ clang-13 -g -fuse-ld=lld -static-pie -fPIE hello.c
$ ./a.out
Segmentation fault
$ ldd a.out
statically linked
$ gdb a.out
GNU gdb (Debian 10.1-2) 10.1.90.20210103-git
Reading symbols from a.out...
(gdb) run
Starting program: /home/ryutaroh/clang-test/a.out
Program received signal SIGSEGV, Segmentation fault.
0x0000fffff7fd8210 in _dl_relocate_static_pie ()
(gdb) info stack
#0 0x0000fffff7fd8210 in _dl_relocate_static_pie ()
#1 0x0000fffff7f8663c in __libc_start_main ()
#2 0x0000fffff7f864b8 in _start ()
(gdb) info local
No symbol table info available.
(gdb) quit
A debugging session is active.
Inferior 1 [process 530049] will be killed.
Quit anyway? (y or n) y
Best regards, Ryutaroh Matsumoto
-- System Information:
Debian Release: bookworm/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'stable-updates'), (500,
'stable-security'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: arm64 (aarch64)
Kernel: Linux 5.14.12-clang13 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_CRAP
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not
set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages clang-13 depends on:
ii binutils 2.37-7
ii libc6 2.32-4
ii libc6-dev 2.32-4
ii libclang-common-13-dev 1:13.0.0-5
ii libclang-cpp13 1:13.0.0-5
ii libclang1-13 1:13.0.0-5
ii libgcc-11-dev 11.2.0-9
ii libgcc-s1 11.2.0-9
ii libllvm13 1:13.0.0-5
ii libobjc-11-dev 11.2.0-9
ii libstdc++-11-dev 11.2.0-9
ii libstdc++6 11.2.0-9
Versions of packages clang-13 recommends:
ii llvm-13-dev 1:13.0.0-5
ii python3 3.9.2-3
Versions of packages clang-13 suggests:
pn clang-13-doc <none>
-- no debconf information</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>