Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Compilation issues with ASan #340

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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