<div dir="ltr">On Wed, Jun 18, 2014 at 9:09 AM, Damanjit Singh <span dir="ltr"><<a href="mailto:dsingh@adobe.com" target="_blank">dsingh@adobe.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;font-family:Calibri,sans-serif;font-size:14px;color:rgb(0,0,0)">
<div>Hi Saleem,</div>
<div><br>
</div>
<div>Though a simple app works great I am facing few issues trying to link a slightly complex object file, generated via LLVM, with some libs generated via Visual Studio - </div>
<div>1. Seems IMAGE_SCN_MEM_16BIT is only written for the the first header in the COFF file, thus functions in other headers (if you are using function sections) don’t work. I was able to workaround this by forcing this entry for each header by making some
(hacky) changes in LLVM sources. I am not much familiar with the LLVM source code, thus would better let the experts to do a correct fix for this issue.</div></div></blockquote><div><br></div><div>Sounds like non-default text sections aren't being emitted correctly. This would be problematic, particularly in the future if we are to maintain compatibility with the Microsoft toolchain. They are switching to grouped sections by default for aiding optimizations. I will look into this.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;font-family:Calibri,sans-serif;font-size:14px;color:rgb(0,0,0)">
<div>2. There is something strange happening with <b>b.w</b> instruction in the final linked executable. I see that in the disassembly for object code (generated via LLVM with thumbv7-windows-msvc triple), the b.w instruction correctly points to the label I
want. But after linking, it now points to some random address. Seems like there are some fixup issues related to
<b>b.w</b> instruction. Note that I am using Visual Studio’s linker to create a Window’s phone app.</div></div></blockquote><div><br></div><div>This is interesting. It sounds like this should be an IMAGE_REL_ARM_BRANCH20T relocation. I've never really seen any issues with this particular relocation. I would need some code that generates the issue that you are seeing so that I can investigate the cause of the bad linking (or at least something with which to reproduce the issue).</div>
<div><br></div><div>It may be informative to determine what the difference is between the emitted location and what it should be.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;font-family:Calibri,sans-serif;font-size:14px;color:rgb(0,0,0)">
<div>I would really appreciate any help, or pointers for further investigation, for the second issue above.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Daman</div><div><div class="h5">
<div><br>
</div>
<div>On 09/06/14 8:45 pm, "Saleem Abdulrasool" <<a href="mailto:abdulras@fb.com" target="_blank">abdulras@fb.com</a>> wrote:</div>
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div><br>
</div>
<div>On Jun 8, 2014, at 10:46 PM, Damanjit Singh <<a href="mailto:dsingh@adobe.com" target="_blank">dsingh@adobe.com</a>> wrote:</div>
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>Thanks a lot Saleem,</div>
<div></div>
<div>The issue is fixed and a simple app works fine now.</div>
</blockquote>
<div><br>
</div>
<div>Awesome; thanks for the verification.</div>
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>-Daman</div>
<div></div>
<div>On 08/06/14 12:57 pm, "Nick Lewycky" <<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a>> wrote:</div>
<div></div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>Damanjit Singh wrote:</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>Thanks Saleem, Nick.</div>
<div></div>
<div>I will try with the latest code and share the results.</div>
<div></div>
<div>Though, just curious if I need to really use clang to generate the</div>
<div>object file and the current steps won't work? I ask because using .c</div>
<div>file was only an illustration. For my project the IR is not generated</div>
<div>from .c files or clang.</div>
</blockquote>
<div></div>
<div>You don't need to use clang. When you use clang you have to tell it what</div>
<div>target it's targeting.</div>
<div></div>
<div>If you're starting with IR, try "llc -filetype=obj foo.bc -o foo.obj</div>
<div>-mtriple=..." to produce a .o file directly. I'm not experienced with it</div>
<div>myself but I've heard that MSVC will produce assembly that it can't</div>
<div>parse, so it's probably a good idea to leave assembly out of the</div>
<div>equation when targeting Windows.</div>
<div></div>
<div>Nick</div>
<div></div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>On 08-Jun-2014, at 11:00 am, "Saleem Abdulrasool" <<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a></div>
<div><<a href="mailto:compnerd@compnerd.org%3E" target="_blank">mailto:compnerd@compnerd.org></a>> wrote:</div>
<div></div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>On Sat, Jun 7, 2014 at 4:49 PM, Nick Lewycky <<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a></div>
<div><<a href="mailto:nicholas@mxc.ca%3E" target="_blank">mailto:nicholas@mxc.ca></a>> wrote:</div>
<div></div>
<div> Damanjit Singh wrote:</div>
<div></div>
<div> Hi guys,</div>
<div></div>
<div> Would really appreciate any help here.</div>
<div></div>
<div> Thanks,</div>
<div> Daman</div>
<div></div>
<div> From: Damanjit Singh <<a href="mailto:dsingh@adobe.com" target="_blank">dsingh@adobe.com</a></div>
<div> <<a href="mailto:dsingh@adobe.com" target="_blank">mailto:dsingh@adobe.com</a>> <<a href="mailto:dsingh@adobe.com%3E%3E" target="_blank">mailto:dsingh@adobe.com>></a>> <<a href="mailto:dsingh@adobe.com%3E%3E" target="_blank">mailto:dsingh@adobe.com>></a>></div>
<div></div>
<div> Date: Friday, 6 June 2014 12:57 pm</div>
<div> To: "<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a> <<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">mailto:llvmdev@cs.uiuc.edu</a>></div>
<div> <<a href="mailto:llvmdev@cs.uiuc.edu%20%3Cmailto:llvmdev@cs.uiuc.edu%3E%3E" target="_blank">mailto:llvmdev@cs.uiuc.edu%20%3Cmailto:llvmdev@cs.uiuc.edu>></a>"</div>
<div> <<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev@cs.uiuc.edu</a> <<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">mailto:llvmdev@cs.uiuc.edu</a>></div>
<div> <<a href="mailto:llvmdev@cs.uiuc.edu%20%3Cmailto:llvmdev@cs.uiuc.edu%3E%3E" target="_blank">mailto:llvmdev@cs.uiuc.edu%20%3Cmailto:llvmdev@cs.uiuc.edu>></a>></div>
<div></div>
<div> Subject: Support for Windows Phone 8.1</div>
<div></div>
<div> Hi LLVMdev,</div>
<div></div>
<div> Does the latest trunk code support Windows Phone 8.1 target ?</div>
<div></div>
<div></div>
<div> I don't know this, but ...</div>
<div></div>
<div> I was trying out a simple program, but Visual Studio 2013¹s</div>
<div>linker</div>
<div> failed for me with this error - app.obj : error LNK2008: Fixup</div>
<div> target is</div>
<div> not aligned Œadd3'</div>
<div></div>
<div> This is what I tried -</div>
<div></div>
<div> * Download latest LLVM sources (as on 4th June) and build them</div>
<div> on my</div>
<div> MAC 10.9 machine.</div>
<div> * Wrote a simple a.c, with add3 function-</div>
<div></div>
<div></div>
<div> int add3(int i, int j)</div>
<div> {</div>
<div> int k = i+j;</div>
<div> return k;</div>
<div> }</div>
<div></div>
<div> * Create LLVM IR using Xcode 5.1¹s clang ( *clang S -O0</div>
<div> -emitllvm a.c* )</div>
<div> * Create obj file using llc - *. /i686-apple-darwin11-llc</div>
<div> -filetype=obj -mtriple=thumbv7-windows-msvc -O0 a.s *</div>
<div></div>
<div></div>
<div> ... in general this doesn't work. The transformation from C to</div>
<div> LLVM IR needs to know the target triple. Try "clang</div>
<div> --target=thumbv7-windows-msvc a.c -c -o a.obj"? Since clang has a</div>
<div> built-in assembler, you should get a valid COFF file out, to the</div>
<div> extent that clang and llvm support this target.</div>
<div></div>
<div> If that doesn't work, I may suggest it's unsupported.</div>
<div></div>
<div></div>
<div>As Nick mentioned, please generate the object file directly from</div>
<div>clang. You can use armv7-windows or thumbv7-windows (clang will</div>
<div>translate armv7-windows to thumbv7-windows implicitly). I just fixed a</div>
<div>bug that should allow you to link the object files with link.</div>
<div></div>
<div> Nick</div>
<div></div>
<div> * Now on a Windows 8.1 Desktop machine, link this object file</div>
<div> into</div>
<div></div>
<div> sample (new DirectX app, windows phone) Visual Studio 2013</div>
<div> project.</div>
<div> * Declare and Call add3 in the sample windows project.</div>
<div> * I then get a linker error on building the solution.</div>
<div></div>
<div> *1>app.obj : error LNK2008: Fixup target is not aligned 'add3'*</div>
<div> *1>LINK : fatal error LNK1165: link failed because of fixup</div>
<div> errors*</div>
<div> *========== Rebuild All: 0 succeeded, 1 failed, 0 skipped</div>
<div> ==========*</div>
<div></div>
<div></div>
<div></div>
<div> Could someone please confirm about the state of support for</div>
<div> Windows</div>
<div> Phone 8.1 ? Or am I missing something here?</div>
<div></div>
<div> Thanks,</div>
<div> Daman</div>
<div></div>
<div></div>
<div> ______________________________ _________________</div>
<div> LLVM Developers mailing list</div>
<div> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">mailto:LLVMdev@cs.uiuc.edu</a>></div>
<div> <a href="https://urldefense.proofpoint.com/v1/url?u=http://llvm.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=3b8b44359c57ff853178c7ac52020429ecdd7082f0022b9df52ceccce0c2c037" target="_blank">https://urldefense.proofpoint.com/v1/url?u=http://llvm.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=3b8b44359c57ff853178c7ac52020429ecdd7082f0022b9df52ceccce0c2c037</a></div>
<div> <a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=c2b3af446125b243021edc6166e06545c6537664f0739fcd73f556617e6a12a8" target="_blank">https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=c2b3af446125b243021edc6166e06545c6537664f0739fcd73f556617e6a12a8</a>
mailman/listinfo/llvmdev</div>
<div> <<a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=ccdee7a002753f1de3fb195d0b136caf547181d34ca78c2062b54f3c11c91b5f" target="_blank">https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=ccdee7a002753f1de3fb195d0b136caf547181d34ca78c2062b54f3c11c91b5f</a>></div>
<div></div>
<div></div>
<div> ______________________________ _________________</div>
<div> LLVM Developers mailing list</div>
<div> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">mailto:LLVMdev@cs.uiuc.edu</a>></div>
<div> <a href="https://urldefense.proofpoint.com/v1/url?u=http://llvm.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=3b8b44359c57ff853178c7ac52020429ecdd7082f0022b9df52ceccce0c2c037" target="_blank">https://urldefense.proofpoint.com/v1/url?u=http://llvm.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=3b8b44359c57ff853178c7ac52020429ecdd7082f0022b9df52ceccce0c2c037</a></div>
<div> <a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=c2b3af446125b243021edc6166e06545c6537664f0739fcd73f556617e6a12a8" target="_blank">https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=c2b3af446125b243021edc6166e06545c6537664f0739fcd73f556617e6a12a8</a>
mailman/listinfo/llvmdev</div>
<div> <<a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=ccdee7a002753f1de3fb195d0b136caf547181d34ca78c2062b54f3c11c91b5f" target="_blank">https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=ccdee7a002753f1de3fb195d0b136caf547181d34ca78c2062b54f3c11c91b5f</a>></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div>--</div>
<div>Saleem Abdulrasool</div>
<div>compnerd (at) compnerd (dot) org</div>
</blockquote>
</blockquote>
<div></div>
</blockquote>
<div></div>
<div></div>
<div>_______________________________________________</div>
<div>LLVM Developers mailing list</div>
<div><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="https://urldefense.proofpoint.com/v1/url?u=http://llvm.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=3b8b44359c57ff853178c7ac52020429ecdd7082f0022b9df52ceccce0c2c037" target="_blank">
https://urldefense.proofpoint.com/v1/url?u=http://llvm.cs.uiuc.edu/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=3b8b44359c57ff853178c7ac52020429ecdd7082f0022b9df52ceccce0c2c037</a></div>
<div><a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=ccdee7a002753f1de3fb195d0b136caf547181d34ca78c2062b54f3c11c91b5f" target="_blank">https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=CchYc4lrV44%2BZqxZADw0BQ%3D%3D%0A&m=0Qe%2Bx9MyG7ElZcfL7G1YH5wesJKdCF6vcfoxdGGlllA%3D%0A&s=ccdee7a002753f1de3fb195d0b136caf547181d34ca78c2062b54f3c11c91b5f</a></div>
</blockquote>
<div><br>
</div>
<div>-- </div>
<div>Saleem Abdulrasool</div>
<div>abdulras (at) fb (dot) com</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</blockquote>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>