aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/Makefile')
-rw-r--r--lib/libc/Makefile50
1 files changed, 23 insertions, 27 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 3667eea15307..674986a7e065 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -1,22 +1,20 @@
-# @(#)Makefile 8.2 (Berkeley) 2/3/94
-# $FreeBSD$
PACKAGE= clibs
SHLIBDIR?= /lib
.include <src.opts.mk>
-# Force building of libc_pic.a
-MK_TOOLCHAIN= yes
-
LIBC_SRCTOP?= ${.CURDIR}
-
-# Pick the current architecture directory for libc. In general, this is
-# named MACHINE_CPUARCH, but some ABIs are different enough to require
-# their own libc, so allow a directory named MACHINE_ARCH to override this.
-
-.if exists(${LIBC_SRCTOP}/${MACHINE_ARCH:S/powerpc64le/powerpc64/})
-LIBC_ARCH=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
+LIBSYS_SRCTOP?= ${.CURDIR:H}/libsys
+
+# Pick the current architecture directory for libc. In general, this is named
+# MACHINE_CPUARCH, but some ABIs are different enough to require their own libc,
+# so allow a directory named MACHINE_ARCH to override this (though treat
+# powerpc64le and powerpc64 the same).
+# Note: This is copied to msun/Makefile
+M=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
+.if exists(${LIBC_SRCTOP}/${M})
+LIBC_ARCH=${M}
.else
LIBC_ARCH=${MACHINE_CPUARCH}
.endif
@@ -41,6 +39,7 @@ SHLIB_LDSCRIPT_LINKS=libxnet.so
WARNS?= 2
CFLAGS+=-I${LIBC_SRCTOP}/include -I${SRCTOP}/include
CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
+CFLAGS+=-I${LIBSYS_SRCTOP}/${LIBC_ARCH}
.if ${MK_NLS} != "no"
CFLAGS+=-DNLS
.endif
@@ -56,17 +55,21 @@ CFLAGS+=${CANCELPOINTS_CFLAGS}
# Use a more efficient TLS model for libc since we can reasonably assume that
# it will be loaded during program startup.
-.if ${LIBC_ARCH} == "aarch64" || ${LIBC_ARCH} == "amd64" || \
- ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "riscv" || \
- ${LIBC_ARCH:Mpowerpc*} != ""
CFLAGS+= -ftls-model=initial-exec
-.endif
#
# Link with static libcompiler_rt.a.
#
LDFLAGS+= -nodefaultlibs
LIBADD+= compiler_rt
+LIBADD+= sys
+.if defined(COMPAT_libcompat)
+# XXX: work around gcc -m32 + bfd ld path issue for DT_NEEDED symbols.
+# https://sourceware.org/bugzilla/show_bug.cgi?id=31395
+LDFLAGS+= -Wl,--rpath=/usr/lib${COMPAT_libcompat}
+.endif
+
+LDFLAGS+=-Wl,--auxiliary,libsys.so.7
.if ${MK_SSP} != "no" && \
(${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
@@ -93,6 +96,7 @@ MIASM=
NOASM=
.include "${LIBC_SRCTOP}/${LIBC_ARCH}/Makefile.inc"
+.include "${LIBC_SRCTOP}/csu/Makefile.inc"
.include "${LIBC_SRCTOP}/db/Makefile.inc"
.include "${LIBC_SRCTOP}/compat-43/Makefile.inc"
.include "${LIBC_SRCTOP}/gdtoa/Makefile.inc"
@@ -109,17 +113,13 @@ NOASM=
.include "${LIBC_SRCTOP}/net/Makefile.inc"
.include "${LIBC_SRCTOP}/nls/Makefile.inc"
.include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
-.if ${LIBC_ARCH} != "aarch64" && \
- ${LIBC_ARCH} != "amd64" && \
- ${LIBC_ARCH} != "powerpc64" && \
- ${LIBC_ARCH} != "riscv"
+.if ${MACHINE_ABI:Mlong32}
.include "${LIBC_SRCTOP}/quad/Makefile.inc"
.endif
.include "${LIBC_SRCTOP}/regex/Makefile.inc"
.include "${LIBC_SRCTOP}/resolv/Makefile.inc"
.include "${LIBC_SRCTOP}/stdio/Makefile.inc"
.include "${LIBC_SRCTOP}/stdlib/Makefile.inc"
-.include "${LIBC_SRCTOP}/stdlib/jemalloc/Makefile.inc"
.include "${LIBC_SRCTOP}/stdtime/Makefile.inc"
.include "${LIBC_SRCTOP}/string/Makefile.inc"
.include "${LIBC_SRCTOP}/sys/Makefile.inc"
@@ -127,13 +127,10 @@ NOASM=
.include "${LIBC_SRCTOP}/rpc/Makefile.inc"
.include "${LIBC_SRCTOP}/uuid/Makefile.inc"
.include "${LIBC_SRCTOP}/xdr/Makefile.inc"
-.if (${LIBC_ARCH} == "arm" && \
- (${MACHINE_ARCH:Marmv[67]*} == "" || (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))) || \
- (${LIBC_ARCH} == "riscv" && ${MACHINE_ARCH:Mriscv*sf} != "")
+.if (${LIBC_ARCH} == "arm" && (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))
.include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
.endif
.if ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "amd64"
-.include "${LIBC_SRCTOP}/x86/sys/Makefile.inc"
.include "${LIBC_SRCTOP}/x86/gen/Makefile.inc"
.endif
.if ${MK_NIS} != "no"
@@ -158,11 +155,10 @@ STATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/}
VERSION_DEF=${LIBC_SRCTOP}/Versions.def
SYMBOL_MAPS=${SYM_MAPS}
-CFLAGS+= -DSYMBOL_VERSIONING
# If there are no machine dependent sources, append all the
# machine-independent sources:
-.if empty(MDSRCS)
+.if empty(MDSRCS) || ${MK_MACHDEP_OPTIMIZATIONS} == no
SRCS+= ${MISRCS}
.else
# Append machine-dependent sources, then append machine-independent sources