Skip to content

Commit ade84c7

Browse files
committed
Merge 'aslr' into HEAD
Address Space Layout Randomization (ASLR) allows executables' memory layout to change at random between runs, and therefore offers a quite decent protection against many attacks. We enable ASLR because MSYS2's C compiler offers support for ASLR, and whatever performance impact it has is neglible, according to https://insights.sei.cmu.edu/cert/2014/02/differences-between-aslr-on-windows-and-linux.html This merges the part of #612 that does not break Git ;-) This fixes #608 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 parents 732106b + cd9d237 commit ade84c7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

config.mak.uname

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,17 @@ else
543543
ifeq ($(shell expr "$(uname_R)" : '2\.'),2)
544544
# MSys2
545545
prefix = /usr/
546+
# Enable DEP
547+
BASIC_LDFLAGS += -Wl,--nxcompat
548+
# Enable ASLR
549+
BASIC_LDFLAGS += -Wl,--dynamicbase
546550
ifeq (MINGW32,$(MSYSTEM))
547551
prefix = /mingw32
552+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
548553
endif
549554
ifeq (MINGW64,$(MSYSTEM))
550555
prefix = /mingw64
556+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
551557
else
552558
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
553559
BASIC_LDFLAGS += -Wl,--large-address-aware

0 commit comments

Comments
 (0)