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 TOPSRCDIR= ${.CURDIR}/../..
17 CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD
18 CFLAGS+= -I${TOPSRCDIR}/lib/csu/common
19 .if exists(${.CURDIR}/${MACHINE_ARCH})
20 RTLD_ARCH= ${MACHINE_ARCH}
22 RTLD_ARCH= ${MACHINE_CPUARCH}
24 CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
25 .if ${MACHINE_ARCH} == "powerpc64"
26 CFLAGS+= -mcall-aixdesc
27 LDFLAGS+= -nostdlib -e _rtld_start
29 LDFLAGS+= -nostdlib -e .rtld_start
35 SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG}
36 MLINKS= rtld.1 ld-elf.so.1.1 \
39 .if ${MACHINE_CPUARCH} == "sparc64"
44 CFLAGS+= -DPIC $(DEBUG)
45 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
46 CFLAGS+= -fvisibility=hidden
48 LDFLAGS+= -shared -Wl,-Bsymbolic
52 .if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no"
53 # Some of the required math functions (div & mod) are implemented in libgcc
54 # on ARM. The library also needs to be placed first to be correctly linked.
55 # As some of the functions are used before we have shared libraries.
62 .if ${MK_SYMVER} == "yes"
63 LIBCDIR= ${TOPSRCDIR}/lib/libc
64 VERSION_DEF= ${LIBCDIR}/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})
82 -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
85 .PATH: ${.CURDIR}/${RTLD_ARCH}
87 .include <bsd.symver.mk>
88 .include <bsd.prog.mk>