Rafael EspĂndola
2006-Dec-09 21:12 UTC
[LLVMdev] [patch] emit .weak for zero initialized weak variables
The attached patches makes all backends print a .weak directive for zero initialized variables. GCC does it on x86-64 and ARM. I assume that it should be done on all architectures. The patch also adds a test to the ARM backend? Should I copy it to all backends? Comments? Thanks, Rafael P.S.: I find the doFinalization code a bit confusing. Would you welcome a cleanup patch? -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm.patch Type: text/x-patch Size: 6093 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20061209/ba93956f/attachment.bin>
Chris Lattner
2006-Dec-16 21:59 UTC
[LLVMdev] [patch] emit .weak for zero initialized weak variables
On Sat, 9 Dec 2006, [UTF-8] Rafael Esp?ndola wrote:> The attached patches makes all backends print a .weak directive for > zero initialized variables. GCC does it on x86-64 and ARM. I assume > that it should be done on all architectures. > > The patch also adds a test to the ARM backend? Should I copy it to all > backends?I'm not sure this is right. C code like this: int X; should compile to a .comm directive, not a .weak directive, right? -Chris -- http://nondot.org/sabre/ http://llvm.org/
Rafael EspĂndola
2006-Dec-18 21:14 UTC
[LLVMdev] [patch] emit .weak for zero initialized weak variables
> 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 --------------------------> -ChrisBest Regards, Rafael
Possibly Parallel Threads
- [LLVMdev] [patch] emit .weak for zero initialized weak variables
- [LLVMdev] [patch] emit .weak for zero initialized weak variables
- [LLVMdev] [patch] emit .weak for zero initialized weak variables
- [LLVMdev] [PATCH] print .weak directives
- [LLVMdev] [PATCH] print .weak directives