]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - libexec/rtld-elf/Makefile
Align the stack to a 16 byte boundary before calling _rtld so that we can
[FreeBSD/FreeBSD.git] / libexec / rtld-elf / Makefile
1 # $FreeBSD$
2
3 PROG?=          ld-elf.so.1
4 SRCS=           rtld_start.S \
5                 reloc.c rtld.c rtld_lock.c map_object.c \
6                 malloc.c xmalloc.c debug.c libmap.c
7 MAN=            rtld.1
8 CSTD?=          gnu99
9 CFLAGS+=        -Wall -DFREEBSD_ELF -DIN_RTLD
10 CFLAGS+=        -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR}
11 LDFLAGS+=       -nostdlib -e .rtld_start
12 INSTALLFLAGS=   -C -b
13 PRECIOUSPROG=
14 BINDIR=         /libexec
15 SYMLINKS=       ${BINDIR}/${PROG} /usr/libexec/${PROG}
16 MLINKS=         rtld.1 ld-elf.so.1.1 \
17                 rtld.1 ld.so.1
18
19 .if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc)
20 .include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc"
21 .endif
22
23 # If LDSCRIPT is defined, we build the dynamic linker as an
24 # executable.  Otherwise we build it as a shared object.  We ignore
25 # LDSCRIPT if the running kernel is too old to support it.
26 .if defined(LDSCRIPT)
27 KERN_OSRELDATE!=        /sbin/sysctl -n kern.osreldate 2>/dev/null || echo 0
28 .if ${KERN_OSRELDATE} >= 400001
29 LDSO_IS_EXECUTABLE=
30 .endif
31 .endif
32
33 .ifdef LDSO_IS_EXECUTABLE
34 OBJS+=          dyn_hack.so
35 LDFLAGS+=       -Wl,-T,${LDSCRIPT} -Wl,-E -Wl,-Bstatic
36 DPADD=          ${LIBC}
37 LDADD=          -lc
38 .else
39 CFLAGS+=        -fpic -DPIC
40 LDFLAGS+=       -shared -Wl,-Bsymbolic
41 DPADD=          ${LIBC_PIC}
42 LDADD=          -lc_pic
43 .endif
44
45 dyn_hack.so:
46         ${CC} -shared -nostdlib -o dyn_hack.so -x c /dev/null
47
48 # Since moving rtld-elf to /libexec, we need to create a symlink.
49 # Fixup the existing binary that's there so we can symlink over it.
50 beforeinstall:
51 .if exists(${DESTDIR}/usr/libexec/${PROG})
52         -chflags noschg ${DESTDIR}/usr/libexec/${PROG}
53 .endif
54
55 .PATH: ${.CURDIR}/${MACHINE_ARCH}
56
57 .include <bsd.prog.mk>