1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
[[!meta copyright="Copyright © 2011 Free Software Foundation, Inc."]]
[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]
[[!meta title="Enable Google Go programming (GCC: gccgo)"]]
[[!tag open_issue_gcc]]
Make the [Google Go programming language](http://golang.org/) available on
GNU/Hurd in its [[GCC]] *gccgo* implementation, and enable Hurd-specific
features.
There is a [[!FF_project 263]][[!tag bounty]] on this task.
---
# Part I
First, make the language functional, have its test suite pass without errors.
## Original [[community/GSoC]] Task Description
[[!inline pages=community/gsoc/project_ideas/gccgo feeds=no]]
## Svante's work
Per [[!message-id "1335509732.3707.179.camel@hp.my.own.domain"]], Svante has
been working on this, has some (unpublished) patches, and this was blocked on
[[`getcontext`/`makecontext`/`setcontext`/`swapcontext`|glibc]].
## `getcontext`/`makecontext`/`setcontext`/`swapcontext` usage analysis
In context of [[glibc/t/tls-threadvar]]. Looking at GCC trunk commit
f6568ea476aa52a6e23c6db43b3e240cde55783a (2013-04-26).
The check in `libgo/configure.ac` *whether setcontext clobbers TLS variables*
is invalid on GNU Hurd.
The `*context` functions are used in `libgo/runtime/go-signal.c` and
`libgo/runtime/proc.c`.
`__splitstack_getcontext`, `__splitstack_setcontext`,
`__splitstack_makecontext`, `__splitstack_resetcontext`,
`__splitstack_block_signals_context` are to be provided by libgcc. However, in
said libgo runtime files, they're used only `#ifdef USING_SPLIT_STACK`.
[[I|tschwinge]] would assume that before we can enable split stacks, first
[[open_issues/glibc/t/tls-threadvar]] needs to be fixed.
In `libgo/runtime/proc.c`:`runtime_gogo`, `setcontext` is used to *switch
context to a different goroutine*. TODO.
In `libgo/runtime/proc.c`:`runtime_mcall`, which *save[s] context and call[s]
fn passing g as a parameter*, `getcontext` and `setcontext` are used; this is
only called from `libgo/runtime/proc.c`:`runtime_gosched`. TODO.
In `libgo/runtime/proc.c`:`runtime_tracebackothers`, `getcontext` is used to
*switch context to the goroutine*. TODO.
In `libgo/runtime/proc.c`:`runtime_mstart`, which is *called to start an M*,
`getcontext` is used. TODO.
In `libgo/runtime/proc.c`:`runtime_entersyscall`, which is called when *the
goroutine g is about to enter a system call*, `getcontext` is used to *save the
registers in the g structure so that any pointers held in registers will be
seen by the garbage collector*. Should be fine.
In `libgo/runtime/proc.c`:`__go_go`, `getcontext` and `makecontext` are used.
TODO.
In `libgo/runtime/thread.c`:`runtime_minit`, which is *[c]alled to initialize a
new m (including the bootstrap m)*, `ss.ss_sp` is set to a new stack retrieved
via `libgo/runtime/proc.c:runtime_malg`, which *allocate[s] a new g, with a
stack [...]*, and then `sigaltstack` is called. TODO.
libgo/runtime/go-signal.c: /* We are now running on the stack registered via sigaltstack.
libgo/runtime/go-signal.c: and sigaltstack when the program starts.) */
libgo/runtime/proc.c: vnewg->context.uc_stack.ss_sp = vsp;
libgo/runtime/proc.c: vnewg->context.uc_stack.ss_sp += vspsize;
libgo/runtime/proc.c: vnewg->context.uc_stack.ss_size = vspsize;
Also, in `libgo/runtime/proc.c`:`runtime_newm`, `pthread_attr_setstacksize` is
used, which we also can't support yet, for the same reason.
---
# Part II
Next, Hurd-specific features can be added. Add an interface to the
language/environment for being able to do [[RPC]] calls, in order to program
[[hurd/translator]]s natively in the Google Go programming language.
## Original [[community/GSoC]] Task Description
[[!inline pages=community/gsoc/project_ideas/language_bindings feeds=no]]
|