summaryrefslogtreecommitdiff
path: root/mk/compiler/clang.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/compiler/clang.mk')
-rw-r--r--mk/compiler/clang.mk13
1 files changed, 12 insertions, 1 deletions
diff --git a/mk/compiler/clang.mk b/mk/compiler/clang.mk
index e8233d697ee..66625977c30 100644
--- a/mk/compiler/clang.mk
+++ b/mk/compiler/clang.mk
@@ -1,4 +1,4 @@
-# $NetBSD: clang.mk,v 1.34 2022/01/30 13:07:34 wiz Exp $
+# $NetBSD: clang.mk,v 1.35 2022/03/13 06:26:57 nia Exp $
#
# This is the compiler definition for the clang compiler.
#
@@ -78,6 +78,17 @@ CWRAPPERS_PREPEND.cc+= ${_RELRO_LDFLAGS}
CWRAPPERS_PREPEND.cxx+= ${_RELRO_LDFLAGS}
.endif
+.if ${_PKGSRC_MKPIE} == "yes"
+_MKPIE_CFLAGS.clang= -fPIC
+_MKPIE_LDFLAGS= -pie
+
+. if ${PKGSRC_OVERRIDE_MKPIE:tl} == "no"
+CFLAGS+= ${_MKPIE_CFLAGS.clang}
+CWRAPPERS_APPEND.cc+= ${_MKPIE_CFLAGS.clang}
+CWRAPPERS_APPEND.cxx+= ${_MKPIE_CFLAGS.clang}
+. endif
+.endif
+
LDFLAGS+= ${_CLANG_LDFLAGS}
# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the