Applied patches from https://codereview.chromium.org/10442019/ to
workaround dangling references when compiling with -g.