Re: undefined reference to `memset'
From: Bruce Evans (bde_at_zeta.org.au)
Date: 03/25/05
- Previous message: Graham Menhennitt: ""ffs_mountroot: can't find rootvp" after cvsup and making worldfmen"
- In reply to: Nick Barnes: "Re: undefined reference to `memset'"
- Next in thread: Vinod Kashyap: "RE: undefined reference to `memset'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Mar 2005 13:28:13 +1100 (EST) To: Nick Barnes <Nick.Barnes@pobox.com>
On Thu, 24 Mar 2005, Nick Barnes wrote:
> At 2005-03-24 08:31:14+0000, Bruce Evans writes:
>
>> what is gcc to do when -fno-builtin tells it to turn off its
>> builtins and -ffreestanding tells it that the relevant interfaces
>> might not exist in the library?
>
> Plainly, GCC should generate code which fills the array with zeroes.
> It's not obliged to generate code which calls memset (either builtin
> or in a library). If it knows that it can do so, then fine.
> Otherwise it must do it the Old Fashioned Way. So this is surely a
> bug in GCC.
>
> Nick B, who used to write compilers for a living
But the compiler can require the Old Fashioned Way to be in the library.
libgcc.a is probably part of gcc even in the freestanding case. The
current implementation of libgcc.a won't all work in the freestanding
case, since parts of it call stdio, but some parts of it are needed
and work (e.g., __divdi3() on i386's at least). The kernel doesn't
use libgcc.a, but it knows that __divdi3() and friends are needed and
implements them in its libkern. Strictly, it should do something
similar for memset().
I think the only bugs in gcc here are that the function it calls is
in the application namespace in the freestanding case, and that the
requirements for freestanding implementations are not all documented.
The requirement for memset() and friends _is_ documented (in gcc.info),
but the requirement for __divdi3() and friends are only documented
indirectly by the presence of these functions in libgcc.a.
Bruce
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"
- Previous message: Graham Menhennitt: ""ffs_mountroot: can't find rootvp" after cvsup and making worldfmen"
- In reply to: Nick Barnes: "Re: undefined reference to `memset'"
- Next in thread: Vinod Kashyap: "RE: undefined reference to `memset'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|