Skip to content

Commit 6c59cdc

Browse files
committed
runtime: fix solaris build
CL 144830043 changed LibCall for Windows. I didn't realize Solaris used it too. TBR=iant CC=golang-codereviews https://golang.org/cl/142100043
1 parent 2eccf0d commit 6c59cdc

File tree

2 files changed

+50
-50
lines changed

2 files changed

+50
-50
lines changed

src/runtime/os_solaris.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ runtime·semacreate(void)
292292
// Call libc's malloc rather than runtime·malloc. This will
293293
// allocate space on the C heap. We can't call runtime·malloc
294294
// here because it could cause a deadlock.
295-
g->m->libcall.fn = (void*)libc·malloc;
295+
g->m->libcall.fn = (uintptr)(void*)libc·malloc;
296296
g->m->libcall.n = 1;
297297
runtime·memclr((byte*)&g->m->scratch, sizeof(g->m->scratch));
298298
g->m->scratch.v[0] = (uintptr)sizeof(*sem);
299-
g->m->libcall.args = (uintptr*)&g->m->scratch;
299+
g->m->libcall.args = (uintptr)(uintptr*)&g->m->scratch;
300300
runtime·asmcgocall(runtime·asmsysvicall6, &g->m->libcall);
301301
sem = (void*)g->m->libcall.r1;
302302
if(runtime·sem_init(sem, 0, 0) != 0)
@@ -315,12 +315,12 @@ runtime·semasleep(int64 ns)
315315
m->ts.tv_sec = ns / 1000000000LL;
316316
m->ts.tv_nsec = ns % 1000000000LL;
317317

