Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2005 18:22:00 -0500
From:      Jung-uk Kim <jkim@niksun.com>
To:        freebsd-amd64@freebsd.org
Subject:   Re: undefined reference to `memset'
Message-ID:  <200503241822.00480.jkim@niksun.com>
In-Reply-To: <1111702231.2655.6.camel@server.mcneil.com>
References:  <IDVJ3H01.CW0@hadar.amcc.com> <20050324214956.GA99087@dragon.NUXI.org> <1111702231.2655.6.camel@server.mcneil.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 24 March 2005 05:10 pm, Sean McNeil wrote:
> On Thu, 2005-03-24 at 13:49 -0800, David O'Brien wrote:
> > Please don't top-post -- it destroys context.  [Format recovered]
> >
> > On Thu, Mar 24, 2005 at 12:46:41PM -0800, Vinod Kashyap wrote:
> > > > On Thu, Mar 24, 2005 at 06:05:17PM +1100, Peter Jeremy wrote:
> > > > > On Wed, 2005-Mar-23 13:48:04 -0800, Vinod Kashyap wrote:
> > > > > >If any kernel module has the following, or a similar line
> > > > > > in it: -----
> > > > > >char x[100] = {0};
> > > > > >-----
> > > > > >building of the GENERIC kernel on FreeBSD 5 -STABLE for
> > > > > > amd64 as of 03/19/05, fails with the following message at
> > > > > > the
> > > >
> > > > time of linking:
> > > > > >"undefined reference to `memset'".
> > > > > >
> > > > > >The same problem is not seen on i386.
> > > > > >
> > > > > >The problem goes away if the above line is changed to:
> > > > > >-----
> > > > > >char x[100];
> > > > > >memset(x, 0, 100);
> > > > > >-----
> > > > >
> > > > > Can you post a complete (compilable) example please.
> > > >
> > > > Vinod can you please post a complete compilable example?
> > > > It is impossible to get anything done about your issue
> > > > without stand alone test code.
> > >
> > > Ok, make sure you have 'device twa' in your kernel
> > > configuration file, and apply these patches to
> > > /sys/dev/twa/twa.c.
> > > This patch causes the problem:
> >
> > "stand alone" means a single foo.c file that shows the problem
> > you want fixed.
> > I cannot submit a GCC bug report with a tarball of the entire
> > FreeBSD kernel.
>
> I've taken the liberty to write up an example here.  Not sure if
> this is a bug or not:
>
> cc -O -pipe -c -fno-builtin -ffreestanding memset_bug.c
>
> Take a look at what is generated:
>
> objdump --disassemble memset_bug.o
>
> You'll see that instead of performing the inline code generation
> for memset, the compiler generates a call to memset in the case of
> the assignment of {0}.

Have you tried -minline-all-stringops/-mno-inline-all-stringops?

Jung-uk Kim



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