rtld-elf: -e is an ld(1) option.
[dragonfly.git] / libexec / rtld-elf / Makefile
CommitLineData
abfcd5b1 1# $FreeBSD$
984263bc 2
a1eee96a 3PROG= ld-elf.so.2
abfcd5b1
JM
4SRCS= rtld_start.S \
5 reloc.c rtld.c rtld_lock.c rtld_printf.c map_object.c \
6 malloc.c xmalloc.c debug.c libmap.c
984263bc 7MAN= rtld.1
16dbe6a9
FT
8BINDIR= /libexec
9SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG}
8f5c3d2a
SW
10WARNS?= 2
11
e77c6f6a 12# DO NOT USE -static, this is a special case
13.undef NOSHARED
14
fcf53d9b
JM
15# To activate LD_DEBUG functionality, define ENABLE_DEBUG
16# e.g. make -DENABLE_DEBUG
17
697e5645 18# for now do not let the use of -flto
19.if ${CFLAGS:M-flto}
20CFLAGS+= -fno-lto
21LDFLAGS+= -flto
22.endif
23
fcf53d9b
JM
24CFLAGS+= -DIN_RTLD
25CFLAGS+= -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR} -D__thread=
7f5c8f97 26CFLAGS+= -I${.CURDIR}/../../lib/csu/common
538c1620 27LDFLAGS+= -nostdlib -Wl,-e.rtld_start,--no-undefined
0a5ad630
JS
28INSTALLFLAGS= -C -b
29.ifndef NOFSCHG
30INSTALLFLAGS+= -fschg
31.endif
984263bc 32MLINKS= rtld.1 ld-elf.so.1.1
b6989f5b 33MLINKS+= rtld.1 ld-elf.so.2.1
40146e6a 34MLINKS+= rtld.1 _rtld_functrace.3
984263bc 35
f03f3171
JM
36.if !defined(NO_SYMVER)
37VERSION_DEF= ${.CURDIR}/../../lib/libc/Versions.def
38SYMBOL_MAPS= ${.CURDIR}/Symbol.map
39VERSION_MAP= Version.map
40LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
41
42rtld.c: ${VERSION_MAP}
43
44.if exists(${.CURDIR}/${MACHINE_ARCH}/Symbol.map)
45SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_ARCH}/Symbol.map
46.endif
47.endif
48
984263bc
MD
49.if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc)
50.include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc"
51.endif
52
984263bc
MD
53CFLAGS+= -fpic -DPIC
54LDFLAGS+= -shared -Wl,-Bsymbolic
d2a4c620
JS
55DPADD= ${.OBJDIR}/../../lib/libc_rtld/libc_rtld_pic.a
56LDADD= -L${.OBJDIR}/../../lib/libc_rtld -lc_rtld_pic
984263bc 57
fcf53d9b
JM
58.ifdef ENABLE_DEBUG
59CFLAGS+= -DDEBUG
60.endif
61
55d72589 62# The gcc80 -O2 tends to wrap malloc() + bzero() back to local calloc() by
63# emitting calloc: imul %rsi,%rdi; mov $0x1,%esi; jmpq 0xfoo <calloc>
64FLAGS_GROUPS= calloc
65calloc_FLAGS= -fno-builtin-malloc
66calloc_FLAGS_FILES= malloc.c
67
16dbe6a9
FT
68# Since moving rtld-elf to /libexec, we need to create a symlink.
69# Fixup the existing binary that's there so we can symlink over it.
70beforeinstall:
71.if exists(${DESTDIR}/usr/libexec/${PROG})
72 chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
73.endif
74
984263bc
MD
75.PATH: ${.CURDIR}/${MACHINE_ARCH}
76
f03f3171 77.include <bsd.symver.mk>
984263bc 78.include <bsd.prog.mk>