Bug 58075 - Unable to build go on ia64-hp-hpux11.31
Summary: Unable to build go on ia64-hp-hpux11.31
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: 4.7.3
: P3 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-04 02:42 UTC by Paul A.
Modified: 2018-07-17 17:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-02-03 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul A. 2013-08-04 02:42:40 UTC
Excuse the lack of further detail, but the message looks pretty self-explanatory.

.../gcc-4.7.3/libgo/runtime/proc.c:114:4: error: #error unknown case for SETCONTEXT_CLOBBERS_TLS

Is this just a case of go not being ready for this platform yet?
Comment 1 Ian Lance Taylor 2013-08-04 18:44:38 UTC
That compilation error means that a configure test detected that the setcontext call modified TLS variables, which should not happen.  That does happen on some older versions of Solaris and NetBSD, and the code in libgo/runtime/proc.c has a workaround for those versions.  Apparently HP/UX also has this bug, and somebody will need to write a workaround there as well.

The test case can be found in libgo/configure.ac, and I've appended it below.  The test case should compile and run and exit with a zero exit status (you may need to provide the -pthread option when compiling and linking, I don't know what HP/UX requires in that regard).  If the program does not exit with a zero status, there is a bug in the implementation of setcontext.  I encourage you to report that bug to HP.

#include <pthread.h>
#include <stdlib.h>
#include <ucontext.h>
#include <unistd.h>

__thread int tls;

static char stack[10 * 1024 * 1024];
static ucontext_t c;

/* Called via makecontext/setcontext.  */

static void
cfn (void)
{
  exit (tls);
}

/* Called via pthread_create.  */

static void *
tfn (void *dummy)
{
  /* The thread should still see this value after calling
     setcontext.  */
  tls = 0;

  setcontext (&c);

  /* The call to setcontext should not return.  */
  abort ();
}

int
main ()
{
  pthread_t tid;

  /* The thread should not see this value.  */
  tls = 1;

  if (getcontext (&c) < 0)
    abort ();

  c.uc_stack.ss_sp = stack;
  c.uc_stack.ss_flags = 0;
  c.uc_stack.ss_size = sizeof stack;
  c.uc_link = NULL;
  makecontext (&c, cfn, 0);

  if (pthread_create (&tid, NULL, tfn, NULL) != 0)
    abort ();

  if (pthread_join (tid, NULL) != 0)
    abort ();

  /* The thread should have called exit.  */
  abort ();
}
Comment 2 Paul A. 2013-08-12 23:48:42 UTC
Thanks, I have sent this on to HP.

Should I report back a patch number, or whatever they end up responding with?
Comment 3 Ian Lance Taylor 2013-08-13 00:00:36 UTC
Yes, please.  Thanks.