<div dir="ltr">The duplicate symbol errors are for <span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">__llvm_profile_filename and <span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">__llvm_profile_raw_version.  IIUC, these are supposed to be weak symbols but Thin LTO seems to break this in some way.  </span></span>This does't happen with gold or no LTO or full LTO.<div><br></div><div>$ cat > a.c</div><div><div>extern int foo();</div><div><br></div><div>int main() {</div><div>  return foo();</div><div>}</div></div><div><br></div><div>$ cat > b.c</div><div><div>int foo() {</div><div>  return 0;</div><div>}</div></div><div><br>$ clang a.c -fprofile-generate -flto=thin -c</div><div>$ clang b.c -fprofile-generate -flto=thin -c</div><div>$ clang a.o b.o -fprofile-generate -flto=thin -fuse-ld=lld</div><div>ld.lld: error: duplicate symbol: __llvm_profile_filename</div><div>>>> defined at a.c</div><div>>>>            lto.tmp:(__llvm_profile_filename)</div><div>>>> defined at b.c</div><div>>>>            lto.tmp:(.rodata.__llvm_profile_filename+0x0)</div><div><br></div><div>ld.lld: error: duplicate symbol: __llvm_profile_raw_version</div><div>>>> defined at a.c</div><div>>>>            lto.tmp:(__llvm_profile_raw_version)</div><div>>>> defined at b.c</div><div>>>>            lto.tmp:(.rodata.__llvm_profile_raw_version+0x0)</div><div>clang-7: error: linker command failed with exit code 1 (use -v to see invocation)</div><div>Makefile:10: recipe for target 'a.out' failed</div><div>make: *** [a.out] Error 1</div></div>