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