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

herz alexander.herz at mytum.de
Tue Jan 26 06:31:03 PST 2010


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:

$ 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




More information about the llvm-dev mailing list