summaryrefslogtreecommitdiffstats
path: root/lib/libc/arm
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2013-02-12 06:04:51 +0000
committerandrew <andrew@FreeBSD.org>2013-02-12 06:04:51 +0000
commit3303d1f6a9146828c38be38486f035a2fdc8e010 (patch)
treedf594d7cdaf51f638f035a4233daf58efc3dac72 /lib/libc/arm
parent180d9ee4c70608454a9b8c6831ce1949c3e27bc7 (diff)
downloadFreeBSD-src-3303d1f6a9146828c38be38486f035a2fdc8e010.zip
FreeBSD-src-3303d1f6a9146828c38be38486f035a2fdc8e010.tar.gz
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.
Diffstat (limited to 'lib/libc/arm')
-rw-r--r--lib/libc/arm/aeabi/Makefile.inc19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libc/arm/aeabi/Makefile.inc b/lib/libc/arm/aeabi/Makefile.inc
index ac147c0..379eb23 100644
--- a/lib/libc/arm/aeabi/Makefile.inc
+++ b/lib/libc/arm/aeabi/Makefile.inc
@@ -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
OpenPOWER on IntegriCloud