subversion/subversion-1.0.3-pie.patch

61 lines
2.5 KiB
Diff
Raw Normal View History

Build subversion executables as PIEs. Requires a slight jig to
ensure that executables in the test suite are *not* build using
-pie, since that doesn't work when main() is not itself an
object built with -pie.
--- subversion-1.0.4/build/generator/gen_base.py.pie
+++ subversion-1.0.4/build/generator/gen_base.py
@@ -393,6 +393,9 @@
self.manpages = options.get('manpages', '')
self.testing = options.get('testing')
+ if self.install == 'test' or self.install == 'fs-test':
+ self.link_cmd = '$(LINK_TEST)'
+
def add_dependencies(self, graph, cfg, extmap):
TargetLinked.add_dependencies(self, graph, cfg, extmap)
@@ -429,8 +432,11 @@
self.msvc_static = options.get('msvc-static') == 'yes' # is a static lib
self.msvc_fake = options.get('msvc-fake') == 'yes' # has fake target
- ### hmm. this is Makefile-specific
- self.link_cmd = '$(LINK_LIB)'
+ ### more Makefile-specific stuff:
+ if self.install == 'test':
+ self.link_cmd = '$(LINK_TEST_LIB)'
+ else:
+ self.link_cmd = '$(LINK_LIB)'
class TargetApacheMod(TargetLib):
--- subversion-1.0.4/Makefile.in.pie
+++ subversion-1.0.4/Makefile.in
@@ -123,8 +123,9 @@
CPPFLAGS = @CPPFLAGS@ $(EXTRA_CPPFLAGS)
LDFLAGS = @LDFLAGS@ $(EXTRA_LDFLAGS)
-COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES)
-LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE)
+BASE_COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES)
+COMPILE = $(BASE_COMPILE) -fpie
+LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(BASE_COMPILE)
# special compilation for files destined for mod_dav_svn
COMPILE_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(APACHE_INCLUDES) $(INCLUDES) -o $@ -c
@@ -134,8 +135,11 @@
COMPILE_SWIG_JAVA = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_JAVA_INCLUDES) $(INCLUDES) -o $@ -c
COMPILE_SWIG_PL = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_PL_INCLUDES) $(INCLUDES) -o $@ -c
-LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS)
-LINK_LIB = $(LINK) -rpath $(libdir)
+BASE_LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS)
+LINK = $(BASE_LINK) -pie
+LINK_TEST = $(BASE_LINK) -no-install
+LINK_LIB = $(BASE_LINK) -rpath $(libdir)
+LINK_TEST_LIB = $(BASE_LINK)
# special link rule for mod_dav_svn
LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(APACHE_LIBEXECDIR) -avoid-version -module