[LLVMdev] Problem using march=c

Dmitry N. Mikushin maemarcus at gmail.com
Mon Mar 5 01:19:07 PST 2012


Hi Cristianno,

This problem has been around for a while, ourselves we solve it with the following patches:

https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.gpu.patch?root=kernelgen&view=markup

https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.patch?revision=591&root=kernelgen&view=markup

Please feel free to apply them, they *should* work for you even with the latest llvm 3.1. Also please feel free to ping me in case of any troubles.

- D.


----- Original message -----
> 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
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu                 http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120305/7ba3d7ce/attachment.html>


More information about the llvm-dev mailing list