Can't build Go support in gcc-4.8.1 on OpenBSD

Ian Lance Taylor iant@google.com
Sat Sep 28 20:19:00 GMT 2013


On Sat, Sep 28, 2013 at 1:09 PM, Jędrzej Dudkiewicz
<jedrzej.dudkiewicz@gmail.com> wrote:
> Ian, how would you implement those macros? I'mnot asking for complete
> implementation, just few pointers or hints.

* A header file that declares a struct to hold all the caller-saved
  registers plus the stack pointer and PC.
* getcontext is assembler code that stores the registers into that
  struct.  This is pretty much the same as setjmp.  In particular, it
  returns multiple times.  It should have the GCC returns_twice
  attribute.
* setcontext is assembler code that restores the registers from that
  struct.  This is pretty much the same as longjmp.  It should have
  the GCC noreturn attribute.
* makecontext sets the saved PC to point to the function passed in and
  initializes the stack to look like a call to that function.  gccgo
  does not require the ability to pass arguments to that function.

Probably for gccgo's purposes we can write a slightly cleaner
interface for what gccgo needs, and implement that interface in terms
of the *context functions when no processor-specific implementation is
available.

Ian


> 28 wrz 2013 21:27, "Ian Lance Taylor" <iant@google.com> napisał(a):
>
>> On Sat, Sep 28, 2013 at 12:20 AM, niXman <i.nixman@gmail.com> wrote:
>> >
>> > I successfully build gcc-4.8.1 with c,c++,fortran support on OpenBSD
>> > pre-5.4 using patches from ports, but I can't build with Go support.
>> > Also I successfully build gcc-4.6.x with c,c++,fortran,go support.
>> > The problem is that OpenBSD has no ucontext.h header.
>> >
>> > Error message:
>> > In file included from
>> > ../../../../unpack/gcc-4.8.1/libgo/runtime/go-main.c:17:0:
>> > ../../../../unpack/gcc-4.8.1/libgo/runtime/runtime.h:18:22: fatal
>> > error: ucontext.h: No such file or directory
>> >  #include <ucontext.h>
>> >                       ^
>> > compilation terminated.
>>
>> The current implementation of goroutines in gccgo requires the
>> makecontext, getcontext, and setcontext functions.  Those functions
>> were standardized in POSIX-1.2001 but then removed in POSIX-1.2008
>> with no replacement.  Most systems provide them for backward
>> compatibility.  However, it is possible that OpenBSD does not.  I
>> really don't know.
>>
>> It's possible to fix this by writing processor-dependent functions
>> that would serve the same purpose as the *context functions, and in
>> fact that would be more efficient.  But I have not actually done this.
>>
>> Ian



More information about the Gcc-help mailing list