1994-05-27 05:00:24 +00:00
|
|
|
# @(#)Makefile 8.2 (Berkeley) 2/3/94
|
1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
2006-03-17 18:54:44 +00:00
|
|
|
|
2016-02-05 21:01:08 +00:00
|
|
|
PACKAGE= clibs
|
2015-06-15 19:28:07 +00:00
|
|
|
SHLIBDIR?= /lib
|
2006-03-18 11:01:06 +00:00
|
|
|
|
2014-05-06 04:22:01 +00:00
|
|
|
.include <src.opts.mk>
|
2006-03-17 18:54:44 +00:00
|
|
|
|
2016-03-31 17:27:01 +00:00
|
|
|
# Force building of libc_pic.a
|
|
|
|
MK_TOOLCHAIN= yes
|
|
|
|
|
2014-03-04 02:19:39 +00:00
|
|
|
LIBC_SRCTOP?= ${.CURDIR}
|
|
|
|
|
2010-08-25 20:48:24 +00:00
|
|
|
# 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.
|
|
|
|
|
2020-09-23 00:21:51 +00:00
|
|
|
.if exists(${LIBC_SRCTOP}/${MACHINE_ARCH:S/powerpc64le/powerpc64/})
|
|
|
|
LIBC_ARCH=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
|
2010-08-24 20:54:43 +00:00
|
|
|
.else
|
2010-08-24 21:28:34 +00:00
|
|
|
LIBC_ARCH=${MACHINE_CPUARCH}
|
2010-08-24 20:54:43 +00:00
|
|
|
.endif
|
|
|
|
|
2002-03-23 20:08:00 +00:00
|
|
|
# All library objects contain FreeBSD revision strings by default; they may be
|
1994-05-27 05:00:24 +00:00
|
|
|
# excluded as a space-saving measure. To produce a library that does
|
2002-03-26 23:08:42 +00:00
|
|
|
# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
|
2003-12-11 09:53:25 +00:00
|
|
|
# below. Note: there are no IDs for syscall stubs whose sources are generated.
|
2018-07-03 16:45:49 +00:00
|
|
|
# To include legacy CSRG SCCS ID strings, remove -DNO__SCCSID from CFLAGS.
|
|
|
|
# To include RCS ID strings from other BSD projects, remove -DNO__RCSID from CFLAGS.
|
|
|
|
CFLAGS+=-DNO__SCCSID -DNO__RCSID
|
|
|
|
|
1994-05-27 05:00:24 +00:00
|
|
|
LIB=c
|
2006-05-21 15:15:21 +00:00
|
|
|
SHLIB_MAJOR= 7
|
2020-02-05 20:08:01 +00:00
|
|
|
.if ${MK_SSP} != "no" && \
|
2022-02-18 13:22:14 +00:00
|
|
|
(${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
|
Turn libc.so into an ld script rather than a symlink pointing to the
real shared object and libssp_nonshared.a.
This was the last showstopper that prevented from enabling SSP for ports
by default. portmgr@ performed a buildworld which showed no significant
breakage with this patch.
Details:
On i386 for PIC objects, gcc uses the __stack_chk_fail_local hidden
symbol instead of calling __stack_chk_fail directly [1]. This happen
not only with our gcc-4.2.1 but also with the latest gcc-4.8. If you
want the very nasty details, see [2].
OTOH the problem doesn't exist on other architectures. It also doesn't
exist with Clang as the latter will somehow manage to create the
function in the object file at compile time (contrary to only
referencing it through a symbol that will be brought in at link time).
In a perfect world, when an object file is compiled with
-fstack-protector, it will be linked into a binary or a DSO with this
same flag as well, so GCC will add libssp_nonshared.a to the linker
command-line. Unfortunately, we don't control softwares in ports and we
may have such broken DSO. This is the whole point of this patch.
You can reproduce the problem on i386 by compiling a source file into an
object file with "-fstack-protector-all -fPIE" and linking it
into a binary without "-fstack-protector".
This ld script automatically proposes libssp_nonshared.a along with the
real libc DSO to the linker. It is important to understand that the
object file contained in this library will be pulled in the resulting
binary _only if_ the linker notices one of its symbols is needed (i.e.
one of the SSP symbol is missing).
A theorical performance impact could be when compiling, but my testing
showed less than 0.1% of difference.
[1] For 32-bit code gcc saves the PIC register setup by using
__stack_chk_fail_local hidden function instead of calling
__stack_chk_fail directly. See comment line 19460 in:
src/contrib/gcc/config/i386/i386.c
[2] When compiling a source file to an object file, if you use something
which is external to the compilation unit, GCC doesn't know yet if
this symbol will be inside or outside the DSO. So it expects the
worst case and routes the symbol through the GOT, which means
additional space and extra relocation for rtld(1).
Declaring a symbol has hidden tells GCC to use the optimal route (no
GOT), but on the other hand this means the symbol has to be provided
in the same DSO (namely libssp_nonshared.a).
On i386, GCC actually uses an hidden symbol for SSP in PIC objects
to save PIC register setup, as said in [1].
PR: ports/138228
PR: ports/168010
Reviewed by: kib, kan
2013-06-12 21:12:05 +00:00
|
|
|
SHLIB_LDSCRIPT=libc.ldscript
|
2016-10-12 13:19:21 +00:00
|
|
|
.else
|
|
|
|
SHLIB_LDSCRIPT=libc_nossp.ldscript
|
|
|
|
.endif
|
2015-12-25 11:29:18 +00:00
|
|
|
SHLIB_LDSCRIPT_LINKS=libxnet.so
|
2004-01-19 16:16:53 +00:00
|
|
|
WARNS?= 2
|
2017-01-20 03:23:24 +00:00
|
|
|
CFLAGS+=-I${LIBC_SRCTOP}/include -I${SRCTOP}/include
|
2014-03-04 02:19:39 +00:00
|
|
|
CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
|
2012-05-21 08:10:42 +00:00
|
|
|
.if ${MK_NLS} != "no"
|
2009-03-13 10:40:38 +00:00
|
|
|
CFLAGS+=-DNLS
|
2012-05-21 08:10:42 +00:00
|
|
|
.endif
|
1994-05-27 05:00:24 +00:00
|
|
|
CLEANFILES+=tags
|
2004-10-24 15:33:08 +00:00
|
|
|
INSTALL_PIC_ARCHIVE=
|
2018-05-09 10:28:24 +00:00
|
|
|
BUILD_NOSSP_PIC_ARCHIVE=
|
2004-10-24 15:33:08 +00:00
|
|
|
PRECIOUSLIB=
|
1994-05-27 05:00:24 +00:00
|
|
|
|
2010-09-25 01:57:47 +00:00
|
|
|
.ifndef NO_THREAD_STACK_UNWIND
|
|
|
|
CANCELPOINTS_CFLAGS=-fexceptions
|
|
|
|
CFLAGS+=${CANCELPOINTS_CFLAGS}
|
|
|
|
.endif
|
|
|
|
|
2021-07-16 02:35:28 +00:00
|
|
|
# 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" || \
|
2022-02-18 13:22:14 +00:00
|
|
|
${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "riscv" || \
|
|
|
|
${LIBC_ARCH:Mpowerpc*} != ""
|
2021-07-16 02:35:28 +00:00
|
|
|
CFLAGS+= -ftls-model=initial-exec
|
|
|
|
.endif
|
|
|
|
|
2007-05-19 04:32:56 +00:00
|
|
|
#
|
2014-01-18 14:22:56 +00:00
|
|
|
# Link with static libcompiler_rt.a.
|
2007-05-19 04:32:56 +00:00
|
|
|
#
|
2007-05-19 16:38:39 +00:00
|
|
|
LDFLAGS+= -nodefaultlibs
|
2014-11-25 11:07:26 +00:00
|
|
|
LIBADD+= compiler_rt
|
2012-05-19 17:49:20 +00:00
|
|
|
|
2020-02-05 20:08:01 +00:00
|
|
|
.if ${MK_SSP} != "no" && \
|
2022-02-18 13:22:14 +00:00
|
|
|
(${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
|
2014-11-25 11:07:26 +00:00
|
|
|
LIBADD+= ssp_nonshared
|
2012-05-19 17:49:20 +00:00
|
|
|
.endif
|
2007-05-19 04:32:56 +00:00
|
|
|
|
2013-11-25 20:17:55 +00:00
|
|
|
# Extras that live in either libc.a or libc_nonshared.a
|
|
|
|
LIBC_NONSHARED_SRCS=
|
|
|
|
|
2021-04-05 03:41:46 +00:00
|
|
|
RTLD_ELF_DIR=${SRCTOP}/libexec/rtld-elf
|
|
|
|
.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH:S/powerpc64le/powerpc64/})
|
|
|
|
RTLD_ARCH= ${MACHINE_ARCH:S/powerpc64le/powerpc64/}
|
|
|
|
.else
|
|
|
|
RTLD_ARCH= ${MACHINE_CPUARCH}
|
|
|
|
.endif
|
|
|
|
RTLD_HDRS= -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR}
|
|
|
|
|
2002-11-18 09:50:57 +00:00
|
|
|
# Define (empty) variables so that make doesn't give substitution
|
|
|
|
# errors if the included makefiles don't change these:
|
|
|
|
MDSRCS=
|
|
|
|
MISRCS=
|
|
|
|
MDASM=
|
|
|
|
MIASM=
|
|
|
|
NOASM=
|
|
|
|
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/${LIBC_ARCH}/Makefile.inc"
|
csu: move common code to libc
Why? Most trivial point, it shaves around 600 bytes from the dynamic
binaries on amd64. Less trivial, the removed code is no longer part of
the ABI, and we can ship updates to it with libc updates. Right now most
of the csu is linked into the binaries and require us to do somewhat
tricky ABI compat when it needs to change. For instance, the init_array
change would be much simpler and does not require note tagging if we
have init calling code in libc.
This could be improved more, by splitting dynamic and static
initialization. For instance, &_DYNAMIC tests can be removed then.
Such change, nonetheless, would require building libc three times.
I left this for later, after this change stabilizes, if ever.
Reviewed by: markj
Discussed with: jrtc27 (some objections, see the review), imp
Tested by: markj (aarch64)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D37220
2022-10-30 23:47:44 +00:00
|
|
|
.include "${LIBC_SRCTOP}/csu/Makefile.inc"
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/db/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/compat-43/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/gdtoa/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/gen/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/gmon/Makefile.inc"
|
Add the BSD-licensed Citrus iconv to the base system with default off
setting. It can be built by setting the WITH_ICONV knob. While this
knob is unset, the library part, the binaries, the header file and
the metadata files will not be built or installed so it makes no impact
on the system if left turned off.
This work is based on the iconv implementation in NetBSD but a great
number of improvements and feature additions have been included:
- Some utilities have been added. There is a conversion table generator,
which can compare conversion tables to reference data generated by
GNU libiconv. This helps ensuring conversion compatibility.
- UTF-16 surrogate support and some endianness issues have been fixed.
- The rather chaotic Makefiles to build metadata have been refactored
and cleaned up, now it is easy to read and it is also easier to add
support for new encodings.
- A bunch of new encodings and encoding aliases have been added.
- Support for 1->2, 1->3 and 1->4 mappings, which is needed for
transliterating with flying accents as GNU does, like "u.
- Lots of warnings have been fixed, the major part of the code is
now WARNS=6 clean.
- New section 1 and section 5 manual pages have been added.
- Some GNU-specific calls have been implemented:
iconvlist(), iconvctl(), iconv_canonicalize(), iconv_open_into()
- Support for GNU's //IGNORE suffix has been added.
- The "-" argument for stdin is now recognized in iconv(1) as per POSIX.
- The Big5 conversion module has been fixed.
- The iconv.h header files is supposed to be compatible with the
GNU version, i.e. sources should build with base iconv.h and
GNU libiconv. It also includes a macro magic to deal with the
char ** and const char ** incompatibility.
- GNU compatibility: "" or "char" means the current local
encoding in use
- Various cleanups and style(9) fixes.
Approved by: delphij (mentor)
Obtained from: The NetBSD Project
Sponsored by: Google Summer of Code 2009
2011-02-25 00:04:39 +00:00
|
|
|
.if ${MK_ICONV} != "no"
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/iconv/Makefile.inc"
|
Add the BSD-licensed Citrus iconv to the base system with default off
setting. It can be built by setting the WITH_ICONV knob. While this
knob is unset, the library part, the binaries, the header file and
the metadata files will not be built or installed so it makes no impact
on the system if left turned off.
This work is based on the iconv implementation in NetBSD but a great
number of improvements and feature additions have been included:
- Some utilities have been added. There is a conversion table generator,
which can compare conversion tables to reference data generated by
GNU libiconv. This helps ensuring conversion compatibility.
- UTF-16 surrogate support and some endianness issues have been fixed.
- The rather chaotic Makefiles to build metadata have been refactored
and cleaned up, now it is easy to read and it is also easier to add
support for new encodings.
- A bunch of new encodings and encoding aliases have been added.
- Support for 1->2, 1->3 and 1->4 mappings, which is needed for
transliterating with flying accents as GNU does, like "u.
- Lots of warnings have been fixed, the major part of the code is
now WARNS=6 clean.
- New section 1 and section 5 manual pages have been added.
- Some GNU-specific calls have been implemented:
iconvlist(), iconvctl(), iconv_canonicalize(), iconv_open_into()
- Support for GNU's //IGNORE suffix has been added.
- The "-" argument for stdin is now recognized in iconv(1) as per POSIX.
- The Big5 conversion module has been fixed.
- The iconv.h header files is supposed to be compatible with the
GNU version, i.e. sources should build with base iconv.h and
GNU libiconv. It also includes a macro magic to deal with the
char ** and const char ** incompatibility.
- GNU compatibility: "" or "char" means the current local
encoding in use
- Various cleanups and style(9) fixes.
Approved by: delphij (mentor)
Obtained from: The NetBSD Project
Sponsored by: Google Summer of Code 2009
2011-02-25 00:04:39 +00:00
|
|
|
.endif
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/inet/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/isc/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/locale/Makefile.inc"
|
2014-08-12 12:25:56 +00:00
|
|
|
.include "${LIBC_SRCTOP}/md/Makefile.inc"
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/nameser/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/net/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/nls/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
|
2022-10-05 16:26:31 +00:00
|
|
|
.if ${MACHINE_ABI:Mlong32}
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/quad/Makefile.inc"
|
2002-11-18 09:50:57 +00:00
|
|
|
.endif
|
2014-03-04 02:19:39 +00:00
|
|
|
.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"
|
2015-08-14 03:03:13 +00:00
|
|
|
.include "${LIBC_SRCTOP}/secure/Makefile.inc"
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/rpc/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/uuid/Makefile.inc"
|
|
|
|
.include "${LIBC_SRCTOP}/xdr/Makefile.inc"
|
2023-02-14 16:48:51 +00:00
|
|
|
.if (${LIBC_ARCH} == "arm" && (defined(CPUTYPE) && ${CPUTYPE:M*soft*})) || \
|
2016-11-16 15:21:32 +00:00
|
|
|
(${LIBC_ARCH} == "riscv" && ${MACHINE_ARCH:Mriscv*sf} != "")
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
|
2004-05-14 12:04:31 +00:00
|
|
|
.endif
|
Implement userspace gettimeofday(2) with HPET timecounter.
Right now, userspace (fast) gettimeofday(2) on x86 only works for
RDTSC. For older machines, like Core2, where RDTSC is not C2/C3
invariant, and which fall to HPET hardware, this means that the call
has both the penalty of the syscall and of the uncached hw behind the
QPI or PCIe connection to the sought bridge. Nothing can me done
against the access latency, but the syscall overhead can be removed.
System already provides mappable /dev/hpetX devices, which gives
straight access to the HPET registers page.
Add yet another algorithm to the x86 'vdso' timehands. Libc is updated
to handle both RDTSC and HPET. For HPET, the index of the hpet device
to mmap is passed from kernel to userspace, index might be changed and
libc invalidates its mapping as needed.
Remove cpu_fill_vdso_timehands() KPI, instead require that
timecounters which can be used from userspace, to provide
tc_fill_vdso_timehands{,32}() methods. Merge i386 and amd64
libc/<arch>/sys/__vdso_gettc.c into one source file in the new
libc/x86/sys location. __vdso_gettc() internal interface is changed
to move timecounter algorithm detection into the MD code.
Measurements show that RDTSC even with the syscall overhead is faster
than userspace HPET access. But still, userspace HPET is three-four
times faster than syscall HPET on several Core2 and SandyBridge
machines.
Tested by: Howard Su <howard0su@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D7473
2016-08-17 09:52:09 +00:00
|
|
|
.if ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "amd64"
|
|
|
|
.include "${LIBC_SRCTOP}/x86/sys/Makefile.inc"
|
2019-02-14 14:02:33 +00:00
|
|
|
.include "${LIBC_SRCTOP}/x86/gen/Makefile.inc"
|
Implement userspace gettimeofday(2) with HPET timecounter.
Right now, userspace (fast) gettimeofday(2) on x86 only works for
RDTSC. For older machines, like Core2, where RDTSC is not C2/C3
invariant, and which fall to HPET hardware, this means that the call
has both the penalty of the syscall and of the uncached hw behind the
QPI or PCIe connection to the sought bridge. Nothing can me done
against the access latency, but the syscall overhead can be removed.
System already provides mappable /dev/hpetX devices, which gives
straight access to the HPET registers page.
Add yet another algorithm to the x86 'vdso' timehands. Libc is updated
to handle both RDTSC and HPET. For HPET, the index of the hpet device
to mmap is passed from kernel to userspace, index might be changed and
libc invalidates its mapping as needed.
Remove cpu_fill_vdso_timehands() KPI, instead require that
timecounters which can be used from userspace, to provide
tc_fill_vdso_timehands{,32}() methods. Merge i386 and amd64
libc/<arch>/sys/__vdso_gettc.c into one source file in the new
libc/x86/sys location. __vdso_gettc() internal interface is changed
to move timecounter algorithm detection into the MD code.
Measurements show that RDTSC even with the syscall overhead is faster
than userspace HPET access. But still, userspace HPET is three-four
times faster than syscall HPET on several Core2 and SandyBridge
machines.
Tested by: Howard Su <howard0su@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D7473
2016-08-17 09:52:09 +00:00
|
|
|
.endif
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_NIS} != "no"
|
2002-11-18 09:50:57 +00:00
|
|
|
CFLAGS+= -DYP
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/yp/Makefile.inc"
|
2002-11-18 09:50:57 +00:00
|
|
|
.endif
|
2014-03-04 02:19:39 +00:00
|
|
|
.include "${LIBC_SRCTOP}/capability/Makefile.inc"
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_HESIOD} != "no"
|
2002-11-18 09:50:57 +00:00
|
|
|
CFLAGS+= -DHESIOD
|
|
|
|
.endif
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_FP_LIBC} == "no"
|
2004-05-02 10:55:07 +00:00
|
|
|
CFLAGS+= -DNO_FLOATING_POINT
|
|
|
|
.endif
|
2006-04-28 12:03:38 +00:00
|
|
|
.if ${MK_NS_CACHING} != "no"
|
|
|
|
CFLAGS+= -DNS_CACHING
|
|
|
|
.endif
|
2007-03-04 12:25:03 +00:00
|
|
|
.if defined(_FREEFALL_CONFIG)
|
|
|
|
CFLAGS+=-D_FREEFALL_CONFIG
|
|
|
|
.endif
|
2002-11-18 09:50:57 +00:00
|
|
|
|
2013-11-25 20:17:55 +00:00
|
|
|
STATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/}
|
|
|
|
|
2014-03-04 02:19:39 +00:00
|
|
|
VERSION_DEF=${LIBC_SRCTOP}/Versions.def
|
2006-03-16 15:16:23 +00:00
|
|
|
SYMBOL_MAPS=${SYM_MAPS}
|
|
|
|
CFLAGS+= -DSYMBOL_VERSIONING
|
|
|
|
|
2002-11-18 09:50:57 +00:00
|
|
|
# If there are no machine dependent sources, append all the
|
|
|
|
# machine-independent sources:
|
2022-08-08 15:16:00 +00:00
|
|
|
.if empty(MDSRCS) || ${MK_MACHDEP_OPTIMIZATIONS} == no
|
2002-11-18 09:50:57 +00:00
|
|
|
SRCS+= ${MISRCS}
|
|
|
|
.else
|
|
|
|
# Append machine-dependent sources, then append machine-independent sources
|
|
|
|
# for which there is no machine-dependent variant.
|
|
|
|
SRCS+= ${MDSRCS}
|
|
|
|
.for _src in ${MISRCS}
|
|
|
|
.if ${MDSRCS:R:M${_src:R}} == ""
|
|
|
|
SRCS+= ${_src}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif
|
1994-05-27 05:00:24 +00:00
|
|
|
|
|
|
|
KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
|
|
|
|
lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
|
|
|
|
subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
|
2012-01-03 07:14:01 +00:00
|
|
|
KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \
|
|
|
|
strcmp.c strcpy.c strlen.c strncpy.c strrchr.c
|
1994-05-27 05:00:24 +00:00
|
|
|
|
2010-08-24 20:54:43 +00:00
|
|
|
libkern: libkern.gen libkern.${LIBC_ARCH}
|
1994-05-27 05:00:24 +00:00
|
|
|
|
|
|
|
libkern.gen: ${KQSRCS} ${KSRCS}
|
2015-01-16 21:39:08 +00:00
|
|
|
${CP} ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
|
1994-05-27 05:00:24 +00:00
|
|
|
|
2010-08-24 20:54:43 +00:00
|
|
|
libkern.${LIBC_ARCH}:: ${KMSRCS}
|
1994-05-27 05:00:24 +00:00
|
|
|
.if defined(KMSRCS) && !empty(KMSRCS)
|
2015-01-16 21:39:08 +00:00
|
|
|
${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
|
1994-05-27 05:00:24 +00:00
|
|
|
.endif
|
2010-08-23 15:18:35 +00:00
|
|
|
|
2017-08-02 08:50:42 +00:00
|
|
|
HAS_TESTS=
|
2017-08-02 08:35:51 +00:00
|
|
|
SUBDIR.${MK_TESTS}+= tests
|
2014-11-04 00:56:25 +00:00
|
|
|
|
1994-05-27 05:00:24 +00:00
|
|
|
.include <bsd.lib.mk>
|
2004-01-11 10:42:47 +00:00
|
|
|
|
2018-09-24 13:42:46 +00:00
|
|
|
.if (${LIBC_ARCH} == amd64 || ${LIBC_ARCH} == i386) && \
|
|
|
|
${.TARGETS:Mall} == all && \
|
|
|
|
defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == ""
|
2020-07-19 23:56:19 +00:00
|
|
|
.error ${LIBC_ARCH} libc requires linker ifunc support
|
2018-09-24 13:42:46 +00:00
|
|
|
.endif
|
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.if !defined(_SKIP_BUILD)
|
|
|
|
# We need libutil.h, get it directly to avoid
|
|
|
|
# recording a build dependency
|
2016-01-25 19:11:34 +00:00
|
|
|
CFLAGS+= -I${SRCTOP}/lib/libutil
|
2012-08-22 19:25:57 +00:00
|
|
|
# Same issue with libm
|
2016-01-25 19:11:34 +00:00
|
|
|
MSUN_ARCH_SUBDIR != ${MAKE} -B -C ${SRCTOP}/lib/msun -V ARCH_SUBDIR
|
2012-08-22 19:25:57 +00:00
|
|
|
# unfortunately msun/src contains both private and public headers
|
2016-01-27 00:24:24 +00:00
|
|
|
CFLAGS+= -I${SRCTOP}/lib/msun/${MSUN_ARCH_SUBDIR}
|
2013-10-13 00:29:14 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
|
2016-01-25 19:11:34 +00:00
|
|
|
CFLAGS+= -I${SRCTOP}/lib/msun/x86
|
2013-10-13 00:29:14 +00:00
|
|
|
.endif
|
2016-01-25 19:11:34 +00:00
|
|
|
CFLAGS+= -I${SRCTOP}/lib/msun/src
|
2013-10-13 00:29:14 +00:00
|
|
|
# and we do not want to record a dependency on msun
|
|
|
|
.if ${.MAKE.LEVEL} > 0
|
|
|
|
GENDIRDEPS_FILTER+= N${RELDIR:H}/msun
|
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
.endif
|
|
|
|
|
2004-01-11 10:42:47 +00:00
|
|
|
# Disable warnings in contributed sources.
|
2010-08-01 12:35:01 +00:00
|
|
|
CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
|
2008-06-25 21:33:28 +00:00
|
|
|
# Disable stack protection for SSP symbols.
|
|
|
|
SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
|
2010-09-25 01:57:47 +00:00
|
|
|
# Generate stack unwinding tables for cancellation points
|
|
|
|
CANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}
|