3 # Use the following command to build local debug version of dynamic
5 # make DEBUG_FLAGS=-g DEBUG=-DDEBUG MK_TESTS=no all
12 reloc.c rtld.c rtld_lock.c rtld_printf.c map_object.c \
13 malloc.c xmalloc.c debug.c libmap.c
16 CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding
17 CFLAGS+= -I${SRCTOP}/lib/csu/common
18 .if exists(${.CURDIR}/${MACHINE_ARCH})
19 RTLD_ARCH= ${MACHINE_ARCH}
21 RTLD_ARCH= ${MACHINE_CPUARCH}
23 CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
24 .if ${MACHINE_ARCH} == "powerpc64"
25 LDFLAGS+= -nostdlib -e _rtld_start
27 LDFLAGS+= -nostdlib -e .rtld_start
33 SYMLINKS= ${BINDIR}/${PROG} ${LIBEXECDIR}/${PROG}
34 MLINKS= rtld.1 ld-elf.so.1.1 \
37 .if ${MACHINE_CPUARCH} == "sparc64"
42 CFLAGS+= -DPIC $(DEBUG)
43 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
44 CFLAGS+= -fvisibility=hidden
46 LDFLAGS+= -shared -Wl,-Bsymbolic
48 .if ${MK_TOOLCHAIN} == "no"
49 LDFLAGS+= -L${LIBCDIR}
52 .if ${MACHINE_CPUARCH} == "arm"
53 # Some of the required math functions (div & mod) are implemented in
54 # libcompiler_rt on ARM. The library also needs to be placed first to be
55 # correctly linked. As some of the functions are used before we have
62 .if ${MK_SYMVER} == "yes"
63 VERSION_DEF= ${LIBCSRCDIR}/Versions.def
64 SYMBOL_MAPS= ${.CURDIR}/Symbol.map
65 VERSION_MAP= Version.map
66 LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
68 ${PROG}: ${VERSION_MAP}
70 .if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map)
71 SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map
75 .sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc"
77 # Since moving rtld-elf to /libexec, we need to create a symlink.
78 # Fixup the existing binary that's there so we can symlink over it.
80 .if exists(${DESTDIR}/usr/libexec/${PROG}) && ${MK_STAGING} == "no"
81 -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
84 .PATH: ${.CURDIR}/${RTLD_ARCH}
86 .if ${MK_TESTS} != "no"
90 .include <bsd.prog.mk>
91 .include <bsd.symver.mk>