[LLVMdev] Problem using march=c

Cristianno Martins cristiannomartins at gmail.com
Sun Mar 4 21:37:59 PST 2012


Hello everyone,

I've been trying to generate a C file using the llc tool, but I'm
having a problem. I'm using a single Hello World program in C, and
executing the following passes:

clang -emit-llvm -c -o hello.bc hello.c   # getting the bit code of hello.c
llc -march=c hello.bc                          # generating the
hello.cbe.c file using the llvm C backend

So far, nothing weird happened. The problem occurs once I try to
compile the hello.cbe.c: gcc, and even clang, show me some warning and
error messages.
Cheking in hello.cbe.c, I could see that the problem was related with
the structs declarations and initialization. There, they appears to be
something like

        /* Global Variable Declarations */
        static _OC_str { unsigned char array[13]; };

        /* Global Variable Definitions and Initialization */
        static _OC_str { unsigned char array[13]; } = { "Hello World\n" };

when they should be like

        /* Global Variable Declarations */
        static struct type_OC_str { unsigned char array[13]; };

        /* Global Variable Definitions and Initialization */
        static struct type_OC_str _OC_str = { "Hello World\n" };

It is a known problem, or am I doing something wrong?

Thks in advance,

--
Cristianno Martins
PhD Student of Computer Science
University of Campinas
cmartins at ic.unicamp.br




More information about the llvm-dev mailing list