subversion/subversion-1.9.0-pie.patch

90 lines
3.4 KiB
Diff
Raw Normal View History

Link executables using -pie, link test executables using -no-install.
diff -uap subversion-1.9.0/build.conf.pie subversion-1.9.0/build.conf
diff -uap subversion-1.9.0/build.conf.pie subversion-1.9.0/build.conf
diff -uap subversion-1.9.0/build.conf.pie subversion-1.9.0/build.conf
--- subversion-1.9.0/build.conf.pie
+++ subversion-1.9.0/build.conf
@@ -743,7 +743,7 @@ libs = libsvncxxhl libgmock libsvn_subr
sources = tests/*.cpp
install = tests
compile-cmd = $(COMPILE_CXXHL_GMOCK_CXX)
-link-cmd = $(LINK_CXX)
+link-cmd = $(LINK_TEST_CXX)
# ----------------------------------------------------------------------------
@@ -760,7 +760,7 @@ sources = gmock-gtest-all.cc
install = tests
msvc-static = yes
compile-cmd = $(COMPILE_GMOCK_CXX)
-link-cmd = $(LINK_CXX_LIB)
+link-cmd = $(LINK_TEST_CXX_LIB)
# ----------------------------------------------------------------------------
#
@@ -775,6 +775,7 @@ install = test
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.9.0/build/generator/gen_base.py.pie subversion-1.9.0/build/generator/gen_base.py
--- subversion-1.9.0/build/generator/gen_base.py.pie
+++ subversion-1.9.0/build/generator/gen_base.py
@@ -585,7 +585,7 @@ class TargetLinked(Target):
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')
@@ -644,6 +644,14 @@ class TargetExe(TargetLinked):
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.link_cmd == '$(LINK_LIB)':
+ # Over-ride the default for TargetLinked.
+ self.link_cmd = '$(LINK_EXE)'
+ elif self.link_cmd not in ['$(LINK_TEST_CXX)', ]:
+ raise GenError('ERROR: Unknown executable link type for ' + self.name + ': ' + self.link_cmd)
+
def add_dependencies(self):
TargetLinked.add_dependencies(self)
diff -uap subversion-1.9.0/Makefile.in.pie subversion-1.9.0/Makefile.in
--- subversion-1.9.0/Makefile.in.pie
+++ subversion-1.9.0/Makefile.in
@@ -259,6 +259,11 @@ LINK = $(LIBTOOL) $(LTFLAGS) --mode=link
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)
@@ -753,10 +758,10 @@ schema-clean:
$(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 $<