[LLVMdev] [patch] emit .weak for zero initialized weak variables

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Dec 18 13:14:12 PST 2006


> I'm not sure this is right.  C code like this:
>
> int X;
>
> should compile to a .comm directive, not a .weak directive, right?

right.

According to GCC, "int  x" should compile to ".comm   x", but "int x
__attribute__((weak))" should compile to
---------------
.weak   x
x:
        .zero   4
---------------

It looks like we have a bug in llvm-gcc, both C codes compile to
--------------------------
%x = weak global int 0
--------------------------

> -Chris

Best Regards,
Rafael



More information about the llvm-dev mailing list