[LLVMdev] Unable to compile .s files generated with llc.

250 views
Skip to first unread message

Van Dijck, Tom

unread,
Feb 13, 2010, 11:10:49 PM2/13/10
to llv...@cs.uiuc.edu
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.
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Charles Davis

unread,
Feb 13, 2010, 11:28:14 PM2/13/10
to Van Dijck, Tom, llv...@cs.uiuc.edu
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

unread,
Feb 13, 2010, 11:38:49 PM2/13/10
to Charles Davis, llv...@cs.uiuc.edu
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 [cda...@mymail.mines.edu]
Sent: Saturday, February 13, 2010 8:28 PM
To: Van Dijck, Tom
Cc: llv...@cs.uiuc.edu
Subject: Re: [LLVMdev] Unable to compile .s files generated with llc.

Anton Korobeynikov

unread,
Feb 14, 2010, 10:21:01 AM2/14/10
to Charles Davis, llv...@cs.uiuc.edu
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

Reply all
Reply to author
Forward
0 new messages