summaryrefslogtreecommitdiff
path: root/config.mak.uname
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-19 16:45:27 +0900
committerJunio C Hamano <gitster@pobox.com>2019-05-19 16:45:27 +0900
commitf42bee7d51af9c339dfad8e854149810c34fb7d3 (patch)
tree3c43bdd991b74706ef32dfa6aeb0a2f3e37c74a2 /config.mak.uname
parentd66da839d87b2d7f678e561ba9a2cb16613ca7b1 (diff)
parentce6a158561f906bfd48ab7a9c7a4c48134844e85 (diff)
downloadgit-f42bee7d51af9c339dfad8e854149810c34fb7d3.tar.gz
Merge branch 'id/windows-dep-aslr'
Allow DEP and ASLR for Windows build to for security hardening. * id/windows-dep-aslr: mingw: enable DEP and ASLR mingw: do not let ld strip relocations
Diffstat (limited to 'config.mak.uname')
-rw-r--r--config.mak.uname8
1 files changed, 8 insertions, 0 deletions
diff --git a/config.mak.uname b/config.mak.uname
index 19ce2f296a..b71688eeb7 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -576,13 +576,21 @@ else
ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
# MSys2
prefix = /usr/
+ # Enable DEP
+ BASIC_LDFLAGS += -Wl,--nxcompat
+ # Enable ASLR (unless debugging)
+ ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
+ BASIC_LDFLAGS += -Wl,--dynamicbase
+ endif
ifeq (MINGW32,$(MSYSTEM))
prefix = /mingw32
HOST_CPU = i686
+ BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
endif
ifeq (MINGW64,$(MSYSTEM))
prefix = /mingw64
HOST_CPU = x86_64
+ BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
else
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware