<div dir="ltr"><div>This is expected behavior -- if you use floating point operations in a source file, the _fltused symbol is mentioned in order to run the floating-point-environment initialization routine from the MS CRT.<br></div><div><br></div><div>If you want to make a standalone binary, not linking against the CRT, you can simply define "int _fltused = 0;" in some source file, within extern "C" {} if you're in C++. (Note that the definition of the symbol doesn't actually matter, since it's normally only used as a trigger to pull in the initialization function.)</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 5, 2019 at 9:13 AM Shi, Steven via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_3661617795117290383WordSection1">
<p class="MsoNormal">Hi Rui, Peter,<u></u><u></u></p>
<p class="MsoNormal">We meet a problem to use lld-link to generate uefi binary. It is related to the lld-link force to use float point lib symbol: _fltused. Uefi binary doesn’t use any external float point lib and we don’t know how to tell lld-link not to emit
the float point lib symbol. Below is a simplified example to reproduce this issue. Please give me some advice. Thanks!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">$ cat main.c<u></u><u></u></p>
<p class="MsoNormal">double v=0;<u></u><u></u></p>
<p class="MsoNormal">void mainfunction(){<u></u><u></u></p>
<p class="MsoNormal"> v+=1;<u></u><u></u></p>
<p class="MsoNormal">}<u></u><u></u></p>
<p class="MsoNormal">$ ~/llvm-project/releaseinstall/bin/clang -c -Oz -flto -target x86_64-unknown-windows main.c -o <a href="http://main.ir" target="_blank">main.ir</a><u></u><u></u></p>
<p class="MsoNormal">$ ~/llvm-project/releaseinstall/bin/lld-link /machine:X64 /DLL /ENTRY:mainfunction <a href="http://main.ir" target="_blank">main.ir</a> /OUT:main.dll<u></u><u></u></p>
<p class="MsoNormal"><span style="color:red">lld-link: error: undefined symbol: _fltused<u></u><u></u></span></p>
<p class="MsoNormal">>>> referenced by lto.tmp<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks<u></u><u></u></p>
<p class="MsoNormal">Steven<u></u><u></u></p>
</div>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>