freebsd-src/lib/libsys/Makefile
Brooks Davis 1235d276b7 lib{c,sys}: stop exposing errno symbol
Officially since C11 (and in reality FreeBSD since 3.0 with commit
1b46cb523d) errno has been defined to be a macro.  Rename the symbol
to __libsys_errno and move it to FBSDprivate_1.0 and confine it entierly
to libsys for use by libthr.  Add a FBSD_1.0 compat symbol for existing
binaries that were incorrectly linked to the errno symbol during
libc.so.7's lifetime.

This deliberately breaks linking software that directly links to errno.
Such software is broken and will fail in surprising ways if it becomes
threaded (e.g., if it triggers loading of a pam or nss module that
uses threads.)

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46780
2024-09-27 20:27:46 +01:00

81 lines
1.8 KiB
Makefile

PACKAGE= clibs
SHLIBDIR?= /lib
.include <src.opts.mk>
LIBC_SRCTOP?= ${.CURDIR}/../libc
LIBSYS_SRCTOP?= ${.CURDIR}
# Pick the current architecture directory for libsys. In general, this is named
# MACHINE_CPUARCH, but some ABIs are different enough to require their own
# libsys, so allow a directory named MACHINE_ARCH to override this (though
# treat powerpc64le and powerpc64 the same).
# Note: This is copied from libc/Makefile
M=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
.if exists(${LIBC_SRCTOP}/${M})
LIBC_ARCH=${M}
.else
LIBC_ARCH=${MACHINE_CPUARCH}
.endif
LIB=sys
SHLIB_MAJOR= 7
WARNS?= 2
MK_SSP= no
INCS= libsys.h _libsys.h
CFLAGS+=-DLIBSYS
CFLAGS+=-I${LIBSYS_SRCTOP}/include -I${LIBC_SRCTOP}/include
CFLAGS+=-I${LIBSYS_SRCTOP}/${LIBC_ARCH}
CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
.PATH: ${LIBC_SRCTOP}/string
SRCS+= memcpy.c memset.c strlcpy.c
CLEANFILES+=tags
INSTALL_PIC_ARCHIVE=
#XXX? BUILD_NOSSP_PIC_ARCHIVE=
PRECIOUSLIB=
# Use a more efficient TLS model for libc since we can reasonably assume that
# it will be loaded during program startup.
CFLAGS+= -ftls-model=initial-exec
#
# Link with static libcompiler_rt.a.
#
LDFLAGS+= -nodefaultlibs
LDFLAGS+= -Wl,-Bsymbolic
LIBADD+= compiler_rt
.if ${MK_SSP} != "no" && \
(${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
LIBADD+= ssp_nonshared
.endif
# Define (empty) variables so that make doesn't give substitution
# errors if the included makefiles don't change these:
MDASM=
MIASM=
NOASM=
SYM_MAPS+= ${LIBSYS_SRCTOP}/Symbol.map
SRCS+= auxv.c \
interposing_table.c
.include "${LIBSYS_SRCTOP}/Makefile.sys"
SYM_MAPS+= ${LIBSYS_SRCTOP}/Symbol.thr.map
.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}
.sinclude "${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/Makefile.thr"
.if !${SRCS:M_umtx_op_err.S}
SRCS+=_umtx_op_err.c
.endif
VERSION_DEF=${LIBC_SRCTOP}/Versions.def
SYMBOL_MAPS=${SYM_MAPS}
.include <bsd.lib.mk>