1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Subject: build executables with -fPIE, not -fPIC
* -fPIC is only useful for shared libraries; substitute -fPIE (to be
accompanied by appropriate APP_LDFLAGS) 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 (and maybe auto-dependencies) build rules
-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)
include $(builddir)/Makefile.$(Rules)
|