318-
m->libcall.fn = (void*)libc·sem_reltimedwait_np;
318+
m->libcall.fn = (uintptr)(void*)libc·sem_reltimedwait_np;
319319
m->libcall.n = 2;
320320
runtime·memclr((byte*)&m->scratch, sizeof(m->scratch));
321321
m->scratch.v[0] = m->waitsema;
322322
m->scratch.v[1] = (uintptr)&m->ts;
323-
m->libcall.args = (uintptr*)&m->scratch;
323+
m->libcall.args = (uintptr)(uintptr*)&m->scratch;
324324
runtime·asmcgocall(runtime·asmsysvicall6, &m->libcall);
325325
if(*m->perrno != 0) {
326326
if(*m->perrno == ETIMEDOUT || *m->perrno == EAGAIN || *m->perrno == EINTR)
@@ -330,11 +330,11 @@ runtime·semasleep(int64 ns)
330330
return 0;
331331
}
332332
for(;;) {
333-
m->libcall.fn = (void*)libc·sem_wait;
333+
m->libcall.fn = (uintptr)(void*)libc·sem_wait;
334334
m->libcall.n = 1;
335335
runtime·memclr((byte*)&m->scratch, sizeof(m->scratch));
336336
m->scratch.v[0] = m->waitsema;
337-
m->libcall.args = (uintptr*)&m->scratch;
337+
m->libcall.args = (uintptr)(uintptr*)&m->scratch;
338338
runtime·asmcgocall(runtime·asmsysvicall6, &m->libcall);
339339
if(m->libcall.r1 == 0)
340340
break;

src/runtime/syscall_solaris.go

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ var (
3434
//go:nosplit
3535
func syscall_sysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
3636
call := libcall{
37-
fn: unsafe.Pointer(fn),
37+
fn: fn,
3838
n: nargs,
39-
args: unsafe.Pointer(&a1),
39+
args: uintptr(unsafe.Pointer(&a1)),
4040
}
4141
entersyscallblock()
4242
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -47,9 +47,9 @@ func syscall_sysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err
4747
//go:nosplit
4848
func syscall_rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
4949
call := libcall{
50-
fn: unsafe.Pointer(fn),
50+
fn: fn,
5151
n: nargs,
52-
args: unsafe.Pointer(&a1),
52+
args: uintptr(unsafe.Pointer(&a1)),
5353
}
5454
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
5555
return call.r1, call.r2, call.err
@@ -62,9 +62,9 @@ func syscall_rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, e
6262
//go:nosplit
6363
func syscall_chdir(path uintptr) (err uintptr) {
6464
call := libcall{
65-
fn: unsafe.Pointer(&libc_chdir),
65+
fn: uintptr(unsafe.Pointer(&libc_chdir)),
6666
n: 1,
67-
args: unsafe.Pointer(&path),
67+
args: uintptr(unsafe.Pointer(&path)),
6868
}
6969
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
7070
return call.err
@@ -73,9 +73,9 @@ func syscall_chdir(path uintptr) (err uintptr) {
7373
//go:nosplit
7474
func syscall_chroot(path uintptr) (err uintptr) {
7575
call := libcall{
76-
fn: unsafe.Pointer(&libc_chroot),
76+
fn: uintptr(unsafe.Pointer(&libc_chroot)),
7777
n: 1,
78-
args: unsafe.Pointer(&path),
78+
args: uintptr(unsafe.Pointer(&path)),
7979
}
8080
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
8181
return call.err
@@ -89,9 +89,9 @@ func syscall_close(fd int32) int32 {
8989

9090
func syscall_dlopen(name *byte, mode uintptr) (handle uintptr, err uintptr) {
9191
call := libcall{
92-
fn: unsafe.Pointer(&libc_dlopen),
92+
fn: uintptr(unsafe.Pointer(&libc_dlopen)),
9393
n: 2,
94-
args: unsafe.Pointer(&name),
94+
args: uintptr(unsafe.Pointer(&name)),
9595
}
9696
entersyscallblock()
9797
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -104,9 +104,9 @@ func syscall_dlopen(name *byte, mode uintptr) (handle uintptr, err uintptr) {
104104

105105
func syscall_dlclose(handle uintptr) (err uintptr) {
106106
call := libcall{
107-
fn: unsafe.Pointer(&libc_dlclose),
107+
fn: uintptr(unsafe.Pointer(&libc_dlclose)),
108108
n: 1,
109-
args: unsafe.Pointer(&handle),
109+
args: uintptr(unsafe.Pointer(&handle)),
110110
}
111111
entersyscallblock()
112112
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -116,9 +116,9 @@ func syscall_dlclose(handle uintptr) (err uintptr) {
116116

117117
func syscall_dlsym(handle uintptr, name *byte) (proc uintptr, err uintptr) {
118118
call := libcall{
119-
fn: unsafe.Pointer(&libc_dlsym),
119+
fn: uintptr(unsafe.Pointer(&libc_dlsym)),
120120
n: 2,
121-
args: unsafe.Pointer(&handle),
121+
args: uintptr(unsafe.Pointer(&handle)),
122122
}
123123
entersyscallblock()
124124
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -132,9 +132,9 @@ func syscall_dlsym(handle uintptr, name *byte) (proc uintptr, err uintptr) {
132132
//go:nosplit
133133
func syscall_execve(path, argv, envp uintptr) (err uintptr) {
134134
call := libcall{
135-
fn: unsafe.Pointer(&libc_execve),
135+
fn: uintptr(unsafe.Pointer(&libc_execve)),
136136
n: 3,
137-
args: unsafe.Pointer(&path),
137+
args: uintptr(unsafe.Pointer(&path)),
138138
}
139139
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
140140
return call.err
@@ -149,9 +149,9 @@ func syscall_exit(code uintptr) {
149149
//go:nosplit
150150
func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) {
151151
call := libcall{
152-
fn: unsafe.Pointer(&libc_fcntl),
152+
fn: uintptr(unsafe.Pointer(&libc_fcntl)),
153153
n: 3,
154-
args: unsafe.Pointer(&fd),
154+
args: uintptr(unsafe.Pointer(&fd)),
155155
}
156156
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
157157
return call.r1, call.err
@@ -160,9 +160,9 @@ func syscall_fcntl(fd, cmd, arg uintptr) (val, err uintptr) {
160160
//go:nosplit
161161
func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) {
162162
call := libcall{
163-
fn: unsafe.Pointer(&libc_forkx),
163+
fn: uintptr(unsafe.Pointer(&libc_forkx)),
164164
n: 1,
165-
args: unsafe.Pointer(&flags),
165+
args: uintptr(unsafe.Pointer(&flags)),
166166
}
167167
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
168168
return call.r1, call.err
@@ -172,9 +172,9 @@ func syscall_gethostname() (name string, err uintptr) {
172172
cname := new([_MAXHOSTNAMELEN]byte)
173173
var args = [2]uintptr{uintptr(unsafe.Pointer(&cname[0])), _MAXHOSTNAMELEN}
174174
call := libcall{
175-
fn: unsafe.Pointer(&libc_gethostname),
175+
fn: uintptr(unsafe.Pointer(&libc_gethostname)),
176176
n: 2,
177-
args: unsafe.Pointer(&args[0]),
177+
args: uintptr(unsafe.Pointer(&args[0])),
178178
}
179179
entersyscallblock()
180180
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -189,19 +189,19 @@ func syscall_gethostname() (name string, err uintptr) {
189189
//go:nosplit
190190
func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
191191
call := libcall{
192-
fn: unsafe.Pointer(&libc_ioctl),
192+
fn: uintptr(unsafe.Pointer(&libc_ioctl)),
193193
n: 3,
194-
args: unsafe.Pointer(&fd),
194+
args: uintptr(unsafe.Pointer(&fd)),
195195
}
196196
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
197197
return call.err
198198
}
199199

200200
func syscall_pipe() (r, w, err uintptr) {
201201
call := libcall{
202-
fn: unsafe.Pointer(&pipe1),
202+
fn: uintptr(unsafe.Pointer(&pipe1)),
203203
n: 0,
204-
args: unsafe.Pointer(&pipe1), // it's unused but must be non-nil, otherwise crashes
204+
args: uintptr(unsafe.Pointer(&pipe1)), // it's unused but must be non-nil, otherwise crashes
205205
}
206206
entersyscallblock()
207207
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -217,9 +217,9 @@ func syscall_pipe() (r, w, err uintptr) {
217217
// TODO(aram): make this panic once we stop calling fcntl(2) in net using it.
218218
func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
219219
call := libcall{
220-
fn: unsafe.Pointer(&libc_syscall),
220+
fn: uintptr(unsafe.Pointer(&libc_syscall)),
221221
n: 4,
222-
args: unsafe.Pointer(&trap),
222+
args: uintptr(unsafe.Pointer(&trap)),
223223
}
224224
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
225225
return call.r1, call.r2, call.err
@@ -228,9 +228,9 @@ func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
228228
//go:nosplit
229229
func syscall_setgid(gid uintptr) (err uintptr) {
230230
call := libcall{
231-
fn: unsafe.Pointer(&libc_setgid),
231+
fn: uintptr(unsafe.Pointer(&libc_setgid)),
232232
n: 1,
233-
args: unsafe.Pointer(&gid),
233+
args: uintptr(unsafe.Pointer(&gid)),
234234
}
235235
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
236236
return call.err
@@ -239,9 +239,9 @@ func syscall_setgid(gid uintptr) (err uintptr) {
239239
//go:nosplit
240240
func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
241241
call := libcall{
242-
fn: unsafe.Pointer(&libc_setgroups),
242+
fn: uintptr(unsafe.Pointer(&libc_setgroups)),
243243
n: 2,
244-
args: unsafe.Pointer(&ngid),
244+
args: uintptr(unsafe.Pointer(&ngid)),
245245
}
246246
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
247247
return call.err
@@ -250,9 +250,9 @@ func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
250250
//go:nosplit
251251
func syscall_setsid() (pid, err uintptr) {
252252
call := libcall{
253-
fn: unsafe.Pointer(&libc_setsid),
253+
fn: uintptr(unsafe.Pointer(&libc_setsid)),
254254
n: 0,
255-
args: unsafe.Pointer(&libc_setsid), // it's unused but must be non-nil, otherwise crashes
255+
args: uintptr(unsafe.Pointer(&libc_setsid)), // it's unused but must be non-nil, otherwise crashes
256256
}
257257
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
258258
return call.r1, call.err
@@ -261,9 +261,9 @@ func syscall_setsid() (pid, err uintptr) {
261261
//go:nosplit
262262
func syscall_setuid(uid uintptr) (err uintptr) {
263263
call := libcall{
264-
fn: unsafe.Pointer(&libc_setuid),
264+
fn: uintptr(unsafe.Pointer(&libc_setuid)),
265265
n: 1,
266-
args: unsafe.Pointer(&uid),
266+
args: uintptr(unsafe.Pointer(&uid)),
267267
}
268268
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
269269
return call.err
@@ -272,9 +272,9 @@ func syscall_setuid(uid uintptr) (err uintptr) {
272272
//go:nosplit
273273
func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
274274
call := libcall{
275-
fn: unsafe.Pointer(&libc_setpgid),
275+
fn: uintptr(unsafe.Pointer(&libc_setpgid)),
276276
n: 2,
277-
args: unsafe.Pointer(&pid),
277+
args: uintptr(unsafe.Pointer(&pid)),
278278
}
279279
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
280280
return call.err
@@ -288,9 +288,9 @@ func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
288288
// TODO(aram): make this panic once we stop calling fcntl(2) in net using it.
289289
func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
290290
call := libcall{
291-
fn: unsafe.Pointer(&libc_syscall),
291+
fn: uintptr(unsafe.Pointer(&libc_syscall)),
292292
n: 4,
293-
args: unsafe.Pointer(&trap),
293+
args: uintptr(unsafe.Pointer(&trap)),
294294
}
295295
entersyscallblock()
296296
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -300,9 +300,9 @@ func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
300300

301301
func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe.Pointer) (wpid int, err uintptr) {
302302
call := libcall{
303-
fn: unsafe.Pointer(&libc_wait4),
303+
fn: uintptr(unsafe.Pointer(&libc_wait4)),
304304
n: 4,
305-
args: unsafe.Pointer(&pid),
305+
args: uintptr(unsafe.Pointer(&pid)),
306306
}
307307
entersyscallblock()
308308
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
@@ -313,9 +313,9 @@ func syscall_wait4(pid uintptr, wstatus *uint32, options uintptr, rusage unsafe.
313313
//go:nosplit
314314
func syscall_write(fd, buf, nbyte uintptr) (n, err uintptr) {
315315
call := libcall{
316-
fn: unsafe.Pointer(&libc_write),
316+
fn: uintptr(unsafe.Pointer(&libc_write)),
317317
n: 3,
318-
args: unsafe.Pointer(&fd),
318+
args: uintptr(unsafe.Pointer(&fd)),
319319
}
320320
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
321321
return call.r1, call.err

0 commit comments

Comments
 (0)