[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Mon May 27 18:57:02 MDT 2013


The branch, master has been updated
       via  4e76a77 waf: build position independent executables
       via  d47c124 waf: add --with[out]-pie configure arguments
      from  1754b52 build: Install smbtar in waf build

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4e76a77f622f1fa30a8ae1e011d87fc9754e1b85
Author: David Disseldorp <ddiss at samba.org>
Date:   Mon May 27 17:57:01 2013 +0200

    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 at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue May 28 02:56:36 CEST 2013 on sn-devel-104

commit d47c1245788505cfaca9a25c855a2503c83e4315
Author: David Disseldorp <ddiss at samba.org>
Date:   Mon May 27 17:57:00 2013 +0200

    waf: add --with[out]-pie configure arguments
    
    The arguments do not currently have any effect.
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/wafsamba.py |   11 +++++++++--
 wscript                         |   11 +++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 2ef68b1..0d407e6 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']:
diff --git a/wscript b/wscript
index 3509939..2ff6c35 100644
--- a/wscript
+++ b/wscript
@@ -56,6 +56,13 @@ def set_options(opt):
                    help='disable AD DC functionality (enables Samba 4 client and Samba 3 code base).',
                    action='store_true', dest='without_ad_dc', default=False)
 
+    opt.add_option('--with-pie',
+                  help=("Build Position Independent Executables (default)"),
+                  action="store_true", dest='enable_pie', default=True)
+    opt.add_option('--without-pie',
+                  help=("Disable Position Independent Executable builds"),
+                  action="store_false", dest='enable_pie')
+
     gr = opt.option_group('developer options')
 
 
@@ -160,6 +167,10 @@ def configure(conf):
     
     conf.SAMBA_CONFIG_H('include/config.h')
 
+    if Options.options.enable_pie == True:
+        conf.check_cc(cflags='-fPIE', ldflags='-pie', mandatory=True,
+                      msg="Checking compiler for PIE support")
+        conf.env['ENABLE_PIE'] = True
 
 def etags(ctx):
     '''build TAGS file using etags'''


-- 
Samba Shared Repository


More information about the samba-cvs mailing list