View Single Post
Old 04 July 2015, 11:09   #117
SainT
Registered User

 
Join Date: Jul 2015
Location: UK
Posts: 10
Quote:
Originally Posted by nogginthenog View Post
Have you seen this:
https://github.com/kwaters/llvm-m68k

I compiled it and it does work (Debian Linux). But any C function call fails...

test.c
Code:
typedef unsigned int uint32_t;
typedef char int8_t;

uint32_t foo(uint32_t x, int8_t y)
{
    return (x | (1 << 17)) + y;
}
clang -emit-llvm test.c -c -O2 -o test.ll
./llvm-m68k/build/bin/llc -march=m68k test.ll

test.s
Code:
        SEG     'main'
; GLOBAL foo
foo     PROC                            ; @foo
; BB#0:
        move.l  #131072, d1
        or.l    (a6), d1
        move.b  4(a6), d0
        ext.w   d0
        ext.l   d0
        add.l   d1, d0
        rts

        END
Is there any specific configuration setup you used to compile llvm here? I've built with m68k target, but I'm getting a crash even with this simple example. I'm not sure if its triple related, as I just left the default triple as it was.

I should get more time to look into this tonight I hope, so any pointers would be appreciated, otherwise I'll just poke things until it works...
SainT is offline  
 
Page generated in 0.04806 seconds with 9 queries