--- numpy-1.21.2/numpy/distutils/mingw32ccompiler.py.orig 2021-11-10 06:32:17.306962300 +0100 +++ numpy-1.21.2/numpy/distutils/mingw32ccompiler.py 2021-11-10 06:34:08.568379600 +0100 @@ -86,17 +86,23 @@ # Py_ModuleInit4_64, etc... So we add it here if get_build_architecture() == 'AMD64': 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: self.set_executables( - compiler='gcc -O2 -Wall', - compiler_so='gcc -O2 -Wall -Wstrict-prototypes', + 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') + 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++']