Search Linux Wireless

Re: COMMON symbol warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 10, 2007 at 01:08:12PM +0200, Johannes Berg wrote:
> On Sat, 2007-09-08 at 14:01 +0100, Christoph Hellwig wrote:
> 
> > Yes.  It means a variable is declared in multiple places and the linker
> > merges it for you.  The fix is to make sure these are declared extern in
> > all places but one.
> 
> Interesting. So it's missing in a header file but sparse doesn't warn
> about it like it does with functions that aren't declared nor static?

No.  Say you have the following case:

----------- foo.h ------------
int foo;
----------- foo1.c -----------
#include "foo.h"
----------- foo2.c -----------
#include "foo.h"
--------- Makefile -----------
obj-m += foo.o
foo-y += foo1.o foo2.o


This gives you a foo COMMON symbol.  But at least on i386 the kernel
is compiled with -fno-common so you get a warning like:

/home/hch/test/foo1.o:(.bss+0x0): multiple definition of `foo'
/home/hch/test/foo2.o:(.bss+0x0): first defined here

When adding -fcommon to EXTRA_FLAGS I get what you saw in this thread:

WARNING: "foo" [/home/hch/test/foo] is COMMON symbol

I wonder how the driver build managed to override our global -fno-common
setting.
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux