Re: linux/mm.h breaks memset()

Erik Troan (ewt@redhat.com)
Thu, 19 Oct 1995 10:13:24 -0400 (EDT)


On Wed, 18 Oct 1995, David S. Miller wrote:

> Does turning on '-O2' make the problem go away? Gcc looks like it
> isn't inlining the functions the linker is complaining about, and the
> gcc docs explicitly state that inlining isn't guarenteed to occur with
> optimizations off.

If doesn't fix this. Here's the output from some various cases:

bash# gcc -o m m.c
/tmp/cca050781.o: In function `main':
m.c:0: undefined reference to `__constant_c_memset'
m.c:0: undefined reference to `__memset'
/tmp/cca050781.o(.lita+0x8): undefined reference to `__constant_c_memset'
/tmp/cca050781.o(.lita+0x10): undefined reference to `__memset'

bash# gcc -O -o m m.c
/tmp/cca050881.o: In function `main':
m.c:0: undefined reference to `__constant_c_memset'
/tmp/cca050881.o(.lita+0x8): undefined reference to `__constant_c_memset'

bash# gcc -O2 -o m m.c
/tmp/cca050831.o: In function `main':
m.c:0: undefined reference to `__constant_c_memset'
/tmp/cca050831.o(.lita+0x8): undefined reference to `__constant_c_memset'

So, having some optimizations done helps, but more opts don't change anything.
Any other ideas?

In case someone missed it, here is the offending code:

#include <linux/mm.h>

main () {
int a;

memset(&a, sizeof(a), 0);
}

Thanks!

Erik

-------------------------------------------------------------------------------
"Eggheads unite! You have nothing to lose but your yolks" - Adlai Stevenson

Erik Troan = http://sunsite.unc.edu/ewt/ = ewt@sunsite.unc.edu