Package: ncbi-blast+ / 2.2.29-3

use_pie_for_apps Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Subject: build executables with -fPIE, not -fPIC

* -fPIC is only useful for shared libraries; substitute -fPIE (along
   with -pie at link time) when building executables.

Author: Aaron M. Ucko <ucko@debian.org>
Last-Update: 2012-05-10
--- a/c++/src/build-system/Makefile.app.in
+++ b/c++/src/build-system/Makefile.app.in
@@ -24,8 +24,8 @@
 
 ### C/C++ source file compilation setup
 
-CXXFLAGS_ALL = @f_compile@ $(CXXFLAGS) $(LOCAL_CPPFLAGS) $(CPPFLAGS)
-CFLAGS_ALL   = @f_compile@ $(CFLAGS) $(LOCAL_CPPFLAGS) $(CPPFLAGS)
+CXXFLAGS_ALL = @f_compile@ $(CXXFLAGS:-fPIC=-fPIE) $(LOCAL_CPPFLAGS) $(CPPFLAGS)
+CFLAGS_ALL   = @f_compile@ $(CFLAGS:-fPIC=-fPIE) $(LOCAL_CPPFLAGS) $(CPPFLAGS)
 SOURCES      = @UNIX_SRC@ $(SRC)
 
 ### Standard application build rules
@@ -122,7 +122,7 @@
 else
 $(XAPP): $(XOBJ) $(XLIBDEP)
 	@-$(RM) .$(XAPP).stamp
-	$(LINK_WRAPPER) $(LINK) $(LDFLAGS) $(APP_LDFLAGS) $(XOBJ) $(XOBJ2) $(PRE_LIBS) $(XLIB) $(XAPP_LIBS) @f_outexe@$(XAPP) $(LINK_FILTER)
+	$(LINK_WRAPPER) $(LINK) $(LDFLAGS) $(APP_LDFLAGS) -fPIE -pie $(XOBJ) $(XOBJ2) $(PRE_LIBS) $(XLIB) $(XAPP_LIBS) @f_outexe@$(XAPP) $(LINK_FILTER)
 	$(STRIP) $(XAPP)
 	$(POST_LINK) $(XAPP)
   ifneq "$(BINCOPY)" "@:"