1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
2000-03-27 16:11:27 +00:00
|
|
|
|
2014-08-29 10:44:58 +00:00
|
|
|
# Use the following command to build local debug version of dynamic
|
|
|
|
# linker:
|
2016-11-15 09:37:35 +00:00
|
|
|
# make DEBUG_FLAGS=-g DEBUG=-DDEBUG WITHOUT_TESTS=yes all
|
2014-08-29 10:44:58 +00:00
|
|
|
|
2014-05-06 04:22:01 +00:00
|
|
|
.include <src.opts.mk>
|
2016-02-05 21:01:08 +00:00
|
|
|
PACKAGE= clibs
|
2009-02-21 15:04:31 +00:00
|
|
|
MK_SSP= no
|
2007-05-13 14:12:40 +00:00
|
|
|
|
2018-09-18 00:25:00 +00:00
|
|
|
CONFS= libmap.conf
|
2004-03-21 01:21:26 +00:00
|
|
|
PROG?= ld-elf.so.1
|
2016-02-05 21:01:08 +00:00
|
|
|
.if (${PROG:M*ld-elf32*} != "")
|
|
|
|
TAGS+= lib32
|
|
|
|
.endif
|
2004-05-14 21:01:52 +00:00
|
|
|
SRCS= rtld_start.S \
|
2011-08-24 20:05:13 +00:00
|
|
|
reloc.c rtld.c rtld_lock.c rtld_printf.c map_object.c \
|
2004-05-14 12:15:51 +00:00
|
|
|
malloc.c xmalloc.c debug.c libmap.c
|
2001-03-26 14:22:12 +00:00
|
|
|
MAN= rtld.1
|
2003-06-04 05:42:04 +00:00
|
|
|
CSTD?= gnu99
|
2015-12-03 21:25:59 +00:00
|
|
|
CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding
|
2015-12-01 22:20:04 +00:00
|
|
|
CFLAGS+= -I${SRCTOP}/lib/csu/common
|
2010-08-24 23:19:14 +00:00
|
|
|
.if exists(${.CURDIR}/${MACHINE_ARCH})
|
|
|
|
RTLD_ARCH= ${MACHINE_ARCH}
|
|
|
|
.else
|
|
|
|
RTLD_ARCH= ${MACHINE_CPUARCH}
|
|
|
|
.endif
|
|
|
|
CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
|
2010-07-10 17:43:24 +00:00
|
|
|
.if ${MACHINE_ARCH} == "powerpc64"
|
|
|
|
LDFLAGS+= -nostdlib -e _rtld_start
|
|
|
|
.else
|
1999-04-09 00:28:43 +00:00
|
|
|
LDFLAGS+= -nostdlib -e .rtld_start
|
2010-07-10 17:43:24 +00:00
|
|
|
.endif
|
2018-10-29 21:08:19 +00:00
|
|
|
|
|
|
|
NO_WCAST_ALIGN= yes
|
|
|
|
WARNS?= 4
|
2004-11-03 18:01:21 +00:00
|
|
|
INSTALLFLAGS= -C -b
|
|
|
|
PRECIOUSPROG=
|
2012-12-04 12:51:33 +00:00
|
|
|
BINDIR= /libexec
|
2017-03-07 05:10:38 +00:00
|
|
|
SYMLINKS= ../..${BINDIR}/${PROG} ${LIBEXECDIR}/${PROG}
|
2003-02-13 23:07:28 +00:00
|
|
|
MLINKS= rtld.1 ld-elf.so.1.1 \
|
|
|
|
rtld.1 ld.so.1
|
1998-09-04 19:03:57 +00:00
|
|
|
|
2010-11-11 22:53:55 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "sparc64"
|
|
|
|
CFLAGS+= -fPIC
|
|
|
|
.else
|
|
|
|
CFLAGS+= -fpic
|
|
|
|
.endif
|
2010-12-25 08:42:38 +00:00
|
|
|
CFLAGS+= -DPIC $(DEBUG)
|
2015-03-29 18:53:21 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
|
|
|
CFLAGS+= -fvisibility=hidden
|
|
|
|
.endif
|
2017-08-30 20:00:15 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "mips"
|
|
|
|
CFLAGS.reloc.c+=-fno-jump-tables
|
|
|
|
.endif
|
2016-11-15 09:40:03 +00:00
|
|
|
LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs
|
2018-05-09 10:30:56 +00:00
|
|
|
LIBADD= c_nossp_pic
|
2016-03-31 17:27:01 +00:00
|
|
|
.if ${MK_TOOLCHAIN} == "no"
|
|
|
|
LDFLAGS+= -L${LIBCDIR}
|
|
|
|
.endif
|
2007-04-03 19:01:06 +00:00
|
|
|
|
2014-10-01 08:26:51 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "arm"
|
2014-01-18 14:22:56 +00:00
|
|
|
# Some of the required math functions (div & mod) are implemented in
|
|
|
|
# libcompiler_rt on ARM. The library also needs to be placed first to be
|
|
|
|
# correctly linked. As some of the functions are used before we have
|
|
|
|
# shared libraries.
|
2014-11-25 21:18:18 +00:00
|
|
|
LIBADD+= compiler_rt
|
2013-01-19 04:34:33 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-13 14:12:40 +00:00
|
|
|
.if ${MK_SYMVER} == "yes"
|
2015-12-01 22:20:04 +00:00
|
|
|
VERSION_DEF= ${LIBCSRCDIR}/Versions.def
|
2007-04-03 19:01:06 +00:00
|
|
|
SYMBOL_MAPS= ${.CURDIR}/Symbol.map
|
|
|
|
VERSION_MAP= Version.map
|
|
|
|
LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
|
|
|
|
|
2010-08-24 23:19:14 +00:00
|
|
|
.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map)
|
|
|
|
SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map
|
2007-04-03 19:01:06 +00:00
|
|
|
.endif
|
1999-04-09 00:28:43 +00:00
|
|
|
.endif
|
|
|
|
|
2010-08-24 23:19:14 +00:00
|
|
|
.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc"
|
1998-03-07 19:24:35 +00:00
|
|
|
|
2003-08-17 18:50:56 +00:00
|
|
|
# Since moving rtld-elf to /libexec, we need to create a symlink.
|
|
|
|
# Fixup the existing binary that's there so we can symlink over it.
|
|
|
|
beforeinstall:
|
2015-09-18 23:12:38 +00:00
|
|
|
.if exists(${DESTDIR}/usr/libexec/${PROG}) && ${MK_STAGING} == "no"
|
2012-12-04 14:36:01 +00:00
|
|
|
-chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
|
2004-11-14 22:18:31 +00:00
|
|
|
.endif
|
2003-08-17 18:50:56 +00:00
|
|
|
|
2010-08-24 23:19:14 +00:00
|
|
|
.PATH: ${.CURDIR}/${RTLD_ARCH}
|
1998-03-07 19:24: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-06-20 17:14:59 +00:00
|
|
|
|
1998-03-07 19:24:35 +00:00
|
|
|
.include <bsd.prog.mk>
|
2016-07-03 17:28:39 +00:00
|
|
|
${PROG_FULL}: ${VERSION_MAP}
|
2015-12-01 22:50:32 +00:00
|
|
|
.include <bsd.symver.mk>
|
2018-10-29 21:08:19 +00:00
|
|
|
|
|
|
|
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300
|
|
|
|
# Silence -Wshadow false positives in ancient GCC
|
|
|
|
CFLAGS+= -Wno-shadow
|
|
|
|
.endif
|