<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70650>70650</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLVM][LTO] How to use dynamic library libLTO.so?!!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hippyll123
</td>
</tr>
</table>
<pre>
I'm learning something about LTO,libLTO.so is mentioned in the following article,but when I use ld.lld and ld.gold,all of them do not use libLTO.so, I want know where is this dynamic library used.
command and code are as follows:
```c++
// use ld.gold
clang a.c -flto -c
clang b.c -flto -c
clang -flto a.o b.o -o main -fuse-ld=gold
or
// use ld.lld
clang a.c -flto -c
clang b.c -flto -c
clang -flto a.o b.o -o main -fuse-ld=gold
// ----- a.c ---
#include <stdio.h>
extern void foo1(void);
extern void foo4(void);
void foo2(void) {
printf("Foo2\n");
}
void foo3(void) {
foo4();
}
int main(void) {
foo1();
}
// --- b.c ---
#include <stdio.h>
extern void foo2(void);
void foo1(void) {
foo2();
}
void foo4(void) {
printf("Foo4");
}
```
[https://llvm.org/docs/LinkTimeOptimization.html#phase-1-read-llvm-bitcode-files](url)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VF2P6yYQ_TXjl5EtM8T5ePBDk1yrK6Xal1XfscExvRgiwDfd_voKO1HuVtntQ6VGBKPhzJnDQYwIQZ-tUjVUe6iOmZji4Hw96Mvl3RhGPGudfK9fgDYjGiW81faMwY0qDmklWjdFPL29wrcG9gfYHoxuT2-vRXCoA47KRu2skqgtxkFh74xx1znTR90ZBXRop4jXQVl8wSkoNLIwRqKwMi3PzkiggzAGXZ8oRpQOrYsL9l4M6IAveBU24nfrronPq6QgDjqgfLdi1F2Ce-HfU6osoDxC-csyd24cU8H075xUKLxCEW5yA_AbDtblMjqgfRpLlBqg5i5-VrywGpEOWnSY9yY6zLuf4-0n8SUmCodt4TB3OAptMe-noHIjgR8fBZx_JsD8b_U_VM_Tb6mW5_cdrm1nJqkQ-CFEqV0xAP_2c7b6Mypv8YfTEnvnGNA2rYF2wPdPIasnkGW-I-iBQNjcIIgXr23sgbZA1CRUdbBA9IFnc3xGyJ8T3sR8QaBtnP37NJ99nf_wdrmv_-As_att7FOV9LXKJzfzhe-rTz2_v64PDlT7IcbL_AZnM4z5MRbOn4Ea6boA1Jy0_f6mR_V6iXrUf4nUcoohjgaIXwYRVM5yr4TMU2re6pieeN5rowJUR6Dt5A3QLpM1lzu-E5mq2Xq3Xa-rarfJhnq1axnvNqvVRjDO2braMiYUsX7dV7IXXaZrKomzkpcsAVYFlbzjlVLbjVSiZRJWpRqFNsVdfKZDmFS9KddVmRnRKhPmFkxk1RXnzeRSdcx8vaiezgFWpdEhhgdL1NHMvft0-v23dJZqn3pxdcRf3RWjm1vCP7vfo2nyBogBsWzypv7o8lnHYWqLzo03y2-f_OLdH6qLQM2sMvk_n-LvAAAA___KBdWa">