Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Mar 2005 14:37:19 -0800
From:      "Vinod Kashyap" <vkashyap@amcc.com>
To:        obrien@freebsd.org
Cc:        freebsd-amd64@freebsd.org
Subject:   RE: undefined reference to `memset'
Message-ID:  <IDXIVU00.7WB@hadar.amcc.com>

next in thread | raw e-mail | index | archive | help

This is a multi-part message in MIME format

---------64c2860764c28607
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

> > Can you not submit it with the patch I sent?
> =

> Submit the entire /usr/src/sys kernel source??
> =

> > A "stand alone" foo.c will have to be a new module under a new
> > directory (/sys/dev/foo), with its own Makefile, with changes to
> > /sys/conf/files, and an entry in GENERIC.
> =

> A module would still depend on files in /usr/share/mk, =

> /usr/src/sys/conf,
> /usr/src/sys/modules, /usr/src/sys/dev/foo.
> =

> NO! nothing other than a single file -- foo.c in my home =

> directory that
> shows the problem is a "stand alone" example.

Here is memset_issue.c (also attached).  But note that you cannot
reproduce the "undefined reference to `memset'" issue with this
(that's what I have been trying to explain).  You could also use
the earlier posting from Sean McNeil.

#include <stdio.h>

main()
{
	char a[100] =3D {0};
	char *ap;

	ap =3D &(a[0]);
	printf("a[0] =3D %d\n", a[0]);
}


With the patch that I sent earlier applied to /sys/dev/twa/twa.c,
'nm twa.o' shows this when twa is built as a stand alone module:
00000000000003f0 t memset

'nm twa.o' shows this when twa is built as part of the kernel:
                 U memset


And now, moving to the important thing... in kern.pre.mk, I changed
COPTFLAGS from -O2 to -O for amd64 (just like i386), and the problem
is gone!!

---------64c2860764c28607
Content-Type: text/plain; name="memset_issue.c"
Content-Disposition: attachment; filename="memset_issue.c"
Content-Transfer-Encoding: quoted-printable

#include <stdio.h>

main()
{
	char a[100] =3D {0};
	char *ap;

	ap =3D &(a[0]);
	printf("a[0] =3D %d\n", a[0]);
}

---------64c2860764c28607--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?IDXIVU00.7WB>