diff options
author | Andrew Morrow <acm@mongodb.com> | 2021-02-21 13:27:49 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-09 16:40:20 +0000 |
commit | 7dffa59ed57ea54863ac4090eac8a0847d808f5c (patch) | |
tree | cd01b0bb9dbe2dbaf8725a61e8811f6f055badc2 /SConstruct | |
parent | 7dfd7920c9cc023f88813f6146c33c7649acba1f (diff) | |
download | mongo-7dffa59ed57ea54863ac4090eac8a0847d808f5c.tar.gz |
SERVER-55130 Add an experiment for building without frame pointers
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct index 564282f6568..04eaa5bcff5 100644 --- a/SConstruct +++ b/SConstruct @@ -276,6 +276,7 @@ experimental_optimizations = [ 'O3', 'builtin-memcmp', 'fnsi', + 'nofp', 'sandybridge', 'tbaa', 'treevec', @@ -2488,14 +2489,30 @@ if env.TargetOSIs('posix'): ) # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used. - env.Append( CCFLAGS=["-fno-omit-frame-pointer", - "-fasynchronous-unwind-tables", + env.Append( CCFLAGS=["-fasynchronous-unwind-tables", "-ggdb" if not env.TargetOSIs('emscripten') else "-g", "-Wall", "-Wsign-compare", "-Wno-unknown-pragmas", "-Winvalid-pch"] ) + # TODO: At least on x86, glibc as of 2.3.4 will consult the + # .eh_frame info via _Unwind_Backtrace to do backtracing without + # needing the frame pointer, despite what the backtrace man page + # actually says. We should see if we can drop the requirement that + # we use libunwind here. + can_nofp = (env.TargetOSIs('darwin') or use_libunwind) + + # For debug builds with tcmalloc, we need the frame pointer so it can + # record the stack of allocations. + can_nofp &= not (debugBuild and (env['MONGO_ALLOCATOR'] == 'tcmalloc')) + + # Only disable frame pointers if requested + can_nofp &= ("nofp" in selected_experimental_optimizations) + + if not can_nofp: + env.Append(CCFLAGS=["-fno-omit-frame-pointer"]) + if not "tbaa" in selected_experimental_optimizations: env.Append(CCFLAGS=["-fno-strict-aliasing"]) |