Thanks Saleem, Nick. I will try with the latest code and share the results. Though, just curious if I need to really use clang to generate the object file and the current steps won't work? I ask because using .c file was only an illustration. For my project the IR is not generated from .c files or clang. Thanks, Daman Sent from my phone On 08-Jun-2014, at 11:00 am, "Saleem Abdulrasool" <compnerd at compnerd.org<mailto:compnerd at compnerd.org>> wrote: On Sat, Jun 7, 2014 at 4:49 PM, Nick Lewycky <nicholas at mxc.ca<mailto:nicholas at mxc.ca>> wrote: Damanjit Singh wrote: Hi guys, Would really appreciate any help here. Thanks, Daman From: Damanjit Singh <dsingh at adobe.com<mailto:dsingh at adobe.com> <mailto:dsingh at adobe.com<mailto:dsingh at adobe.com>>> Date: Friday, 6 June 2014 12:57 pm To: "llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu> <mailto:llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu>>" <llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu> <mailto:llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu>>> Subject: Support for Windows Phone 8.1 Hi LLVMdev, Does the latest trunk code support Windows Phone 8.1 target ? I don't know this, but ... I was trying out a simple program, but Visual Studio 2013’s linker failed for me with this error - app.obj : error LNK2008: Fixup target is not aligned ‘add3' This is what I tried - * Download latest LLVM sources (as on 4th June) and build them on my MAC 10.9 machine. * Wrote a simple a.c, with add3 function- int add3(int i, int j) { int k = i+j; return k; } * Create LLVM IR using Xcode 5.1’s clang ( *clang –S -O0 -emit–llvm a.c* ) * Create obj file – using llc - *. /i686-apple-darwin11-llc -filetype=obj -mtriple=thumbv7-windows-msvc -O0 a.s * ... in general this doesn't work. The transformation from C to LLVM IR needs to know the target triple. Try "clang --target=thumbv7-windows-msvc a.c -c -o a.obj"? Since clang has a built-in assembler, you should get a valid COFF file out, to the extent that clang and llvm support this target. If that doesn't work, I may suggest it's unsupported. As Nick mentioned, please generate the object file directly from clang. You can use armv7-windows or thumbv7-windows (clang will translate armv7-windows to thumbv7-windows implicitly). I just fixed a bug that should allow you to link the object files with link. Nick * Now on a Windows 8.1 Desktop machine, link this object file into sample (new DirectX app, windows phone) Visual Studio 2013 project. * Declare and Call add3 in the sample windows project. * I then get a linker error on building the solution. *1>app.obj : error LNK2008: Fixup target is not aligned 'add3'* *1>LINK : fatal error LNK1165: link failed because of fixup errors* *========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========* Could someone please confirm about the state of support for Windows Phone 8.1 ? Or am I missing something here? Thanks, Daman _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -- Saleem Abdulrasool compnerd (at) compnerd (dot) org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140608/b63c74ee/attachment.html>
Damanjit Singh wrote:> Thanks Saleem, Nick. > > I will try with the latest code and share the results. > > Though, just curious if I need to really use clang to generate the > object file and the current steps won't work? I ask because using .c > file was only an illustration. For my project the IR is not generated > from .c files or clang.You don't need to use clang. When you use clang you have to tell it what target it's targeting. If you're starting with IR, try "llc -filetype=obj foo.bc -o foo.obj -mtriple=..." to produce a .o file directly. I'm not experienced with it myself but I've heard that MSVC will produce assembly that it can't parse, so it's probably a good idea to leave assembly out of the equation when targeting Windows. Nick> On 08-Jun-2014, at 11:00 am, "Saleem Abdulrasool" <compnerd at compnerd.org > <mailto:compnerd at compnerd.org>> wrote: > >> On Sat, Jun 7, 2014 at 4:49 PM, Nick Lewycky <nicholas at mxc.ca >> <mailto:nicholas at mxc.ca>> wrote: >> >> Damanjit Singh wrote: >> >> Hi guys, >> >> Would really appreciate any help here. >> >> Thanks, >> Daman >> >> From: Damanjit Singh <dsingh at adobe.com >> <mailto:dsingh at adobe.com> <mailto:dsingh at adobe.com >> <mailto:dsingh at adobe.com>>> >> >> Date: Friday, 6 June 2014 12:57 pm >> To: "llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> >> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>" >> <llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> >> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>> >> >> Subject: Support for Windows Phone 8.1 >> >> Hi LLVMdev, >> >> Does the latest trunk code support Windows Phone 8.1 target ? >> >> >> I don't know this, but ... >> >> I was trying out a simple program, but Visual Studio 2013’s linker >> failed for me with this error - app.obj : error LNK2008: Fixup >> target is >> not aligned ‘add3' >> >> This is what I tried - >> >> * Download latest LLVM sources (as on 4th June) and build them >> on my >> MAC 10.9 machine. >> * Wrote a simple a.c, with add3 function- >> >> >> int add3(int i, int j) >> { >> int k = i+j; >> return k; >> } >> >> * Create LLVM IR using Xcode 5.1’s clang ( *clang –S -O0 >> -emit–llvm a.c* ) >> * Create obj file – using llc - *. /i686-apple-darwin11-llc >> -filetype=obj -mtriple=thumbv7-windows-msvc -O0 a.s * >> >> >> ... in general this doesn't work. The transformation from C to >> LLVM IR needs to know the target triple. Try "clang >> --target=thumbv7-windows-msvc a.c -c -o a.obj"? Since clang has a >> built-in assembler, you should get a valid COFF file out, to the >> extent that clang and llvm support this target. >> >> If that doesn't work, I may suggest it's unsupported. >> >> >> As Nick mentioned, please generate the object file directly from >> clang. You can use armv7-windows or thumbv7-windows (clang will >> translate armv7-windows to thumbv7-windows implicitly). I just fixed a >> bug that should allow you to link the object files with link. >> >> Nick >> >> * Now on a Windows 8.1 Desktop machine, link this object file >> into >> >> sample (new DirectX app, windows phone) Visual Studio 2013 >> project. >> * Declare and Call add3 in the sample windows project. >> * I then get a linker error on building the solution. >> >> *1>app.obj : error LNK2008: Fixup target is not aligned 'add3'* >> *1>LINK : fatal error LNK1165: link failed because of fixup >> errors* >> *========== Rebuild All: 0 succeeded, 1 failed, 0 skipped >> ==========* >> >> >> >> Could someone please confirm about the state of support for >> Windows >> Phone 8.1 ? Or am I missing something here? >> >> Thanks, >> Daman >> >> >> ______________________________ _________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> >> http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/ mailman/listinfo/llvmdev >> <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >> >> >> ______________________________ _________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> >> http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/ mailman/listinfo/llvmdev >> <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >> >> >> >> >> -- >> Saleem Abdulrasool >> compnerd (at) compnerd (dot) org
Thanks a lot Saleem, The issue is fixed and a simple app works fine now. -Daman On 08/06/14 12:57 pm, "Nick Lewycky" <nicholas at mxc.ca> wrote:>Damanjit Singh wrote: >> Thanks Saleem, Nick. >> >> I will try with the latest code and share the results. >> >> Though, just curious if I need to really use clang to generate the >> object file and the current steps won't work? I ask because using .c >> file was only an illustration. For my project the IR is not generated >> from .c files or clang. > >You don't need to use clang. When you use clang you have to tell it what >target it's targeting. > >If you're starting with IR, try "llc -filetype=obj foo.bc -o foo.obj >-mtriple=..." to produce a .o file directly. I'm not experienced with it >myself but I've heard that MSVC will produce assembly that it can't >parse, so it's probably a good idea to leave assembly out of the >equation when targeting Windows. > >Nick > >> On 08-Jun-2014, at 11:00 am, "Saleem Abdulrasool" <compnerd at compnerd.org >> <mailto:compnerd at compnerd.org>> wrote: >> >>> On Sat, Jun 7, 2014 at 4:49 PM, Nick Lewycky <nicholas at mxc.ca >>> <mailto:nicholas at mxc.ca>> wrote: >>> >>> Damanjit Singh wrote: >>> >>> Hi guys, >>> >>> Would really appreciate any help here. >>> >>> Thanks, >>> Daman >>> >>> From: Damanjit Singh <dsingh at adobe.com >>> <mailto:dsingh at adobe.com> <mailto:dsingh at adobe.com >>> <mailto:dsingh at adobe.com>>> >>> >>> Date: Friday, 6 June 2014 12:57 pm >>> To: "llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> >>> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>" >>> <llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> >>> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>> >>> >>> Subject: Support for Windows Phone 8.1 >>> >>> Hi LLVMdev, >>> >>> Does the latest trunk code support Windows Phone 8.1 target ? >>> >>> >>> I don't know this, but ... >>> >>> I was trying out a simple program, but Visual Studio 2013¹s >>>linker >>> failed for me with this error - app.obj : error LNK2008: Fixup >>> target is >>> not aligned Œadd3' >>> >>> This is what I tried - >>> >>> * Download latest LLVM sources (as on 4th June) and build them >>> on my >>> MAC 10.9 machine. >>> * Wrote a simple a.c, with add3 function- >>> >>> >>> int add3(int i, int j) >>> { >>> int k = i+j; >>> return k; >>> } >>> >>> * Create LLVM IR using Xcode 5.1¹s clang ( *clang S -O0 >>> -emitllvm a.c* ) >>> * Create obj file using llc - *. /i686-apple-darwin11-llc >>> -filetype=obj -mtriple=thumbv7-windows-msvc -O0 a.s * >>> >>> >>> ... in general this doesn't work. The transformation from C to >>> LLVM IR needs to know the target triple. Try "clang >>> --target=thumbv7-windows-msvc a.c -c -o a.obj"? Since clang has a >>> built-in assembler, you should get a valid COFF file out, to the >>> extent that clang and llvm support this target. >>> >>> If that doesn't work, I may suggest it's unsupported. >>> >>> >>> As Nick mentioned, please generate the object file directly from >>> clang. You can use armv7-windows or thumbv7-windows (clang will >>> translate armv7-windows to thumbv7-windows implicitly). I just fixed a >>> bug that should allow you to link the object files with link. >>> >>> Nick >>> >>> * Now on a Windows 8.1 Desktop machine, link this object file >>> into >>> >>> sample (new DirectX app, windows phone) Visual Studio 2013 >>> project. >>> * Declare and Call add3 in the sample windows project. >>> * I then get a linker error on building the solution. >>> >>> *1>app.obj : error LNK2008: Fixup target is not aligned 'add3'* >>> *1>LINK : fatal error LNK1165: link failed because of fixup >>> errors* >>> *========== Rebuild All: 0 succeeded, 1 failed, 0 skipped >>> ==========* >>> >>> >>> >>> Could someone please confirm about the state of support for >>> Windows >>> Phone 8.1 ? Or am I missing something here? >>> >>> Thanks, >>> Daman >>> >>> >>> ______________________________ _________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> >>> http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/ mailman/listinfo/llvmdev >>> <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >>> >>> >>> ______________________________ _________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> >>> http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/ mailman/listinfo/llvmdev >>> <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >>> >>> >>> >>> >>> -- >>> Saleem Abdulrasool >>> compnerd (at) compnerd (dot) org >