Blob Blame History Raw

Link executables using -pie, link test executables using -no-install.

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