Van Dijck, Tom
2010-Feb-14 04:10 UTC
[LLVMdev] Unable to compile .s files generated with llc.
Hey, I've been trying this for a couple days now, finding different assemblers and trying different options but I can't figure it out.. I must be missing something very obvious. I got a simple "hello world" app in llvm, making the .bc file using 'llvm-as test.llvm -o=test.bc' works fine. then I can use llvm-ld to make an executable which then runs fine (although not native), and I can use llc to build the .bc file into a .s file. So far I'm all good... But neither masm, yasm, tasm, fasm, gcc, as, or nasm take the .s file. I only found one other post about this where it was mentioned that only 'GAS" can compile it, so I tried this in both Cygwin and Ubuntu, but to no avail. In cygwin I get: $ gcc /cygdrive/d/test.s /cygdrive/d/test.s: Assembler messages: /cygdrive/d/test.s:4: Error: no such instruction: `align 16' /cygdrive/d/test.s:6: Error: invalid character '@' in mnemonic /cygdrive/d/test.s:7: Error: junk at end of line, first unrecognized character is `%' /cygdrive/d/test.s:15: Error: invalid character '@' in mnemonic /cygdrive/d/test.s:16: Error: no such instruction: `db "Hello, World!\000"' using 'as' I get the same error (I guess gcc just forwards to 'as'). I've tried specifying -x86-asm-syntax=intel, and the att option, neither work with any of the above mentioned assemblers... I'm sort of completely lost now... Using the following: - LLVM 2.6 - GCC 4.4.3 - Cygwin 1.7 Tom.
Charles Davis
2010-Feb-14 04:28 UTC
[LLVMdev] Unable to compile .s files generated with llc.
Van Dijck, Tom wrote:> Hey, > > I've been trying this for a couple days now, finding different assemblers and trying different options but I can't figure it out.. > I must be missing something very obvious. > > I got a simple "hello world" app in llvm, making the .bc file using 'llvm-as test.llvm -o=test.bc' works fine. > then I can use llvm-ld to make an executable which then runs fine (although not native), and I can use llc to build the .bc file into a .s file. > So far I'm all good... > > But neither masm, yasm, tasm, fasm, gcc, as, or nasm take the .s file. > > I only found one other post about this where it was mentioned that only 'GAS" can compile it, so I tried this in both Cygwin and Ubuntu, but to no avail. > In cygwin I get: > > $ gcc /cygdrive/d/test.s > /cygdrive/d/test.s: Assembler messages: > /cygdrive/d/test.s:4: Error: no such instruction: `align 16' > /cygdrive/d/test.s:6: Error: invalid character '@' in mnemonic > /cygdrive/d/test.s:7: Error: junk at end of line, first unrecognized character is `%' > /cygdrive/d/test.s:15: Error: invalid character '@' in mnemonic > /cygdrive/d/test.s:16: Error: no such instruction: `db "Hello, World!\000"' > > using 'as' I get the same error (I guess gcc just forwards to 'as'). > > I've tried specifying -x86-asm-syntax=intel, and the att option, neither work with any of the above mentioned assemblers... > I'm sort of completely lost now...This is a known problem. When the target OS is set to "windows", LLVM generates a weird combination of NASM and GAS assembly. Try setting the target triple to something like "i386-mingw32". That should give you something you can assemble with GAS. Chip
Van Dijck, Tom
2010-Feb-14 04:38 UTC
[LLVMdev] Unable to compile .s files generated with llc.
thanks a lot.... that did it indeed. llc test.bc -mtriple=i386-mingw32 results in a very very different looking .s file.. Tom. ________________________________________ From: Charles Davis [cdavis at mymail.mines.edu] Sent: Saturday, February 13, 2010 8:28 PM To: Van Dijck, Tom Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Unable to compile .s files generated with llc. Van Dijck, Tom wrote:> Hey, > > I've been trying this for a couple days now, finding different assemblers and trying different options but I can't figure it out.. > I must be missing something very obvious. > > I got a simple "hello world" app in llvm, making the .bc file using 'llvm-as test.llvm -o=test.bc' works fine. > then I can use llvm-ld to make an executable which then runs fine (although not native), and I can use llc to build the .bc file into a .s file. > So far I'm all good... > > But neither masm, yasm, tasm, fasm, gcc, as, or nasm take the .s file. > > I only found one other post about this where it was mentioned that only 'GAS" can compile it, so I tried this in both Cygwin and Ubuntu, but to no avail. > In cygwin I get: > > $ gcc /cygdrive/d/test.s > /cygdrive/d/test.s: Assembler messages: > /cygdrive/d/test.s:4: Error: no such instruction: `align 16' > /cygdrive/d/test.s:6: Error: invalid character '@' in mnemonic > /cygdrive/d/test.s:7: Error: junk at end of line, first unrecognized character is `%' > /cygdrive/d/test.s:15: Error: invalid character '@' in mnemonic > /cygdrive/d/test.s:16: Error: no such instruction: `db "Hello, World!\000"' > > using 'as' I get the same error (I guess gcc just forwards to 'as'). > > I've tried specifying -x86-asm-syntax=intel, and the att option, neither work with any of the above mentioned assemblers... > I'm sort of completely lost now...This is a known problem. When the target OS is set to "windows", LLVM generates a weird combination of NASM and GAS assembly. Try setting the target triple to something like "i386-mingw32". That should give you something you can assemble with GAS. Chip
Anton Korobeynikov
2010-Feb-14 15:21 UTC
[LLVMdev] Unable to compile .s files generated with llc.
Hello, Everyone> This is a known problem. When the target OS is set to "windows", LLVM > generates a weird combination of NASM and GAS assembly.We're not doing such insane things anymore. AT&T MCAsmInfo is used for asmprinting everywhere on windows, since we don't have other usable asmprinter :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University