Skip to content

Commit

Permalink
[rust] Define FP_XSTATE_MAGIC1 if not defined
Browse files Browse the repository at this point in the history
It looks like on old linux versions (like our dist-x86_64-linux
builder) FP_XSTATE_MAGIC1 is defined only by asm/sigcontext.h,
but not by bits/sigcontext.h. We can't actually include
asm/sigcontext.h, because that would clash with types defined
in bits/sigcontext.h, which gets pulled in via signal.h.

Instead we just replicate the value from the header here.
  • Loading branch information
nikic committed Feb 9, 2022
1 parent c3c82dc commit 6e8f9ab
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ namespace __sanitizer {

unsigned ucontext_t_sz(void *ctx) {
# if SANITIZER_GLIBC && SANITIZER_X64
#ifndef FP_XSTATE_MAGIC1
# define FP_XSTATE_MAGIC1 0x46505853U
#endif
// See kernel arch/x86/kernel/fpu/signal.c for details.
const auto *fpregs = static_cast<ucontext_t *>(ctx)->uc_mcontext.fpregs;
// The member names differ across header versions, but the actual layout
Expand Down

0 comments on commit 6e8f9ab

Please sign in to comment.