summaryrefslogtreecommitdiff
path: root/open_issues/gccgo.mdwn
blob: 18be3d93d96ebc90dca6da0538641ec493b7b54b (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
[[!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.


========================

**gccgo manages to get compiled and pass a fair amount of its tests, however its library is failing all but one of its tests.**

Following are the results of the passing suite between the libgo tests run on linux (x86) and the Hurd:

# the Hurd:

    Test Run By root on Fri Jul 12 17:56:44 UTC 2013
    Native configuration is i686-unknown-gnu0.3

		    === libgo tests ===

    Schedule of variations:
        unix

    ...

		    === libgo Summary ===

    # of expected passes		1
    # of unexpected failures	130
    /root/gcc_new/gccbuild/./gcc/gccgo version 4.9.0 20130606 (experimental) (GCC)

# Linux results:

    Test Run By fotis on Τρι 02 Ιούλ 2013 09:20:20 μμ EEST
    Native configuration is i686-pc-linux-gnu

		    === libgo tests ===

    Schedule of variations:
        unix

    ...

		    === libgo Summary ===

    # of expected passes		131
    /home/fotis/Software/gcc_build/./gcc/gccgo version 4.9.0 20130702 (experimental) (GCC)


---


# 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]]