summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildtools/wafsamba/wafsamba.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 2ef68b1123..0d407e6a0a 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -342,6 +342,13 @@ def SAMBA_BINARY(bld, binname, source,
else:
subsystem_group = group
+ # only specify PIE flags for binaries
+ pie_cflags = cflags
+ pie_ldflags = TO_LIST(ldflags)
+ if bld.env['ENABLE_PIE'] == True:
+ pie_cflags += ' -fPIE'
+ pie_ldflags.extend(TO_LIST('-pie'))
+
# first create a target for building the object files for this binary
# by separating in this way, we avoid recompiling the C files
# separately for the install binary and the build binary
@@ -349,7 +356,7 @@ def SAMBA_BINARY(bld, binname, source,
source = source,
deps = deps,
includes = includes,
- cflags = cflags,
+ cflags = pie_cflags,
group = subsystem_group,
autoproto = autoproto,
subsystem_name = subsystem_name,
@@ -379,7 +386,7 @@ def SAMBA_BINARY(bld, binname, source,
install_path = None,
samba_inst_path= install_path,
samba_install = install,
- samba_ldflags = TO_LIST(ldflags)
+ samba_ldflags = pie_ldflags
)
if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']: