<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94198>94198</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ld] [lto] using ld and lto, crash while dynamic compile executable
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Zhenhang1213
</td>
</tr>
</table>
<pre>
using lto and ld, crash finally dynamic compile executable.
code:
20081204-2_1.C
```
namespace {
class c
{
public:
c () {}
virtual ~c() {}
};
};
void
foo (void)
{
c x;
}
```
clang++ -fuse-ld=ld -Wno-unused-command-line-argument -Wno-deprecated -fno-caret-diagnostics -fdiagnostics-color=never -fmessage-length=0 -flto -c -o cp_lto_20081204-2_1.o 20081204-2_1.C
20081204-2_0.C
```
extern void foo (void);
int
main ()
{
foo ();
return 0;
}
```
clang++ -fuse-ld=ld -Wno-unused-command-line-argument -Wno-deprecated -fno-caret-diagnostics -fdiagnostics-color=never -fmessage-length=0 -flto -c -o cp_lto_20081204-2_0.o 20081204-2_0.C
finally:
```
clang++ cp_lto_20081204-2_0.o cp_lto_20081204-2_1.o -fuse-ld=ld -Wno-unused-command-line-argument -Wno-deprecated -fno-caret-diagnostics -fdiagnostics-color=never -fmessage-length=0 -flto -o g++-dg-lto-20081204-2-01.exe
clang-15: error: unable to execute command: Segmentation fault (core dumped)
clang-15: error: linker command failed due to signal (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVcuO6ygQ_Rq8KRFh7Dy88KJzo_zALEaaTQtD2WYGg8Ujt3sz3z7CcW46UXrWo5Eip3gdqHMKjghBDxaxJdsj2Z4KkeLofPvHiHYUdih5WRWdU59tCtoOYKIDYRUYRfgPAOlFGKHXVhjzCerTiklLkG6atUHAD5Qpis7ghrATYW_Xr3QKSbU2OGOHkrOa8vdy82OdtmPrb2laMWGYhUQg--MKYUQIINfpt16YU2e0_IUNEgg_EN4sC_entfeifUzCwN_yxWgOquOLePlenFbXqHcugy8dvHk-iISPB5RXaUkj7ED4kfAj0D4FpEaR6mQU0N-to8mmgIpKN03CKmq0RSr8kCa08TpD4exRiogKaG8dlcJjpEqLwboQtQxA-y8tKp1xnlQnixf0QPsJQxADUoN2iCOpTgxonwUGKoE6kPO7ie79QSEHLwV7lpJ9IyV-RPQWMmvwxOAj0drGazAJbVcVn0m-IXxdDeAxJm-B_R_5Z4_8s0f-12v4q_z_Jd_X0K8F_69x42DNgqqBmujo_byUlRv8wC_50nJLqjdA7zP8GySbnyOIbn2cENYk8uBvOOQMRNTOQi-Sibm8pPMIKk0z3m_6S2yj7V_ob4DQC21QgUrLdvmVFSbjpYBAL0sfImh7cXLZ8V7hN90K1VaqqRpRYFvuy33NdnxbFWMruKhFWWNXK2R1zcp901XNQbBmV3eHHRa65YzXbMcq1pT7qtr0Vd93nRS43SGWrCM1w0loszHmMm2cHwodQsK2qcvmUBjRoQmLJXBu8Scsg4Tz7BC-zWtol4ZAamZ0iOGOEnU0i5cYRbYnyEF0OVrtQ13dI7psH1f3-Dlmr_jeO4rkTTvGOIdc2fxM-HnQcUzdRrqJ8HPee_2js3d_ooyEn5cTB8LP14wuLf8nAAD__7jHErM">