1# $FreeBSD$ 2 3.include <src.opts.mk> 4MK_SSP= no 5 6PROG?= ld-elf.so.1 7SRCS= rtld_start.S \ 8 reloc.c rtld.c rtld_lock.c rtld_printf.c map_object.c \ 9 malloc.c xmalloc.c debug.c libmap.c 10MAN= rtld.1 11CSTD?= gnu99 12TOPSRCDIR= ${.CURDIR}/../.. 13CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD 14CFLAGS+= -I${TOPSRCDIR}/lib/csu/common 15.if exists(${.CURDIR}/${MACHINE_ARCH}) 16RTLD_ARCH= ${MACHINE_ARCH} 17.else 18RTLD_ARCH= ${MACHINE_CPUARCH} 19.endif 20CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} 21.if ${MACHINE_ARCH} == "powerpc64" 22CFLAGS+= -mcall-aixdesc 23LDFLAGS+= -nostdlib -e _rtld_start 24.else 25LDFLAGS+= -nostdlib -e .rtld_start 26.endif 27WARNS?= 2 28INSTALLFLAGS= -C -b 29PRECIOUSPROG= 30BINDIR= /libexec 31SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG} 32MLINKS= rtld.1 ld-elf.so.1.1 \ 33 rtld.1 ld.so.1 34 35.if ${MACHINE_CPUARCH} == "sparc64" 36CFLAGS+= -fPIC 37.else 38CFLAGS+= -fpic 39.endif 40CFLAGS+= -DPIC $(DEBUG) 41LDFLAGS+= -shared -Wl,-Bsymbolic 42DPADD= ${LIBC_PIC} 43LDADD= -lc_pic 44 45.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" 46# Some of the required math functions (div & mod) are implemented in 47# libcompiler_rt on ARM. The library also needs to be placed first to be 48# correctly linked. As some of the functions are used before we have 49# shared libraries. 50DPADD+= ${LIBCOMPILER_RT} 51LDADD+= -lcompiler_rt 52.endif 53 54 55 56.if ${MK_SYMVER} == "yes" 57LIBCDIR= ${TOPSRCDIR}/lib/libc 58VERSION_DEF= ${LIBCDIR}/Versions.def 59SYMBOL_MAPS= ${.CURDIR}/Symbol.map 60VERSION_MAP= Version.map 61LDFLAGS+= -Wl,--version-script=${VERSION_MAP} 62 63${PROG}: ${VERSION_MAP} 64 65.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) 66SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map 67.endif 68.endif 69 70.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" 71 72# Since moving rtld-elf to /libexec, we need to create a symlink. 73# Fixup the existing binary that's there so we can symlink over it. 74beforeinstall: 75.if exists(${DESTDIR}/usr/libexec/${PROG}) 76 -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG} 77.endif 78 79.PATH: ${.CURDIR}/${RTLD_ARCH} 80 81NO_PIE= yes 82 83.if ${MK_TESTS} != "no" 84SUBDIR+= tests 85.endif 86 87.include <bsd.symver.mk> 88.include <bsd.prog.mk> 89