[cfe-dev] FreeBSD kernel - linking

Chris Lattner clattner at apple.com
Thu Feb 12 12:55:24 PST 2009


On Feb 12, 2009, at 12:35 PM, Roman Divacky wrote:

> On Thu, Feb 12, 2009 at 11:23:16AM -0800, Mike Stump wrote:
>> On Feb 12, 2009, at 10:53 AM, Chris Lattner wrote:
>>> that won't help, clang generates these for structure copies.
>>
>> There are only a couple of options.  One, clang is documented to
>> require memmove, and we require the kernel to have one.  Two, clang  
>> is
>> documented as not requiring it, and we generate inline code, or calls
>> to a runtime library that is linked against.  Three, we generate  
>> calls
>> to a clang internal routine, and emit it linkonce (comdat) in every
>> translation unit that references it.  Now, the canonical solution  
>> _is_
>> -fno-builtin-memmove, if implemented, it would do something
>> indistinguishable from the last.  Why do you say it won't help?

GCC probably "happens to work" because it optimizes out the memmoves  
in cases that clang isn't yet.  It is definitely unportable to assume  
that the compiler won't emit those.
>
> all I want from clang is to state the position. I have a preliminary
> ok to introduce memmove() to freebsd kernel
>
> I just need to know the official position.

The best thing to do is add memmove to the kernel.  We can treat each  
individual memmove that still exists as a "missed optimization" though.

-Chris



More information about the cfe-dev mailing list