diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
index 3358695..553f5b3 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -123,10 +123,12 @@ class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCCompiler):
             else:
                 # gcc-4 series releases do not support -mno-cygwin option
                 self.set_executables(
-                    compiler='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall',
-                    compiler_so='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes',
-                    linker_exe='gcc -g',
-                    linker_so='gcc -g -shared')
+                    compiler='gcc -march=x86-64 -mtune=generic -DMS_WIN64'
+                             ' -O2 -msse2 -Wall',
+                    compiler_so='gcc -march=x86-64 -mtune=generic -DMS_WIN64'
+                                ' -O2 -msse2 -Wall -Wstrict-prototypes',
+                    linker_exe='gcc',
+                    linker_so='gcc -shared -Wl,-gc-sections -Wl,-s')
         else:
             if self.gcc_version <= "3.0.0":
                 self.set_executables(
@@ -145,10 +147,16 @@ class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCCompiler):
                     linker_so='g++ -mno-cygwin -shared')
             else:
                 # gcc-4 series releases do not support -mno-cygwin option
-                self.set_executables(compiler='gcc -O2 -Wall',
-                                     compiler_so='gcc -O2 -Wall -Wstrict-prototypes',
-                                     linker_exe='g++ ',
-                                     linker_so='g++ -shared')
+                self.set_executables(
+                    compiler='gcc -O2 -march=core2 -mtune=generic'
+                             ' -mfpmath=sse -msse2'
+                             ' -mincoming-stack-boundary=2 -Wall',
+                    compiler_so='gcc -O2 -march=core2 -mtune=generic'
+                                ' -mfpmath=sse -msse2'
+                                ' -mincoming-stack-boundary=2 -Wall'
+                                ' -Wstrict-prototypes',
+                    linker_exe='g++ ',
+                    linker_so='g++ -shared -Wl,-gc-sections -Wl,-s')
         # added for python2.3 support
         # we can't pass it through set_executables because pre 2.2 would fail
         self.compiler_cxx = ['g++']
