b585ba
b585ba
Link executables using -pie, link test executables using -no-install.
b585ba
b585ba
diff -uap subversion-1.10.0/build.conf.pie subversion-1.10.0/build.conf
b585ba
--- subversion-1.10.0/build.conf.pie
b585ba
+++ subversion-1.10.0/build.conf
b585ba
@@ -783,6 +783,7 @@
b585ba
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr aprutil apriconv apr
b585ba
 msvc-static = yes
b585ba
 undefined-lib-symbols = yes
b585ba
+link-cmd = $(LINK_TEST_LIB)
b585ba
 
b585ba
 # ----------------------------------------------------------------------------
b585ba
 # Tests for libsvn_fs_base
b585ba
diff -uap subversion-1.10.0/build/generator/gen_base.py.pie subversion-1.10.0/build/generator/gen_base.py
b585ba
--- subversion-1.10.0/build/generator/gen_base.py.pie
b585ba
+++ subversion-1.10.0/build/generator/gen_base.py
b585ba
@@ -599,7 +599,7 @@
b585ba
     self.install = options.get('install')
b585ba
     self.compile_cmd = options.get('compile-cmd')
b585ba
     self.sources = options.get('sources', '*.c *.cpp')
b585ba
-    self.link_cmd = options.get('link-cmd', '$(LINK)')
b585ba
+    self.link_cmd = options.get('link-cmd', '$(LINK_LIB)')
b585ba
 
b585ba
     self.external_lib = options.get('external-lib')
b585ba
     self.external_project = options.get('external-project')
b585ba
@@ -659,6 +659,17 @@
b585ba
 
b585ba
     self.msvc_force_static = options.get('msvc-force-static') == 'yes'
b585ba
 
b585ba
+    if self.install in ['test', 'bdb-test', 'sub-test', ]:
b585ba
+      self.link_cmd = '$(LINK_TEST)'
b585ba
+    elif self.install in ['cxxhl-tests', ]:
b585ba
+      self.link_cmd = '$(LINK_TEST_CXX)'
b585ba
+    elif self.link_cmd == '$(LINK_LIB)':
b585ba
+      # Over-ride the default for TargetLinked.
b585ba
+      self.link_cmd = '$(LINK_EXE)'
b585ba
+    else:
b585ba
+      raise GenError('ERROR: Unknown executable link type for ' + self.name + \
b585ba
+                     ': ' + self.link_cmd + ' (' + self.install + ')')
b585ba
+    
b585ba
   def add_dependencies(self):
b585ba
     TargetLinked.add_dependencies(self)
b585ba
 
b585ba
diff -uap subversion-1.10.0/Makefile.in.pie subversion-1.10.0/Makefile.in
b585ba
--- subversion-1.10.0/Makefile.in.pie
b585ba
+++ subversion-1.10.0/Makefile.in
b585ba
@@ -268,6 +268,11 @@
b585ba
 LINK_LIB = $(LINK) $(LT_SO_VERSION) -rpath $(libdir)
b585ba
 LINK_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS)
b585ba
 LINK_CXX_LIB = $(LINK_CXX) $(LT_SO_VERSION) -rpath $(libdir)
b585ba
+LINK_TEST = $(LINK) -no-install
b585ba
+LINK_TEST_LIB = $(LINK) -avoid-version
b585ba
+LINK_TEST_CXX_LIB = $(LINK_CXX) -avoid-version
b585ba
+LINK_EXE = $(LINK) -pie
b585ba
+LINK_CXX_EXE = $(LINK) -pie
b585ba
 
b585ba
 # special link rule for mod_dav_svn
b585ba
 LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(APACHE_LIBEXECDIR) -avoid-version -module $(APACHE_LDFLAGS) -shared
b585ba
@@ -780,10 +785,10 @@
b585ba
 	$(PYTHON) $(top_srcdir)/build/transform_sql.py $< $(top_srcdir)/$@
b585ba
 
b585ba
 .c.o:
b585ba
-	$(COMPILE) -o $@ -c $<
b585ba
+	$(COMPILE) -fPIE -o $@ -c $<
b585ba
 
b585ba
 .cpp.o:
b585ba
-	$(COMPILE_CXX) -o $@ -c $<
b585ba
+	$(COMPILE_CXX) -fPIE -o $@ -c $<
b585ba
 
b585ba
 .c.lo:
b585ba
 	$(LT_COMPILE) -o $@ -c $<