/pidgin/main: d9ebf57cd361: Enable DEP and ASLR flags as well as...

Daniel Atallah datallah at pidgin.im
Thu Sep 6 00:31:12 EDT 2012


Changeset: d9ebf57cd36129f217150f6dd9ffcbfcefd28421
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2012-09-06 04:33 +0100
Branch:	 release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/d9ebf57cd361

Description:

Enable DEP and ASLR flags as well as some other security related compiler flags
for win32 builds. Refs #15290

Thanks goes to Jacob Appelbaum for pointing at the related patch he came up with for pidgin-otr.

diffstat:

 libpurple/plugins/perl/common/Makefile.mingw |   2 +-
 libpurple/win32/global.mak                   |  11 ++++++-----
 pidgin/Makefile.mingw                        |   2 +-
 pidgin/plugins/perl/common/Makefile.mingw    |   2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)

diffs (70 lines):

diff --git a/libpurple/plugins/perl/common/Makefile.mingw b/libpurple/plugins/perl/common/Makefile.mingw
--- a/libpurple/plugins/perl/common/Makefile.mingw
+++ b/libpurple/plugins/perl/common/Makefile.mingw
@@ -112,7 +112,7 @@ install: all
 	$(PERL) -MAutoSplit -e 'autosplit("lib/Purple.pm")'
 
 $(TARGET).dll: $(PURPLE_DLL).a $(PURPLE_PERL_DLL).a $(FALLBACKS) $(OBJECTS)
-	$(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) -o $(TARGET).dll
+	$(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll
 
 ##
 ## CLEAN
diff --git a/libpurple/win32/global.mak b/libpurple/win32/global.mak
--- a/libpurple/win32/global.mak
+++ b/libpurple/win32/global.mak
@@ -57,6 +57,10 @@ PIDGIN_PORTABLE_EXE := $(PIDGIN_TOP)/pid
 
 GCCWARNINGS ?= -Waggregate-return -Wcast-align -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wextra -Wno-sign-compare -Wno-unused-parameter -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef
 
+CC_HARDENING_OPTIONS ?= -Wstack-protector -fwrapv -fno-strict-overflow -Wno-missing-field-initializers -Wformat-security
+LD_HARDENING_OPTIONS ?= -Wl,--dynamicbase -Wl,--nxcompat
+
+
 # parse the version number from the configure.ac file if it is newer
 #m4_define([purple_major_version], [2])
 #m4_define([purple_minor_version], [0])
@@ -84,17 +88,14 @@ endif
 
 DEFINES += -DHAVE_CONFIG_H -DWIN32_LEAN_AND_MEAN
 
-# Use -g flag when building debug version of Pidgin (including plugins).
-# Use -fnative-struct instead of -mms-bitfields when using mingw 1.1
-# (gcc 2.95)
-CFLAGS += -O2 -Wall $(GCCWARNINGS) -pipe -mno-cygwin -mms-bitfields -g
+CFLAGS += -O2 -Wall $(GCCWARNINGS) $(CC_HARDENING_OPTIONS) -pipe -mno-cygwin -mms-bitfields -g
 
 # If not specified, dlls are built with the default base address of 0x10000000.
 # When loaded into a process address space a dll will be rebased if its base
 # address colides with the base address of an existing dll.  To avoid rebasing 
 # we do the following.  Rebasing can slow down the load time of dlls and it
 # also renders debug info useless.
-DLL_LD_FLAGS += -Wl,--enable-auto-image-base
+DLL_LD_FLAGS += -Wl,--enable-auto-image-base $(LD_HARDENING_OPTIONS)
 
 # Build programs
 ifeq "$(origin CC)" "default"
diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw
--- a/pidgin/Makefile.mingw
+++ b/pidgin/Makefile.mingw
@@ -18,7 +18,7 @@ EXE_NAME := $(EXE_TARGET).exe
 
 WINAPP := -mwindows
 
-LDFLAGS := $(WINAPP)
+LDFLAGS := $(WINAPP) $(LD_HARDENING_OPTIONS)
 
 ##
 ## INCLUDE PATHS
diff --git a/pidgin/plugins/perl/common/Makefile.mingw b/pidgin/plugins/perl/common/Makefile.mingw
--- a/pidgin/plugins/perl/common/Makefile.mingw
+++ b/pidgin/plugins/perl/common/Makefile.mingw
@@ -102,7 +102,7 @@ install: all $(PURPLE_INSTALL_PERL_DIR)/
 $(C_FILES): $(PIDGIN_CONFIG_H)
 
 $(TARGET).dll: $(PIDGIN_DLL).a $(PURPLE_PERL_DLL).a $(OBJECTS)
-	$(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) -o $(TARGET).dll
+	$(CC) -shared $(OBJECTS) $(LIB_PATHS) $(DLL_LD_FLAGS) $(LIBS) -o $(TARGET).dll
 
 ##
 ## CLEAN



More information about the Commits mailing list