[PATCH] D70378: [LLD][COFF] Cover usage of LLD as a library

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 12:48:37 PDT 2020


aganea added a comment.

@MaskRay Thanks will do - I still have one last issue I don't understand, maybe you can help?



================
Comment at: lld/tools/lld/lld.cpp:228
+  // usages of `not --crash`.
+  if (*mainRet >= 128)
+    raise(*mainRet - 128);
----------------
MaskRay wrote:
> Signals are numbered from 1 (0 is used as an existence and permission check). Use `> 128`
The test at L33 in lld/test/ELF/lto/ltopasses-custom.ll fails on Linux because below I'm calling `raise(SIGABRT)`, which in theory should return 134. But the control flow then goes to `not`, in `Program.inc`, just after the call to `sys::wait4`. However at that point, the status value is 0x8600 and I don't understand why. If I run lld without LLD_IN_TEST, the `abort()` call for that test is called normally (not in a CrashRecoveryContext) and when reaching the same point after `sys::wait4`, status is 0x86 (134, that is 128+SIGABRT) in that case.
So one case, abort() exits the process, we get 0x86.
The other case, raise(SIGABRT) gets 0x8600.
Any ideas on how to fix this? That was the reason why I used `LLVM_BUILTIN_TRAP` before using `raise`, because it properly returns (137) 128+SIGKILL.
Any ideas?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70378



More information about the llvm-commits mailing list