Skip to content

Commit

Permalink
DAOS-16251 misc: Debug memory access issues
Browse files Browse the repository at this point in the history
A messy hack (WIP)...

Signed-off-by: Li Wei <[email protected]>
Required-githooks: true
  • Loading branch information
liw committed Aug 6, 2024
1 parent 67ad1d0 commit 8e2a4e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions site_scons/site_tools/compiler_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from SCons.Script import Configure, Exit, GetOption

DESIRED_FLAGS = ['-fstack-usage',
'-fsanitize=address',
'-Wl,-fsanitize=address',
'-fno-omit-frame-pointer',
'-Wno-sign-compare',
'-Wno-unused-parameter',
'-Wno-missing-field-initializers',
Expand All @@ -12,8 +15,8 @@
'-Wno-tautological-constant-out-of-range-compare',
'-Wno-unused-command-line-argument',
'-Wmismatched-dealloc',
'-Wfree-nonheap-object',
'-Wframe-larger-than=4096']
'-Wfree-nonheap-object']
# '-Wframe-larger-than=4096']

# Compiler flags to prevent optimizing out security checks
DESIRED_FLAGS.extend(['-fno-strict-overflow', '-fno-delete-null-pointer-checks', '-fwrapv'])
Expand Down Expand Up @@ -53,6 +56,10 @@ def _base_setup(env):
env.Append(CCFLAGS=['-g', '-Wextra', '-Wshadow', '-Wall', '-fpic'])

env.AppendIfSupported(CCFLAGS=DESIRED_FLAGS)
env.AppendIfSupported(LDFLAGS=['-fsanitize=address'])
env.AppendIfSupported(LINKFLAGS=['-fsanitize=address'])
env.AppendIfSupported(CGO_CFLAGS=['-fsanitize=address'])
env.AppendIfSupported(CGO_LDFLAGS=['-fsanitize=address'])

if '-Wmismatched-dealloc' in env['CCFLAGS']:
env.AppendUnique(CPPDEFINES={'HAVE_DEALLOC': '1'})
Expand Down
4 changes: 3 additions & 1 deletion src/control/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_build_flags(benv):
if is_release_build(benv):
return '-buildmode=pie'
# enable race detector for non-release builds
return '-race'
return ''


def gen_build_id():
Expand Down Expand Up @@ -127,6 +127,8 @@ def scons():
# Sets CGO_LDFLAGS for rpath options
denv.d_add_rpaths("..", True, True)
denv.AppendENVPath("CGO_CFLAGS", denv.subst("$_CPPINCFLAGS"), sep=" ")
denv.AppendENVPath("CGO_CFLAGS", "-fsanitize=address", sep=" ")
denv.AppendENVPath("CGO_LDFLAGS", "-fsanitize=address", sep=" ")
if prereqs.client_requested():
install_go_bin(denv, "daos_agent")
install_go_bin(denv, "dmg", install_man=True)
Expand Down

0 comments on commit 8e2a4e4

Please sign in to comment.