Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Feb 2013 06:04:51 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246706 - head/lib/libc/arm/aeabi
Message-ID:  <201302120604.r1C64pEW008741@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Tue Feb 12 06:04:51 2013
New Revision: 246706
URL: http://svnweb.freebsd.org/changeset/base/246706

Log:
  When clang builds libc it may insert calls to __aeabi_* functions. Normally
  this is not a problem as they are resolved by libgcc. The exception is for
  the __aeabi_mem* functions. These call back into libc to the appropriate
  function. This causes issues for static binaries as we only link against
  libc once so there is no way for it to call into libgcc and back.
  
  The fix for this is to include these symbols in libc but keep them hidden
  so binaries use the libgcc version.

Modified:
  head/lib/libc/arm/aeabi/Makefile.inc

Modified: head/lib/libc/arm/aeabi/Makefile.inc
==============================================================================
--- head/lib/libc/arm/aeabi/Makefile.inc	Tue Feb 12 05:56:00 2013	(r246705)
+++ head/lib/libc/arm/aeabi/Makefile.inc	Tue Feb 12 06:04:51 2013	(r246706)
@@ -7,5 +7,24 @@ SRCS+=	aeabi_atexit.c		\
 	aeabi_float.c		\
 	aeabi_unwind_cpp.c
 
+# Add the aeabi_mem* functions. While they live in compiler-rt they call into
+# libc. This causes issues when other parts of libc call these functions.
+# We work around this by including these functions in libc but mark them as
+# hidden so users of libc will not pick up these versions.
+.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm
+
+SRCS+=	aeabi_memcmp.S		\
+	aeabi_memcpy.S		\
+	aeabi_memmove.S		\
+	aeabi_memset.S
+
+# Mark the functions as hidden so they are not available outside of libc.
+CFLAGS.aeabi_memcmp.S=	-DVISIBILITY_HIDDEN
+CFLAGS.aeabi_memcpy.S=	-DVISIBILITY_HIDDEN
+CFLAGS.aeabi_memmove.S=	-DVISIBILITY_HIDDEN
+CFLAGS.aeabi_memset.S=	-DVISIBILITY_HIDDEN
+CFLAGS+=		${CFLAGS.${.IMPSRC:T}}
+
+
 SYM_MAPS+=${.CURDIR}/arm/aeabi/Symbol.map
 



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