<div dir="ltr">Hi Reid, <div><br></div><div>Sure. Here I attach the trimmed IR(sim_0.ll) which llc.exe takes and produces a 0 storage class symbol.</div><div>The IR is fairly long but there is only 1 usage of real constant as actual argument passing to function iki_vlog_time() at line 137. </div><div>The version of llc.exe is</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>$ llc.exe --version</div><div>  LLVM (<a href="http://llvm.org/" target="_blank">http://llvm.org/</a>):</div><div>  LLVM version 7.0.1</div><div>  DEBUG build.</div><div>  Default target: x86_64-pc-win32</div><div>  Host CPU: skylake</div></blockquote><div>The command I use to produce PE object is:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>llc.exe -filetype=obj -O0 sim_0.ll -o sim_0.obj</div></blockquote><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> 于2019年7月1日周一 下午1:45写道:<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 dir="ltr">I can't speak for what past versions of LLVM used to do, but I can see that today for this IR, we generate an external symbol __real@40...:<div><br></div><div>declare dllimport void @my_function(double, double)<br>define i32 @main() {<br>  call void @my_function(double 2.000000e+00, double 2.000000e+00)<br>  ret i32 0<br>}<br></div><div><br></div><div>$ dumpbin -symbols t.o</div><div>...</div><div>006 00000000 SECT4  notype       Static       | .rdata<br>    Section length    8, #relocs    0, #linenums    0, checksum 76DC4190, selection    2 (pick any)<br>008 00000000 SECT4  notype       External     | __real@4000000000000000<br></div><div>...</div><div><br></div><div>If you can provide complete IR on which llc produces a 0 storage class, that would be interesting, but otherwise there's not much we can do.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019 at 5:59 PM Shiyao Ge via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">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 dir="ltr">Hi, <div><br></div><div>I am using the llvm codegen facility (version 7.0.1) to translate LLVM IR for different platforms. I have this error particularly in win64 platform. In my IR code I have such code snippet:</div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">%50 = call i8* @my_function(i8* %48, double 2.000000e+00, double 2.000000e+00)<br>...<br>declare dllimport i8* @my_function(i8*, double, double)<br></blockquote>By passing it to llc.exe, I find following symbol is declared in object file's symbol table. </div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>[10](sec  5)(fl 0x00)(ty   0)(scl   0) (nx 0) 0x00000000 __real@4000000000000000</div></div></blockquote><div><div>which has storage class 0, and it will lead to an error when I try to link it with the rest of objects. </div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>obj1.obj: Unrecognized storage class 0 for .rdata symbol `__real@4000000000000000'. </div></div></blockquote><div><br></div>As comparison, I compile an equivalent c file (to my llvm asm file) using clang-7.0 and emit the llvm from there. For this particular line, I see no difference in terms of syntax, except clang generates bunch of function attributes to the function declaration. I pass the clang generated llvm asm to llc and find the output object file also has one symbol has the same name, but the storage class is set to 2. <blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>[10](sec  5)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000  __real@4000000000000000</div></blockquote><div>That will probably resolve the linkage error issue. But I don't understand what's the key factor to determine the storage class and what change should I put into my generated IR. </div><div><br></div><div>Moreover, I looked up the microsoft doc about storage class. The storage class 2 is described as "<span style="color:rgb(0,0,0);font-family:"Segoe UI",SegoeUI,"Segoe WP","Helvetica Neue",Helvetica,Tahoma,Arial,sans-serif;font-size:14px">A value that Microsoft tools use for external symbols.</span><span style="color:rgb(0,0,0);font-family:"Segoe UI",SegoeUI,"Segoe WP","Helvetica Neue",Helvetica,Tahoma,Arial,sans-serif;font-size:14px"> " </span>It doesn't sound like a symbol represents a floating point constant at all. </div><div><span style="color:rgb(0,0,0);font-family:"Segoe UI",SegoeUI,"Segoe WP","Helvetica Neue",Helvetica,Tahoma,Arial,sans-serif;font-size:14px"><br></span></div>Due to my limited knowledge of PE COFF and llvm codegen for windows platform,  I am totally confused here. Any suggestion and hint are desperately welcomed!<div><div>-- <br><div dir="ltr" class="m_-5788524534141561868gmail-m_-1296478004605197393gmail-m_4004389349121400198gmail_signature"><div dir="ltr"><div><div dir="ltr">Shiyao Ge (Gracia)<div><br></div><div><br></div></div></div></div></div></div></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>
</blockquote></div></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-5788524534141561868gmail_signature"><div dir="ltr"><div><div dir="ltr">Shiyao Ge (Gracia)<div><br></div><div><br></div></div></div></div></div>