This appears to have caused performance regressions, which will need to be investigated.
This reverts commit 0b0284ba21989a0b8377f0a4d1057e3e7cd5fae1.
This reverts commit 4bde728b0eb8d277c8f59bfaf24869da67c68c47.
...via moving it all to linux-only. Clang is picky about flags, and the osx
linker doesn't accept -z flags. Technically, this will likely break
clang-on-linux, but that's not a config that we run and I'll probably end up
fixing it later.
This makes us fully position independant and have a noexec stack. There's a
small chance that the former part of that can interfere with
gdb/corefiles/stackdumps, but we'll handle that if it becomes a problem.
backtrace() gives a list of return addresses, which means that addr2line will
print out the line after the caller. GetStackTrace returns the list of caller
addresses, so the addr2line results should be accurate. The flow profiler was
also changed to use the new backtracing code, so flow profiles will now be
accurate as well. Unfortunately, the abseil code doesn't work on MacOS, so we
still fall back to backtrace() in this case.
For the stack unwinder to work, we must disable -fomit-frame-pointer. This can
result in a small performance penalty, as it effectively reduces the number of
general purpose registers available by one. (I'm also curious if this has
anything to do with the overly frequent "<value optimized out>" messages from
gdb.) If this shows up as a problem, we can make release builds still have
-fomit-frame-pointer, and fall back to backtrace when it's enabled then as
well.