1# $FreeBSD$ 2 3MAINTAINER= jdp 4PROG= ld-elf.so.1 5SRCS= rtld_start.S rtld.c lockdflt.c map_object.c malloc.c \ 6 xmalloc.c debug.c reloc.c 7MAN1= rtld.1 8CFLAGS+= -Wall -DFREEBSD_ELF -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR} 9LDFLAGS+= -nostdlib -e .rtld_start 10INSTALLFLAGS+= -fschg -C 11MLINKS= rtld.1 ld-elf.so.1.1 12 13.if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc) 14.include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" 15.endif 16 17# If LDSCRIPT is defined, we build the dynamic linker as an 18# executable. Otherwise we build it as a shared object. We ignore 19# LDSCRIPT if the running kernel is too old to support it. 20.if defined(LDSCRIPT) 21KERN_OSRELDATE!= /sbin/sysctl -n kern.osreldate 2>/dev/null || echo 0 22.if ${KERN_OSRELDATE} >= 400001 23LDSO_IS_EXECUTABLE= yes 24.endif 25.endif 26 27.ifdef LDSO_IS_EXECUTABLE 28OBJS+= dyn_hack.so 29LDFLAGS+= -Wl,-T,${LDSCRIPT} -Wl,-E -Wl,-Bstatic 30DPADD= ${LIBC} 31LDADD= -lc 32.else 33CFLAGS+= -fpic -DPIC 34LDFLAGS+= -shared -Wl,-Bsymbolic 35DPADD= ${LIBC_PIC} 36LDADD= -lc_pic 37.endif 38 39dyn_hack.so: 40 ${CC} -shared -nostdlib -o dyn_hack.so -x c /dev/null 41 42.PATH: ${.CURDIR}/${MACHINE_ARCH} 43 44.include <bsd.prog.mk> 45