The Samba-Bugzilla – Attachment 8928 Details for
Bug 9910
PIE builds not supported
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch for 4.0.next
pie_40t.patch (text/plain), 5.95 KB, created by
David Disseldorp
on 2013-05-28 13:41:52 UTC
(
hide
)
Description:
proposed patch for 4.0.next
Filename:
MIME Type:
Creator:
David Disseldorp
Created:
2013-05-28 13:41:52 UTC
Size:
5.95 KB
patch
obsolete
>From de7ff00de56741bbe87c5f2d0f2eed8fc3a229b2 Mon Sep 17 00:00:00 2001 >From: David Disseldorp <ddiss@samba.org> >Date: Mon, 27 May 2013 17:57:00 +0200 >Subject: [PATCH 1/3] waf: add --with[out]-pie configure arguments > >The arguments do not currently have any effect. > >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >--- > wscript | 11 +++++++++++ > 1 file changed, 11 insertions(+) > >diff --git a/wscript b/wscript >index 645deb2..d77f3fa 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') > > opt.add_option('--disable-ntdb', >@@ -168,6 +175,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''' >-- >1.8.1.4 > > >From 27f03d44059a5574dcde463848db281df47105af Mon Sep 17 00:00:00 2001 >From: David Disseldorp <ddiss@samba.org> >Date: Mon, 27 May 2013 17:57:01 +0200 >Subject: [PATCH 2/3] 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 >--- > buildtools/wafsamba/wafsamba.py | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > >diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py >index 3559cc1..46ba35a 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']: >-- >1.8.1.4 > > >From ecaeda0ec530d7b53c8a4c9809519ed845a3d25f Mon Sep 17 00:00:00 2001 >From: David Disseldorp <ddiss@samba.org> >Date: Tue, 28 May 2013 15:00:47 +0200 >Subject: [PATCH 3/3] waf: build PIEs if supported by the compiler > >Currently waf performs a mandatory check for compiler PIE support, >unless --without-pie is specified. >This change makes Waf only perform the mandatory check if --with-pie is >specified. If neither --with-pie nor --without-pie are specified, then >PIEs are only built if compiler support is available. > >Signed-off-by: David Disseldorp <ddiss@samba.org> >--- > wscript | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > >diff --git a/wscript b/wscript >index d77f3fa..2e97745 100644 >--- a/wscript >+++ b/wscript >@@ -57,8 +57,9 @@ def set_options(opt): > 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) >+ help=("Build Position Independent Executables " + >+ "(default if supported by compiler)"), >+ action="store_true", dest='enable_pie') > opt.add_option('--without-pie', > help=("Disable Position Independent Executable builds"), > action="store_false", dest='enable_pie') >@@ -175,10 +176,15 @@ 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 >+ if Options.options.enable_pie != False: >+ if Options.options.enable_pie == True: >+ need_pie = True >+ else: >+ # not specified, only build PIEs if supported by compiler >+ need_pie = False >+ if conf.check_cc(cflags='-fPIE', ldflags='-pie', mandatory=need_pie, >+ msg="Checking compiler for PIE support"): >+ conf.env['ENABLE_PIE'] = True > > def etags(ctx): > '''build TAGS file using etags''' >-- >1.8.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
ab
:
review+
abartlet
:
review+
Actions:
View
Attachments on
bug 9910
: 8928