Makefile revision 1.11
1# $NetBSD: Makefile,v 1.11 2025/06/08 16:55:04 christos Exp $
2
3NOMAN=			# defined
4
5.include <bsd.own.mk>
6
7TESTSDIR=		${TESTSBASE}/lib/csu
8TESTS_SH=		t_crt0 t_ifunc_static
9TESTS_SUBDIRS=
10SUBDIR+=		dso
11
12.include "Makefile.check_stack"
13
14CPPFLAGS+=		${CPPFLAGS_CHECK_STACK}
15
16BINDIR=			${TESTSDIR}
17PROG_CXX=		h_initfini1 h_initfini2 h_initfini3
18SRCS.h_initfini1=	h_initfini1.cxx h_initfini_common.cxx \
19			${SRCS_CHECK_STACK}
20SRCS.h_initfini2=	h_initfini1.cxx h_initfini_common.cxx \
21			${SRCS_CHECK_STACK}
22LDSTATIC.h_initfini2+=	-static
23SRCS.h_initfini3=	h_initfini3.cxx h_initfini_common.cxx \
24			${SRCS_CHECK_STACK}
25LDADD.h_initfini3+=	-Wl,-rpath,${TESTSDIR}
26
27PROGS+=			h_ifunc_static h_initfini_array
28SRCS.h_ifunc_static=	h_ifunc_static.c
29SRCS.h_initfini_array=	h_initfini_array.c
30LDSTATIC.h_ifunc_static=-static
31
32TESTS_SH+=		t_hello
33
34PROGS+=		${"${MKPIC}" != no:?h_hello_dyn:}
35PROGS+=		${"${MKPIE}" != no:?h_hello_dynpie:}
36PROGS+=		${"${MKPIE}" != no:?h_hello_relr:}
37PROGS+=		h_hello_sta
38PROGS+=		${"${MKPIE}" != no:?h_hello_stapie:}
39
40h_hello_relr: CTFMERGE=:	# PR toolchain/59364: ctf tools needs update
41
42# relative relocs are only supported in gnu ld for ppc64 and x86
43.if ${MACHINE_ARCH} == "x86_64" || \
44    ${MACHINE_ARCH} == "i386"  || \
45    ${MACHINE_ARCH} == "powerpc64"
46PACK_RELATIVE_RELOCS=-Wl,-z,pack-relative-relocs
47NOPACK_RELATIVE_RELOCS=-Wl,-z,nopack-relative-relocs
48.endif
49
50
51SRCS.h_hello_dyn+=		h_hello.c
52SRCS.h_hello_dynpie+=		h_hello.c
53SRCS.h_hello_relr+=		h_hello.c
54SRCS.h_hello_sta+=		h_hello.c
55SRCS.h_hello_stapie+=		h_hello.c
56COPTS.h_hello.c+=		${"${MKPIE}" != no:?-fPIE:}
57LDFLAGS.h_hello_dyn=		-no-pie
58LDFLAGS.h_hello_dynpie=		-pie
59LDFLAGS.h_hello_relr=		-pie ${PACK_RELATIVE_RELOCS}
60LDFLAGS.h_hello_sta=		-no-pie
61LDFLAGS.h_hello_stapie=		-pie ${NOPACK_RELATIVE_RELOCS}
62LDSTATIC.h_hello_relr=		-static
63LDSTATIC.h_hello_sta=		-static
64LDSTATIC.h_hello_stapie=	-static
65
66.include <bsd.test.mk>
67