From 4e76a77f622f1fa30a8ae1e011d87fc9754e1b85 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Mon, 27 May 2013 17:57:01 +0200 Subject: 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 Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Tue May 28 02:56:36 CEST 2013 on sn-devel-104 --- buildtools/wafsamba/wafsamba.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'buildtools/wafsamba') 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']: -- cgit