summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2013-05-27 17:57:01 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-05-28 02:56:36 +0200
commit4e76a77f622f1fa30a8ae1e011d87fc9754e1b85 (patch)
tree3b5dc02193662ed8bb119f5fd0300bc2623bed74 /buildtools
parentd47c1245788505cfaca9a25c855a2503c83e4315 (diff)
downloadsamba-4e76a77f622f1fa30a8ae1e011d87fc9754e1b85.tar.gz
samba-4e76a77f622f1fa30a8ae1e011d87fc9754e1b85.tar.bz2
samba-4e76a77f622f1fa30a8ae1e011d87fc9754e1b85.zip
waf: build position independent executables
This patch re-instates support for building Position Independent Executables using the '-fPIE' and '-pie' compiler and linker flags respectively. PIE builds are enabled by default, and can be explicitly disabled using the '--without-pie' configure argument. Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue May 28 02:56:36 CEST 2013 on sn-devel-104
Diffstat (limited to 'buildtools')
-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']: