[LLVMdev] llc generated assembly does not work with gcc 3.4.4

Chris Lattner clattner at apple.com
Tue Jan 26 10:59:14 PST 2010


On Jan 26, 2010, at 6:31 AM, herz wrote:

> Hi,
>
> I've generated a .bc file for a simple program using the clang front
> end, the human readable output of llvm-dis looks good.
> Running llc on the bc file generates an assembly file (.s using either
> att or intel syntax).
> Now, when I try to generate an executable with gcc (3.4.4 cygwin) I  
> get
> lot's of errors:

What commands are you passing to llc?  Also, please attach the .ll  
file you're using.

-Chris

>
> $ gcc t.S
> t.S: Assembler messages:
> t.S:4: Error: no such instruction: `align 16'
> t.S:6: Error: invalid character '@' in mnemonic
> t.S:7: Error: no such instruction: `bb'
> t.S:20: Error: invalid character '@' in mnemonic
> t.S:22: Error: no such instruction: `db "hello world\n\000"'
>
> here is the assembly file (t.s):
>
>    .text
>    ALIGN    16
>    .globl    _main
> _main:                                                      ; @main
> ; BB#0:                                                     ; %entry
>    subl    $20, %esp
>    movl    24(%esp), %eax
>    movl    $0, 16(%esp)
>    movl    $($_.str), (%esp)
>    movl    %eax, 12(%esp)
>    movl    28(%esp), %eax
>    movl    %eax, 8(%esp)
>    call    _printf
>    movl    16(%esp), %eax
>    addl    $20, %esp
>    ret
>    .data
>                                                            ; @.str
> $_.str:
>    db    "hello world\n\000"
>
> Aparently, gcc doesn't recognize ; as comments nor can it handle the  
> db
> directive.
> How can I generate assembly that is accepted by gcc ??
>
> Thx!
>
> Alex
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list