[PATCH] D88348: [LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 17:57:34 PDT 2020


MaskRay added a comment.

> Since catching stack overflows is not a reliable scenario when using CrashRecoveryContext

I have seen this in a language server. It seems that CrashRecoveryContext does not (correctly) use sigaltstack(). With sigaltstack, we can recover after a stack overflow.
For the stack overflow you observed, how did that happen?

In D88348#2299551 <https://reviews.llvm.org/D88348#2299551>, @rnk wrote:

> I think I'm OK with the functional change, but I think I would prefer not to keep the code that buffers stdout/stderr for the lit test. I think the complexity/size cost outweighs the test benefit.

I share the same feeling. Hope `bufferedStdout` can be avoided



================
Comment at: llvm/lib/Support/CrashRecoveryContext.cpp:447
+#if defined(_WIN32)
+  unsigned Code = ((unsigned)RetCode & 0xF0000000) >> 28;
+  if (Code != 0xC && Code != 8)
----------------
This deserves a comment


================
Comment at: llvm/lib/Support/Process.cpp:24
+#if LLVM_ON_UNIX
+#include <unistd.h> // _exit
+#endif
----------------
_Exit does not require unistd.h


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88348/new/

https://reviews.llvm.org/D88348



More information about the llvm-commits mailing list