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.)
Index: Makefile
===================================================================
RCS file: /cvs/src/libexec/ld.so/Makefile,v
retrieving revision 1.62
diff -u -p -r1.62 Makefile
--- Makefile 4 Jul 2016 21:15:06 -0000 1.62
+++ Makefile 22 Dec 2016 16:27:33 -0000
@@ -31,6 +31,7 @@ SRCS+= library.c
.PATH: ${.CURDIR}/${MACHINE_CPU}
DEBUG?= -g
+CFLAGS += -fno-builtin
CFLAGS += -Wall -Werror
CFLAGS += -I${.CURDIR} -I${.CURDIR}/${MACHINE_CPU} \
-D'DEF_WEAK(x)=asm("")' -D'DEF_STRONG(x)=asm("")' \
--
Christian "naddy" Weisgerber [email protected]