<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 - `error: --rtlib=libgcc requires --unwindlib=libgcc` emitted twice"
href="https://bugs.llvm.org/show_bug.cgi?id=45516">45516</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>`error: --rtlib=libgcc requires --unwindlib=libgcc` emitted twice
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>i@maskray.me
</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>% clang --unwindlib=libunwind /dev/null '-###'
...
clang-11: error: --rtlib=libgcc requires --unwindlib=libgcc
clang-11: error: --rtlib=libgcc requires --unwindlib=libgcc
...
% clang --unwindlib=invalid /dev/null '-###'
...
clang-11: error: invalid unwind library name in argument '--unwindlib=invalid'
clang-11: error: invalid unwind library name in argument '--unwindlib=invalid'
...
clang/lib/Driver/ToolChain.cpp GetUnwindLibType can be called twice. We need to
record whether the diagnostic has been reported to address the issue. Another
idea is to not add -l:libunwind.a or -l:libunwind.so twice.
In the GNU toolchain, libgcc and libgcc_s are duplicated (before and after -lc)
to address the interdependency issue with libc. __absvsi2 may reference abort.
In some GCC configurations, __builtin_trap may call abort. These unneeded
abort/raise calls are the root cause that libgcc libgcc_s or libgcc_eh are
duplicated.
The things around -lc:
gcc exe: -lgcc --as-needed -lgcc_s --no-as-needed
g++ or -shared: -lgcc_s -lgcc
-static or -static-pie: -lgcc -lgcc_eh
In compiler-rt, we may be able to fix these and only add -l:libunwind.{a,so}
once. This can bypass the duplicate diagnostic issue.</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>