Skip to content

Commit

Permalink
Fix _pthread_init illegal instruction by providing a value for ptr_munge
Browse files Browse the repository at this point in the history
through the PTHREAD_PTR_MUNGE_TOKEN environment variable (dummy value)
  • Loading branch information
LouisBrunner committed Feb 14, 2020
1 parent d0b9a44 commit 00c5e39
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions coregrind/m_initimg/initimg-darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ static HChar** setup_client_env ( HChar** origenv, const HChar* toolname)

/* Allocate a new space */
ret = VG_(malloc) ("initimg-darwin.sce.3",
#if DARWIN_VERS >= DARWIN_10_15
sizeof(HChar *) * (envc+3+1)); /* 3 new entries + NULL */
#else
sizeof(HChar *) * (envc+2+1)); /* 2 new entries + NULL */
#endif
/* copy it over */
for (cpp = ret; *origenv; )
Expand Down Expand Up @@ -216,6 +220,10 @@ static HChar** setup_client_env ( HChar** origenv, const HChar* toolname)

ret[envc++] = cp;
}
#if DARWIN_VERS >= DARWIN_10_15
// pthread really wants a non-zero value for ptr_munge
ret[envc++] = "PTHREAD_PTR_MUNGE_TOKEN=0x00000001";
#endif


/* ret[0 .. envc-1] is live now. */
Expand Down

0 comments on commit 00c5e39

Please sign in to comment.