Skip to content

Commit

Permalink
Fixed Compilation issues with ASan (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerjenigeUberMensch authored Jul 16, 2024
1 parent aa13f50 commit cbc21ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ INCLUDES = -I $(SRC_PATH) ${INCS}
# General linker settings
LINK_FLAGS = ${LINKERFLAGS}
# Additional release-specific linker settings
RLINK_FLAGS = -Wl,--strip-all
RLINK_FLAGS = ${LINKRELEASE}
# Additional debug-specific linker settings
DLINK_FLAGS = -Wl,--gc-sections
DLINK_FLAGS = ${LINKDEBUG}
# Destination directory, like a jail or mounted system
DESTDIR = /
# Install path (bin/ is appended automatically)
Expand Down
20 changes: 12 additions & 8 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# compiler
CC = cc
CC = clang

# paths
PREFIX = /usr/local/
Expand All @@ -16,7 +16,7 @@ INCLUDE_LIST = tools include -Ixcb -Ixcb-util -Ixcb-aux -Ixcb-xinerama -Ixcb-eve
INCS = $(foreach dir, ${INCLUDE_LIST}, -I${dir})
#${INCLUDE_INCS} ${TOOLS}
#-lxcb-util -lxcb-icccm -lxcb-keysyms
LIBS = xcb xcb-util xcb-aux xcb-xinerama xcb-event xcb-keysyms xcb-xinput xcb-image
LIBS = xcb xcb-util xcb-aux xcb-xinerama xcb-event xcb-keysyms xcb-xinput xcb-image x11
#x11 xcb xcb-util xcb-aux xcb-xinerama xcb-event xcb-keysyms xcb-xinput xcb-image
#${XCB_INCS} x11

Expand All @@ -28,11 +28,10 @@ DYNAMICLINK= -ldl
SECTIONCODE= -ffunction-sections -fdata-sections
LINKMODE = ${DYNAMICLINK}
MEMFLAGS = -fsanitize=address -fno-omit-frame-pointer
#MEMFLAGS =
DEBUGFLAGS = -ggdb -g ${CCVERSION} ${WARNINGFLAGS} ${INCS} ${CPPFLAGS} ${BINARY} ${SECTIONCODE} ${MEMFLAGS}


WARNINGFLAGS = -pedantic -Wall -Wno-deprecated-declarations -Wshadow -Wuninitialized -Werror=format-security
WARNINGDEFAULT = -pedantic -Wall -Wno-deprecated-declarations -Wshadow -Wuninitialized -Werror=format-security
WARNINGEXTRAS = -Wunreachable-code -Waggregate-return -Wstrict-overflow=5 -Wpointer-arith
WARNINGFLAGS = ${WARNINGDEFAULT} ${WARNINGEXTRAS}

LINKTIMEOPTIMIZATIONS = -flto -flto=auto

Expand All @@ -44,14 +43,19 @@ PRELINKERFLAGS = -fstack-protector-strong -fstack-clash-protection -fpie ${LINKT

# can set higher but function overhead is pretty small so meh
INLINELIMIT = 15
LINKFLAGS = ${LINKMODE} -Wl,--gc-sections,--as-needed,--relax,-z,relro,-z,now,-z,noexecstack,-z,defs,-pie -finline-limit=${INLINELIMIT} ${LINKTIMEOPTIMIZATIONS}
# can conflict with adress sanatizer if used (clang)
NO_SANATIZE_FLAGS = -Wl,-z,relro

LINKFLAGS = ${LINKMODE} -Wl,--as-needed,--relax,-z,now,-z,noexecstack,-z,defs,-pie -finline-limit=${INLINELIMIT} ${LINKTIMEOPTIMIZATIONS}
LINKRELEASE = ${NO_SANATIZE_FLAGS} -Wl,--strip-all
LINKDEBUG = -Wl,--gc-sections ${MEMFLAGS}

BINARY = ${X64}
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L ${XINERAMAFLAGS}
CCFLAGS = ${CCVERSION} ${WARNINGFLAGS} ${INCS} ${CPPFLAGS} ${BINARY} ${PRELINKERFLAGS}
RELEASEFLAGS = ${CCFLAGS}

DEBUG = ${DEBUGFLAGS} -O0
DEBUG = -ggdb -g ${SECTIONCODE} ${MEMFLAGS} -fverbose-asm -O0

SIZE = ${RELEASEFLAGS} -Os

Expand Down

0 comments on commit cbc21ce

Please sign in to comment.