1# $FreeBSD$ 2 3.include <bsd.own.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 libgcc 47# on ARM. The library also needs to be placed first to be correctly linked. 48# As some of the functions are used before we have shared libraries. 49DPADD+= ${LIBGCC} 50LDADD+= -lgcc 51.endif 52 53 54 55.if ${MK_SYMVER} == "yes" 56LIBCDIR= ${TOPSRCDIR}/lib/libc 57VERSION_DEF= ${LIBCDIR}/Versions.def 58SYMBOL_MAPS= ${.CURDIR}/Symbol.map 59VERSION_MAP= Version.map 60LDFLAGS+= -Wl,--version-script=${VERSION_MAP} 61 62${PROG}: ${VERSION_MAP} 63 64.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) 65SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map 66.endif 67.endif 68 69.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" 70 71# Since moving rtld-elf to /libexec, we need to create a symlink. 72# Fixup the existing binary that's there so we can symlink over it. 73beforeinstall: 74.if exists(${DESTDIR}/usr/libexec/${PROG}) 75 -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG} 76.endif 77 78.PATH: ${.CURDIR}/${RTLD_ARCH} 79 80.include <bsd.symver.mk> 81.include <bsd.prog.mk> 82