diff options
Diffstat (limited to 'lib/libc/Makefile')
-rw-r--r-- | lib/libc/Makefile | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile index a26215324332..8705568f6d34 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -1,22 +1,25 @@ -# @(#)Makefile 8.2 (Berkeley) 2/3/94 - PACKAGE= clibs SHLIBDIR?= /lib .include <src.opts.mk> 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 +CFLAGS+=-D_FORTIFY_SOURCE_read=_read + # All library objects contain FreeBSD revision strings by default; they may be # excluded as a space-saving measure. To produce a library that does # not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS @@ -37,6 +40,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 @@ -52,17 +56,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*} != "") @@ -101,7 +109,6 @@ NOASM= .include "${LIBC_SRCTOP}/inet/Makefile.inc" .include "${LIBC_SRCTOP}/isc/Makefile.inc" .include "${LIBC_SRCTOP}/locale/Makefile.inc" -.include "${LIBC_SRCTOP}/md/Makefile.inc" .include "${LIBC_SRCTOP}/nameser/Makefile.inc" .include "${LIBC_SRCTOP}/net/Makefile.inc" .include "${LIBC_SRCTOP}/nls/Makefile.inc" @@ -124,7 +131,6 @@ NOASM= .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" @@ -149,7 +155,6 @@ 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: @@ -214,6 +219,6 @@ GENDIRDEPS_FILTER+= N${RELDIR:H}/msun # Disable warnings in contributed sources. CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/} # Disable stack protection for SSP symbols. -SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/} +SSP_CFLAGS:= ${.IMPSRC:N*/libc_stack_protector.c:C/^.+$/${SSP_CFLAGS}/} # Generate stack unwinding tables for cancellation points CANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//} |