On Thu, Dec 22, 2016 at 05:47:05PM +0100, Christian Weisgerber wrote:
> Building ld.so with clang on amd64 fails with undefined references
> to memset and memcpy.  That is odd, since neither function appears
> in the source.  Apparently clang optimizes the _dl_memset and
> _dl_bcopy functions into calls to memset and memcpy, respectively.
> 
> I tentatively propose to add -fno-builtin to fix this.
> (Builds, runs, and passes regress with gcc on amd64 and i386.)

You are lucky if it fixes the problem, infact, -fno-builtin has quite a
chance to make the problem worse. Clang assumes the same set of basic
functions to be present even for -ffreestanding environments and can
lower e.g. initialisation of local variables to memset/memcpy.

Joerg

Reply via email to