Skip to content

Commit 85315b6

Browse files
committed
squash! Enable DEP and ASLR
ASLR interferes with GDB's ability to set breakpoints. A similar issue holds true when compiling with -O2 (in which case single-stepping is messed up because GDB cannot map the code back to the original source code properly). Therefore we simply enable ASLR only when an optimization flag is present in the CFLAGS, using it as an indicator that the developer does not want to debug in GDB anyway. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2d22127 commit 85315b6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

config.mak.uname

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,10 @@ else
546546
prefix = /usr/
547547
# Enable DEP
548548
BASIC_LDFLAGS += -Wl,--nxcompat
549-
# Enable ASLR
550-
BASIC_LDFLAGS += -Wl,--dynamicbase
549+
# Enable ASLR (unless debugging)
550+
ifneq (,$(findstring -O,$(CFLAGS)))
551+
BASIC_LDFLAGS += -Wl,--dynamicbase
552+
endif
551553
ifeq (MINGW32,$(MSYSTEM))
552554
prefix = /mingw32
553555
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup

0 commit comments

Comments
 (0)