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?
llvm.patch (5.95 KB)
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
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
Is there a semantic difference between the two? Just because GCC compiles them to different things, it doesn't mean they do different things...
-Chris
Is there a semantic difference between the two? Just because GCC compiles
them to different things, it doesn't mean they do different things...
Sorry for the long delay...
On a x86 box I am able to use both declarations interchangeably. There
is a problem if we have both a declaration and an use on the same
file: We must print a ".weak" because of the use, but if we printed a
".comm" for the declaration, the assembler will reject the file:
Error: symbol `a' can not be both weak and common
Best Regards,
Rafael
Error: symbol `a' can not be both weak and common
Actually this error happens only with an old version of my patch that
prints ".weak" for both weak and extern_weak symbols (similar to gcc).
Sorry for the confusion.
Rafael