aboutsummaryrefslogtreecommitdiff
path: root/libexec/rtld-elf/Makefile
diff options
context:
space:
mode:
authorJohn Polstra <jdp@FreeBSD.org>1999-04-09 00:28:43 +0000
committerJohn Polstra <jdp@FreeBSD.org>1999-04-09 00:28:43 +0000
commitd5b537d01a6711c4426da2a627b11a71cf3b11e8 (patch)
treefb707dedb5110cb675ca69b3f246fd2e79ffce0d /libexec/rtld-elf/Makefile
parentc98a60baa7fa0f18b4e19106ec135031c0d51723 (diff)
Notes
Diffstat (limited to 'libexec/rtld-elf/Makefile')
-rw-r--r--libexec/rtld-elf/Makefile39
1 files changed, 27 insertions, 12 deletions
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index f6a10544abea..bceb2a27d02c 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -1,25 +1,40 @@
#
-# $Id: Makefile,v 1.4 1998/09/04 19:03:57 dfr Exp $
+# $Id: Makefile,v 1.5 1999/02/15 05:02:54 nate Exp $
#
-
PROG= ld-elf.so.1
SRCS= rtld_start.S rtld.c map_object.c malloc.c xmalloc.c debug.c \
reloc.c
NOMAN= true
-CFLAGS+= -fpic -Wall -DFREEBSD_ELF -I${.CURDIR}
-LDADD+= -lc_pic
+CFLAGS+= -Wall -DFREEBSD_ELF -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR}
+LDFLAGS+= -nostdlib -e .rtld_start
+INSTALLFLAGS+= -fschg -C
+.if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc)
+.include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc"
+.endif
-.if ${MACHINE_ARCH} == "alpha"
-CFLAGS+= -mno-fp-regs
-LDFLAGS+= -nostdlib -Wl,-Bshareable,-Bsymbolic -e .rtld_start
-.elif ${MACHINE_ARCH} == "i386"
-CFLAGS+= -elf
-LDFLAGS+= -elf -nostdlib -Wl,-Bshareable,-Bsymbolic
+# If LDSCRIPT is defined, we build the dynamic linker as an
+# executable. Otherwise we build it as a shared object. We ignore
+# LDSCRIPT if the running kernel is too old to support it.
+.if defined(LDSCRIPT)
+KERN_OSRELDATE!= /sbin/sysctl -n kern.osreldate 2>/dev/null || echo 0
+.if ${KERN_OSRELDATE} >= 400001
+LDSO_IS_EXECUTABLE= yes
+.endif
.endif
-# Atomic installation with "-C" is very important for this program.
-INSTALLFLAGS+= -fschg -C
+.ifdef LDSO_IS_EXECUTABLE
+OBJS+= dyn_hack.so
+LDFLAGS+= -Wl,-T,${LDSCRIPT} -Wl,-E -Wl,-Bstatic
+LDADD+= -lc
+.else
+CFLAGS+= -fpic -DPIC
+LDFLAGS+= -shared -Wl,-Bsymbolic
+LDADD+= -lc_pic
+.endif
+
+dyn_hack.so:
+ ${CC} -shared -nostdlib -o dyn_hack.so -x c /dev/null
.PATH: ${.CURDIR}/${MACHINE_ARCH}