<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="generator" content="Osso Notes">
    <title></title></head>
<body>
<p>Hi Cristianno,
<br>
<br>This problem has been around for a while, ourselves we solve it with the following patches:
<br>
<br><a href="https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.gpu.patch?root=kernelgen&view=markup">https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.gpu.patch?root=kernelgen&view=markup</a>
<br>
<br><a href="https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.patch?revision=591&root=kernelgen&view=markup">https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.patch?revision=591&root=kernelgen&view=markup</a>
<br>
<br>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.
<br>
<br>- D.
<br>
<br>
<br>----- Original message -----
<br>> Hello everyone,
<br>> 
<br>> I've been trying to generate a C file using the llc tool, but I'm
<br>> having a problem. I'm using a single Hello World program in C, and
<br>> executing the following passes:
<br>> 
<br>> clang -emit-llvm -c -o hello.bc hello.c    # getting the bit code of
<br>> hello.c llc -march=c hello.bc                          # generating the
<br>> hello.cbe.c file using the llvm C backend
<br>> 
<br>> So far, nothing weird happened. The problem occurs once I try to
<br>> compile the hello.cbe.c: gcc, and even clang, show me some warning and
<br>> error messages.
<br>> Cheking in hello.cbe.c, I could see that the problem was related with
<br>> the structs declarations and initialization. There, they appears to be
<br>> something like
<br>> 
<br>>                 /* Global Variable Declarations */
<br>>                 static _OC_str { unsigned char array[13]; };
<br>> 
<br>>                 /* Global Variable Definitions and Initialization */
<br>>                 static _OC_str { unsigned char array[13]; } = { "Hello World\n"
<br>> };
<br>> 
<br>> when they should be like
<br>> 
<br>>                 /* Global Variable Declarations */
<br>>                 static struct type_OC_str { unsigned char array[13]; };
<br>> 
<br>>                 /* Global Variable Definitions and Initialization */
<br>>                 static struct type_OC_str _OC_str = { "Hello World\n" };
<br>> 
<br>> It is a known problem, or am I doing something wrong?
<br>> 
<br>> Thks in advance,
<br>> 
<br>> --
<br>> Cristianno Martins
<br>> PhD Student of Computer Science
<br>> University of Campinas
<br>> <a href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a>
<br>> 
<br>> _______________________________________________
<br>> LLVM Developers mailing list
<br>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>                 <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<br>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
<br><br></p>
</body>
</html>