diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-24 19:44:23 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-24 19:44:23 +0000 |
commit | 9c03884abedea3ebae816f4bb2ac86220f233fb7 (patch) | |
tree | df60a3ed3befa98bc7bd75b2c51377fb20837ea7 | |
parent | 2b139ca67d033ba461ec0b042b9d077313cf585e (diff) | |
download | gcc-9c03884abedea3ebae816f4bb2ac86220f233fb7.tar.gz |
PR go/46986
all: prepend #__USER_LABEL_PREFIX__ to mangled Go symbols
For old-fashioned Darwin.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195438 138bc75d-0d04-0410-961f-82ee72b054a4
35 files changed, 131 insertions, 116 deletions
diff --git a/libgo/go/bytes/indexbyte.c b/libgo/go/bytes/indexbyte.c index 1f4399c446a..cbc7847efe8 100644 --- a/libgo/go/bytes/indexbyte.c +++ b/libgo/go/bytes/indexbyte.c @@ -14,7 +14,7 @@ library function, which shouldn't need much stack space. */ intgo IndexByte (struct __go_open_array, char) - asm ("bytes.IndexByte") + __asm__ (GOSYM_PREFIX "bytes.IndexByte") __attribute__ ((no_split_stack)); intgo @@ -31,7 +31,7 @@ IndexByte (struct __go_open_array s, char b) /* Comparison. */ _Bool Equal (struct __go_open_array a, struct __go_open_array b) - asm ("bytes.Equal") + __asm__ (GOSYM_PREFIX "bytes.Equal") __attribute__ ((no_split_stack)); _Bool diff --git a/libgo/go/log/syslog/syslog_c.c b/libgo/go/log/syslog/syslog_c.c index d79cba3757b..5b33d78288b 100644 --- a/libgo/go/log/syslog/syslog_c.c +++ b/libgo/go/log/syslog/syslog_c.c @@ -12,7 +12,7 @@ can't represent a C varargs function in Go. */ void syslog_c(intgo, const char*) - asm ("log_syslog.syslog_c"); + __asm__ (GOSYM_PREFIX "log_syslog.syslog_c"); void syslog_c (intgo priority, const char *msg) diff --git a/libgo/go/sync/atomic/atomic.c b/libgo/go/sync/atomic/atomic.c index 14bc7895621..32430df2ba2 100644 --- a/libgo/go/sync/atomic/atomic.c +++ b/libgo/go/sync/atomic/atomic.c @@ -6,8 +6,10 @@ #include <stdint.h> +#include "runtime.h" + _Bool CompareAndSwapInt32 (int32_t *, int32_t, int32_t) - asm ("sync_atomic.CompareAndSwapInt32"); + __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapInt32"); _Bool CompareAndSwapInt32 (int32_t *val, int32_t old, int32_t new) @@ -16,7 +18,7 @@ CompareAndSwapInt32 (int32_t *val, int32_t old, int32_t new) } _Bool CompareAndSwapInt64 (int64_t *, int64_t, int64_t) - asm ("sync_atomic.CompareAndSwapInt64"); + __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapInt64"); _Bool CompareAndSwapInt64 (int64_t *val, int64_t old, int64_t new) @@ -25,7 +27,7 @@ CompareAndSwapInt64 (int64_t *val, int64_t old, int64_t new) } _Bool CompareAndSwapUint32 (uint32_t *, uint32_t, uint32_t) - asm ("sync_atomic.CompareAndSwapUint32"); + __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapUint32"); _Bool CompareAndSwapUint32 (uint32_t *val, uint32_t old, uint32_t new) @@ -34,7 +36,7 @@ CompareAndSwapUint32 (uint32_t *val, uint32_t old, uint32_t new) } _Bool CompareAndSwapUint64 (uint64_t *, uint64_t, uint64_t) - asm ("sync_atomic.CompareAndSwapUint64"); + __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapUint64"); _Bool CompareAndSwapUint64 (uint64_t *val, uint64_t old, uint64_t new) @@ -43,7 +45,7 @@ CompareAndSwapUint64 (uint64_t *val, uint64_t old, uint64_t new) } _Bool CompareAndSwapUintptr (uintptr_t *, uintptr_t, uintptr_t) - asm ("sync_atomic.CompareAndSwapUintptr"); + __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapUintptr"); _Bool CompareAndSwapUintptr (uintptr_t *val, uintptr_t old, uintptr_t new) @@ -52,7 +54,7 @@ CompareAndSwapUintptr (uintptr_t *val, uintptr_t old, uintptr_t new) } _Bool CompareAndSwapPointer (void **, void *, void *) - asm ("sync_atomic.CompareAndSwapPointer"); + __asm__ (GOSYM_PREFIX "sync_atomic.CompareAndSwapPointer"); _Bool CompareAndSwapPointer (void **val, void *old, void *new) @@ -61,7 +63,7 @@ CompareAndSwapPointer (void **val, void *old, void *new) } int32_t AddInt32 (int32_t *, int32_t) - asm ("sync_atomic.AddInt32"); + __asm__ (GOSYM_PREFIX "sync_atomic.AddInt32"); int32_t AddInt32 (int32_t *val, int32_t delta) @@ -70,7 +72,7 @@ AddInt32 (int32_t *val, int32_t delta) } uint32_t AddUint32 (uint32_t *, uint32_t) - asm ("sync_atomic.AddUint32"); + __asm__ (GOSYM_PREFIX "sync_atomic.AddUint32"); uint32_t AddUint32 (uint32_t *val, uint32_t delta) @@ -79,7 +81,7 @@ AddUint32 (uint32_t *val, uint32_t delta) } int64_t AddInt64 (int64_t *, int64_t) - asm ("sync_atomic.AddInt64"); + __asm__ (GOSYM_PREFIX "sync_atomic.AddInt64"); int64_t AddInt64 (int64_t *val, int64_t delta) @@ -88,7 +90,7 @@ AddInt64 (int64_t *val, int64_t delta) } uint64_t AddUint64 (uint64_t *, uint64_t) - asm ("sync_atomic.AddUint64"); + __asm__ (GOSYM_PREFIX "sync_atomic.AddUint64"); uint64_t AddUint64 (uint64_t *val, uint64_t delta) @@ -97,7 +99,7 @@ AddUint64 (uint64_t *val, uint64_t delta) } uintptr_t AddUintptr (uintptr_t *, uintptr_t) - asm ("sync_atomic.AddUintptr"); + __asm__ (GOSYM_PREFIX "sync_atomic.AddUintptr"); uintptr_t AddUintptr (uintptr_t *val, uintptr_t delta) @@ -106,7 +108,7 @@ AddUintptr (uintptr_t *val, uintptr_t delta) } int32_t LoadInt32 (int32_t *addr) - asm ("sync_atomic.LoadInt32"); + __asm__ (GOSYM_PREFIX "sync_atomic.LoadInt32"); int32_t LoadInt32 (int32_t *addr) @@ -120,7 +122,7 @@ LoadInt32 (int32_t *addr) } int64_t LoadInt64 (int64_t *addr) - asm ("sync_atomic.LoadInt64"); + __asm__ (GOSYM_PREFIX "sync_atomic.LoadInt64"); int64_t LoadInt64 (int64_t *addr) @@ -134,7 +136,7 @@ LoadInt64 (int64_t *addr) } uint32_t LoadUint32 (uint32_t *addr) - asm ("sync_atomic.LoadUint32"); + __asm__ (GOSYM_PREFIX "sync_atomic.LoadUint32"); uint32_t LoadUint32 (uint32_t *addr) @@ -148,7 +150,7 @@ LoadUint32 (uint32_t *addr) } uint64_t LoadUint64 (uint64_t *addr) - asm ("sync_atomic.LoadUint64"); + __asm__ (GOSYM_PREFIX "sync_atomic.LoadUint64"); uint64_t LoadUint64 (uint64_t *addr) @@ -162,7 +164,7 @@ LoadUint64 (uint64_t *addr) } uintptr_t LoadUintptr (uintptr_t *addr) - asm ("sync_atomic.LoadUintptr"); + __asm__ (GOSYM_PREFIX "sync_atomic.LoadUintptr"); uintptr_t LoadUintptr (uintptr_t *addr) @@ -176,7 +178,7 @@ LoadUintptr (uintptr_t *addr) } void *LoadPointer (void **addr) - asm ("sync_atomic.LoadPointer"); + __asm__ (GOSYM_PREFIX "sync_atomic.LoadPointer"); void * LoadPointer (void **addr) @@ -190,7 +192,7 @@ LoadPointer (void **addr) } void StoreInt32 (int32_t *addr, int32_t val) - asm ("sync_atomic.StoreInt32"); + __asm__ (GOSYM_PREFIX "sync_atomic.StoreInt32"); void StoreInt32 (int32_t *addr, int32_t val) @@ -203,7 +205,7 @@ StoreInt32 (int32_t *addr, int32_t val) } void StoreInt64 (int64_t *addr, int64_t val) - asm ("sync_atomic.StoreInt64"); + __asm__ (GOSYM_PREFIX "sync_atomic.StoreInt64"); void StoreInt64 (int64_t *addr, int64_t val) @@ -216,7 +218,7 @@ StoreInt64 (int64_t *addr, int64_t val) } void StoreUint32 (uint32_t *addr, uint32_t val) - asm ("sync_atomic.StoreUint32"); + __asm__ (GOSYM_PREFIX "sync_atomic.StoreUint32"); void StoreUint32 (uint32_t *addr, uint32_t val) @@ -229,7 +231,7 @@ StoreUint32 (uint32_t *addr, uint32_t val) } void StoreUint64 (uint64_t *addr, uint64_t val) - asm ("sync_atomic.StoreUint64"); + __asm__ (GOSYM_PREFIX "sync_atomic.StoreUint64"); void StoreUint64 (uint64_t *addr, uint64_t val) @@ -242,7 +244,7 @@ StoreUint64 (uint64_t *addr, uint64_t val) } void StoreUintptr (uintptr_t *addr, uintptr_t val) - asm ("sync_atomic.StoreUintptr"); + __asm__ (GOSYM_PREFIX "sync_atomic.StoreUintptr"); void StoreUintptr (uintptr_t *addr, uintptr_t val) @@ -255,7 +257,7 @@ StoreUintptr (uintptr_t *addr, uintptr_t val) } void StorePointer (void **addr, void *val) - asm ("sync_atomic.StorePointer"); + __asm__ (GOSYM_PREFIX "sync_atomic.StorePointer"); void StorePointer (void **addr, void *val) diff --git a/libgo/go/sync/cas.c b/libgo/go/sync/cas.c index ffcd133cb3a..7571c64ddc4 100644 --- a/libgo/go/sync/cas.c +++ b/libgo/go/sync/cas.c @@ -6,7 +6,9 @@ #include <stdint.h> -_Bool cas (int32_t *, int32_t, int32_t) asm ("libgo_sync.sync.cas"); +#include "runtime.h" + +_Bool cas (int32_t *, int32_t, int32_t) __asm__ (GOSYM_PREFIX "libgo_sync.sync.cas"); _Bool cas (int32_t *ptr, int32_t old, int32_t new) diff --git a/libgo/go/syscall/errno.c b/libgo/go/syscall/errno.c index d01f4c973d7..5cdc7730445 100644 --- a/libgo/go/syscall/errno.c +++ b/libgo/go/syscall/errno.c @@ -3,15 +3,16 @@ Copyright 2010 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ - #include <errno.h> #include <stdint.h> +#include "runtime.h" + /* errno is typically a macro. These functions set and get errno specific to the libc being used. */ -uintptr_t GetErrno() asm ("syscall.GetErrno"); -void SetErrno(uintptr_t) asm ("syscall.SetErrno"); +uintptr_t GetErrno() __asm__ (GOSYM_PREFIX "syscall.GetErrno"); +void SetErrno(uintptr_t) __asm__ (GOSYM_PREFIX "syscall.SetErrno"); uintptr_t GetErrno() diff --git a/libgo/go/syscall/signame.c b/libgo/go/syscall/signame.c index c2d3b9fac70..6f5c2972bab 100644 --- a/libgo/go/syscall/signame.c +++ b/libgo/go/syscall/signame.c @@ -10,7 +10,7 @@ #include "arch.h" #include "malloc.h" -String Signame (intgo sig) asm ("syscall.Signame"); +String Signame (intgo sig) __asm__ (GOSYM_PREFIX "syscall.Signame"); String Signame (intgo sig) diff --git a/libgo/go/syscall/wait.c b/libgo/go/syscall/wait.c index 98ad245c2c4..8c3b53fa456 100644 --- a/libgo/go/syscall/wait.c +++ b/libgo/go/syscall/wait.c @@ -10,8 +10,10 @@ #include <stdint.h> #include <sys/wait.h> +#include "runtime.h" + extern _Bool Exited (uint32_t *w) - __asm__ ("syscall.Exited.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.Exited.N18_syscall.WaitStatus"); _Bool Exited (uint32_t *w) @@ -20,7 +22,7 @@ Exited (uint32_t *w) } extern _Bool Signaled (uint32_t *w) - __asm__ ("syscall.Signaled.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.Signaled.N18_syscall.WaitStatus"); _Bool Signaled (uint32_t *w) @@ -29,7 +31,7 @@ Signaled (uint32_t *w) } extern _Bool Stopped (uint32_t *w) - __asm__ ("syscall.Stopped.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.Stopped.N18_syscall.WaitStatus"); _Bool Stopped (uint32_t *w) @@ -38,7 +40,7 @@ Stopped (uint32_t *w) } extern _Bool Continued (uint32_t *w) - __asm__ ("syscall.Continued.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.Continued.N18_syscall.WaitStatus"); _Bool Continued (uint32_t *w) @@ -47,7 +49,7 @@ Continued (uint32_t *w) } extern _Bool CoreDump (uint32_t *w) - __asm__ ("syscall.CoreDump.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.CoreDump.N18_syscall.WaitStatus"); _Bool CoreDump (uint32_t *w) @@ -56,7 +58,7 @@ CoreDump (uint32_t *w) } extern int ExitStatus (uint32_t *w) - __asm__ ("syscall.ExitStatus.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.ExitStatus.N18_syscall.WaitStatus"); int ExitStatus (uint32_t *w) @@ -67,7 +69,7 @@ ExitStatus (uint32_t *w) } extern int Signal (uint32_t *w) - __asm__ ("syscall.Signal.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.Signal.N18_syscall.WaitStatus"); int Signal (uint32_t *w) @@ -78,7 +80,7 @@ Signal (uint32_t *w) } extern int StopSignal (uint32_t *w) - __asm__ ("syscall.StopSignal.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.StopSignal.N18_syscall.WaitStatus"); int StopSignal (uint32_t *w) @@ -89,7 +91,7 @@ StopSignal (uint32_t *w) } extern int TrapCause (uint32_t *w) - __asm__ ("syscall.TrapCause.N18_syscall.WaitStatus"); + __asm__ (GOSYM_PREFIX "syscall.TrapCause.N18_syscall.WaitStatus"); int TrapCause (uint32_t *w __attribute__ ((unused))) diff --git a/libgo/runtime/chan.c b/libgo/runtime/chan.c index ceee42c5d6f..a79ee9e18b3 100644 --- a/libgo/runtime/chan.c +++ b/libgo/runtime/chan.c @@ -118,7 +118,7 @@ runtime_makechan_c(ChanType *t, int64 hint) // For reflect // func makechan(typ *ChanType, size uint64) (chan) uintptr reflect_makechan(ChanType *, uint64) - asm ("reflect.makechan"); + __asm__ (GOSYM_PREFIX "reflect.makechan"); uintptr reflect_makechan(ChanType *t, uint64 size) @@ -508,7 +508,7 @@ __go_receive_big(ChanType *t, Hchan* c, byte* p) } _Bool runtime_chanrecv2(ChanType *t, Hchan* c, byte* p) - __asm__("runtime.chanrecv2"); + __asm__ (GOSYM_PREFIX "runtime.chanrecv2"); _Bool runtime_chanrecv2(ChanType *t, Hchan* c, byte* p) @@ -613,7 +613,7 @@ runtime_selectnbrecv2(ChanType *t, byte *v, _Bool *received, Hchan *c) // the actual data if it fits, or else a pointer to the data. _Bool reflect_chansend(ChanType *, Hchan *, uintptr, _Bool) - __asm__("reflect.chansend"); + __asm__ (GOSYM_PREFIX "reflect.chansend"); _Bool reflect_chansend(ChanType *t, Hchan *c, uintptr val, _Bool nb) @@ -650,7 +650,7 @@ struct chanrecv_ret }; struct chanrecv_ret reflect_chanrecv(ChanType *, Hchan *, _Bool) - __asm__("reflect.chanrecv"); + __asm__ (GOSYM_PREFIX "reflect.chanrecv"); struct chanrecv_ret reflect_chanrecv(ChanType *t, Hchan *c, _Bool nb) @@ -686,7 +686,7 @@ static void newselect(int32, Select**); // newselect(size uint32) (sel *byte); -void* runtime_newselect(int32) __asm__("runtime.newselect"); +void* runtime_newselect(int32) __asm__ (GOSYM_PREFIX "runtime.newselect"); void* runtime_newselect(int32 size) @@ -732,7 +732,7 @@ static void selectsend(Select *sel, Hchan *c, int index, void *elem); // selectsend(sel *byte, hchan *chan any, elem *any) (selected bool); void runtime_selectsend(Select *, Hchan *, void *, int32) - __asm__("runtime.selectsend"); + __asm__ (GOSYM_PREFIX "runtime.selectsend"); void runtime_selectsend(Select *sel, Hchan *c, void *elem, int32 index) @@ -772,7 +772,7 @@ static void selectrecv(Select *sel, Hchan *c, int index, void *elem, bool*); // selectrecv(sel *byte, hchan *chan any, elem *any) (selected bool); void runtime_selectrecv(Select *, Hchan *, void *, int32) - __asm__("runtime.selectrecv"); + __asm__ (GOSYM_PREFIX "runtime.selectrecv"); void runtime_selectrecv(Select *sel, Hchan *c, void *elem, int32 index) @@ -787,7 +787,7 @@ runtime_selectrecv(Select *sel, Hchan *c, void *elem, int32 index) // selectrecv2(sel *byte, hchan *chan any, elem *any, received *bool) (selected bool); void runtime_selectrecv2(Select *, Hchan *, void *, bool *, int32) - __asm__("runtime.selectrecv2"); + __asm__ (GOSYM_PREFIX "runtime.selectrecv2"); void runtime_selectrecv2(Select *sel, Hchan *c, void *elem, bool *received, int32 index) @@ -827,7 +827,7 @@ static void selectdefault(Select*, int); // selectdefault(sel *byte) (selected bool); -void runtime_selectdefault(Select *, int32) __asm__("runtime.selectdefault"); +void runtime_selectdefault(Select *, int32) __asm__ (GOSYM_PREFIX "runtime.selectdefault"); void runtime_selectdefault(Select *sel, int32 index) @@ -898,7 +898,7 @@ static int selectgo(Select**); // selectgo(sel *byte); -int runtime_selectgo(Select *) __asm__("runtime.selectgo"); +int runtime_selectgo(Select *) __asm__ (GOSYM_PREFIX "runtime.selectgo"); int runtime_selectgo(Select *sel) @@ -1181,7 +1181,7 @@ struct rselect_ret { // func rselect(cases []runtimeSelect) (chosen int, word uintptr, recvOK bool) struct rselect_ret reflect_rselect(Slice) - asm("reflect.rselect"); + __asm__ (GOSYM_PREFIX "reflect.rselect"); struct rselect_ret reflect_rselect(Slice cases) @@ -1309,7 +1309,7 @@ __go_builtin_close(Hchan *c) // For reflect // func chanclose(c chan) -void reflect_chanclose(uintptr) __asm__("reflect.chanclose"); +void reflect_chanclose(uintptr) __asm__ (GOSYM_PREFIX "reflect.chanclose"); void reflect_chanclose(uintptr c) @@ -1320,7 +1320,7 @@ reflect_chanclose(uintptr c) // For reflect // func chanlen(c chan) (len int) -intgo reflect_chanlen(uintptr) __asm__("reflect.chanlen"); +intgo reflect_chanlen(uintptr) __asm__ (GOSYM_PREFIX "reflect.chanlen"); intgo reflect_chanlen(uintptr ca) @@ -1345,7 +1345,7 @@ __go_chan_len(Hchan *c) // For reflect // func chancap(c chan) (cap intgo) -intgo reflect_chancap(uintptr) __asm__("reflect.chancap"); +intgo reflect_chancap(uintptr) __asm__ (GOSYM_PREFIX "reflect.chancap"); intgo reflect_chancap(uintptr ca) diff --git a/libgo/runtime/cpuprof.c b/libgo/runtime/cpuprof.c index 3b7f572d5a5..3ef08ef5146 100644 --- a/libgo/runtime/cpuprof.c +++ b/libgo/runtime/cpuprof.c @@ -125,7 +125,7 @@ static void LostProfileData(void) { } extern void runtime_SetCPUProfileRate(intgo) - __asm__("runtime.SetCPUProfileRate"); + __asm__ (GOSYM_PREFIX "runtime.SetCPUProfileRate"); // SetCPUProfileRate sets the CPU profiling rate. // The user documentation is in debug.go. @@ -436,7 +436,7 @@ breakflush: } extern Slice runtime_CPUProfile(void) - __asm__("runtime.CPUProfile"); + __asm__ (GOSYM_PREFIX "runtime.CPUProfile"); // CPUProfile returns the next cpu profile block as a []byte. // The user documentation is in debug.go. diff --git a/libgo/runtime/env_posix.c b/libgo/runtime/env_posix.c index 31f41793530..7f3fa0d8e0f 100644 --- a/libgo/runtime/env_posix.c +++ b/libgo/runtime/env_posix.c @@ -7,7 +7,7 @@ #include "runtime.h" #include "array.h" -extern Slice syscall_Envs asm ("syscall.Envs"); +extern Slice syscall_Envs __asm__ (GOSYM_PREFIX "syscall.Envs"); const byte* runtime_getenv(const char *s) diff --git a/libgo/runtime/go-breakpoint.c b/libgo/runtime/go-breakpoint.c index 5eebe188bbe..e403a2a967a 100644 --- a/libgo/runtime/go-breakpoint.c +++ b/libgo/runtime/go-breakpoint.c @@ -6,7 +6,9 @@ #include <sched.h> -void Breakpoint (void) asm ("runtime.Breakpoint"); +#include "runtime.h" + +void Breakpoint (void) __asm__ (GOSYM_PREFIX "runtime.Breakpoint"); void Breakpoint (void) diff --git a/libgo/runtime/go-caller.c b/libgo/runtime/go-caller.c index d73a408334f..63b45f368c2 100644 --- a/libgo/runtime/go-caller.c +++ b/libgo/runtime/go-caller.c @@ -156,9 +156,9 @@ struct caller_ret _Bool ok; }; -struct caller_ret Caller (int n) asm ("runtime.Caller"); +struct caller_ret Caller (int n) __asm__ (GOSYM_PREFIX "runtime.Caller"); -Func *FuncForPC (uintptr_t) asm ("runtime.FuncForPC"); +Func *FuncForPC (uintptr_t) __asm__ (GOSYM_PREFIX "runtime.FuncForPC"); /* Implement runtime.Caller. */ @@ -216,7 +216,7 @@ struct funcline_go_return struct funcline_go_return runtime_funcline_go (Func *f, uintptr targetpc) - __asm__ ("runtime.funcline_go"); + __asm__ (GOSYM_PREFIX "runtime.funcline_go"); struct funcline_go_return runtime_funcline_go (Func *f __attribute__((unused)), uintptr targetpc) diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c index 1dd3e71c8ef..a19e79f053b 100644 --- a/libgo/runtime/go-callers.c +++ b/libgo/runtime/go-callers.c @@ -60,7 +60,7 @@ runtime_callers (int32 skip, uintptr *pcbuf, int32 m) } int Callers (int, struct __go_open_array) - __asm__ ("runtime.Callers"); + __asm__ (GOSYM_PREFIX "runtime.Callers"); int Callers (int skip, struct __go_open_array pc) diff --git a/libgo/runtime/go-cgo.c b/libgo/runtime/go-cgo.c index 47ee014181a..46eb1827a93 100644 --- a/libgo/runtime/go-cgo.c +++ b/libgo/runtime/go-cgo.c @@ -24,10 +24,10 @@ */ /* We let Go code call these via the syscall package. */ -void syscall_cgocall(void) __asm__ ("syscall.Cgocall"); -void syscall_cgocalldone(void) __asm__ ("syscall.CgocallDone"); -void syscall_cgocallback(void) __asm__ ("syscall.CgocallBack"); -void syscall_cgocallbackdone(void) __asm__ ("syscall.CgocallBackDone"); +void syscall_cgocall(void) __asm__ (GOSYM_PREFIX "syscall.Cgocall"); +void syscall_cgocalldone(void) __asm__ (GOSYM_PREFIX "syscall.CgocallDone"); +void syscall_cgocallback(void) __asm__ (GOSYM_PREFIX "syscall.CgocallBack"); +void syscall_cgocallbackdone(void) __asm__ (GOSYM_PREFIX "syscall.CgocallBackDone"); void syscall_cgocall () @@ -119,7 +119,7 @@ _cgo_allocate (size_t n) } extern const struct __go_type_descriptor string_type_descriptor - asm ("__go_tdn_string"); + __asm__ (GOSYM_PREFIX "__go_tdn_string"); void _cgo_panic (const char *p) @@ -152,7 +152,7 @@ _cgo_panic (const char *p) /* Return the number of CGO calls. */ -int64 runtime_NumCgoCall (void) __asm__ ("runtime.NumCgoCall"); +int64 runtime_NumCgoCall (void) __asm__ (GOSYM_PREFIX "runtime.NumCgoCall"); int64 runtime_NumCgoCall (void) diff --git a/libgo/runtime/go-fieldtrack.c b/libgo/runtime/go-fieldtrack.c index 62b36dc7bc0..a7e2c133440 100644 --- a/libgo/runtime/go-fieldtrack.c +++ b/libgo/runtime/go-fieldtrack.c @@ -34,7 +34,7 @@ extern const char _edata[] __attribute__ ((weak)); extern const char __edata[] __attribute__ ((weak)); extern const char __bss_start[] __attribute__ ((weak)); -void runtime_Fieldtrack (struct __go_map *) __asm__ ("runtime.Fieldtrack"); +void runtime_Fieldtrack (struct __go_map *) __asm__ (GOSYM_PREFIX "runtime.Fieldtrack"); void runtime_Fieldtrack (struct __go_map *m) diff --git a/libgo/runtime/go-getgoroot.c b/libgo/runtime/go-getgoroot.c index 3cb447e4ce8..1b52d440438 100644 --- a/libgo/runtime/go-getgoroot.c +++ b/libgo/runtime/go-getgoroot.c @@ -8,7 +8,7 @@ #include "runtime.h" -String getgoroot (void) asm ("runtime.getgoroot"); +String getgoroot (void) __asm__ (GOSYM_PREFIX "runtime.getgoroot"); String getgoroot () diff --git a/libgo/runtime/go-now.c b/libgo/runtime/go-now.c index ede4493b8f3..73cc1602df7 100644 --- a/libgo/runtime/go-now.c +++ b/libgo/runtime/go-now.c @@ -6,6 +6,8 @@ #include <stdint.h> #include <sys/time.h> +#include "runtime.h" + // Return current time. This is the implementation of time.now(). struct time_now_ret @@ -15,7 +17,7 @@ struct time_now_ret }; struct time_now_ret now() - __asm__ ("time.now") + __asm__ (GOSYM_PREFIX "time.now") __attribute__ ((no_split_stack)); struct time_now_ret diff --git a/libgo/runtime/go-reflect-map.c b/libgo/runtime/go-reflect-map.c index 7ef632cfe13..36975374916 100644 --- a/libgo/runtime/go-reflect-map.c +++ b/libgo/runtime/go-reflect-map.c @@ -24,7 +24,7 @@ struct mapaccess_ret extern struct mapaccess_ret mapaccess (struct __go_map_type *, uintptr_t, uintptr_t) - asm ("reflect.mapaccess"); + __asm__ (GOSYM_PREFIX "reflect.mapaccess"); struct mapaccess_ret mapaccess (struct __go_map_type *mt, uintptr_t m, uintptr_t key_i) @@ -77,7 +77,7 @@ mapaccess (struct __go_map_type *mt, uintptr_t m, uintptr_t key_i) extern void mapassign (struct __go_map_type *, uintptr_t, uintptr_t, uintptr_t, _Bool) - asm ("reflect.mapassign"); + __asm__ (GOSYM_PREFIX "reflect.mapassign"); void mapassign (struct __go_map_type *mt, uintptr_t m, uintptr_t key_i, @@ -118,7 +118,7 @@ mapassign (struct __go_map_type *mt, uintptr_t m, uintptr_t key_i, } extern int32_t maplen (uintptr_t) - asm ("reflect.maplen"); + __asm__ (GOSYM_PREFIX "reflect.maplen"); int32_t maplen (uintptr_t m) @@ -131,7 +131,7 @@ maplen (uintptr_t m) } extern unsigned char *mapiterinit (struct __go_map_type *, uintptr_t) - asm ("reflect.mapiterinit"); + __asm__ (GOSYM_PREFIX "reflect.mapiterinit"); unsigned char * mapiterinit (struct __go_map_type *mt, uintptr_t m) @@ -145,7 +145,7 @@ mapiterinit (struct __go_map_type *mt, uintptr_t m) } extern void mapiternext (unsigned char *) - asm ("reflect.mapiternext"); + __asm__ (GOSYM_PREFIX "reflect.mapiternext"); void mapiternext (unsigned char *it) @@ -160,7 +160,7 @@ struct mapiterkey_ret }; extern struct mapiterkey_ret mapiterkey (unsigned char *) - asm ("reflect.mapiterkey"); + __asm__ (GOSYM_PREFIX "reflect.mapiterkey"); struct mapiterkey_ret mapiterkey (unsigned char *ita) @@ -203,7 +203,7 @@ mapiterkey (unsigned char *ita) /* Make a new map. We have to build our own map descriptor. */ extern uintptr_t makemap (const struct __go_map_type *) - asm ("reflect.makemap"); + __asm__ (GOSYM_PREFIX "reflect.makemap"); uintptr_t makemap (const struct __go_map_type *t) diff --git a/libgo/runtime/go-setenv.c b/libgo/runtime/go-setenv.c index 41f14d4b734..53ef2d396d4 100644 --- a/libgo/runtime/go-setenv.c +++ b/libgo/runtime/go-setenv.c @@ -14,7 +14,7 @@ /* Set the C environment from Go. This is called by syscall.Setenv. */ -void setenv_c (String, String) __asm__ ("syscall.setenv_c"); +void setenv_c (String, String) __asm__ (GOSYM_PREFIX "syscall.setenv_c"); void setenv_c (String k, String v) diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index 6ac33d7fc1e..1965e058816 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -457,7 +457,7 @@ runtime_setsig (int32 i, bool def __attribute__ ((unused)), bool restart) /* Used by the os package to raise SIGPIPE. */ -void os_sigpipe (void) __asm__ ("os.sigpipe"); +void os_sigpipe (void) __asm__ (GOSYM_PREFIX "os.sigpipe"); void os_sigpipe (void) diff --git a/libgo/runtime/go-typestring.c b/libgo/runtime/go-typestring.c index 712c333e7cb..0a90e84bc1e 100644 --- a/libgo/runtime/go-typestring.c +++ b/libgo/runtime/go-typestring.c @@ -8,7 +8,7 @@ #include "interface.h" #include "go-type.h" -String typestring(struct __go_empty_interface) asm ("runtime.typestring"); +String typestring(struct __go_empty_interface) __asm__ (GOSYM_PREFIX "runtime.typestring"); String typestring (struct __go_empty_interface e) diff --git a/libgo/runtime/go-unsafe-new.c b/libgo/runtime/go-unsafe-new.c index 8ed52343bfb..54788f19688 100644 --- a/libgo/runtime/go-unsafe-new.c +++ b/libgo/runtime/go-unsafe-new.c @@ -13,7 +13,7 @@ /* Implement unsafe_New, called from the reflect package. */ void *unsafe_New (const struct __go_type_descriptor *) - asm ("reflect.unsafe_New"); + __asm__ (GOSYM_PREFIX "reflect.unsafe_New"); /* The dynamic type of the argument will be a pointer to a type descriptor. */ diff --git a/libgo/runtime/go-unsafe-newarray.c b/libgo/runtime/go-unsafe-newarray.c index 47dcd847e64..e4fb3366bd7 100644 --- a/libgo/runtime/go-unsafe-newarray.c +++ b/libgo/runtime/go-unsafe-newarray.c @@ -13,7 +13,7 @@ /* Implement unsafe_NewArray, called from the reflect package. */ void *unsafe_NewArray (const struct __go_type_descriptor *, intgo) - asm ("reflect.unsafe_NewArray"); + __asm__ (GOSYM_PREFIX "reflect.unsafe_NewArray"); /* The dynamic type of the argument will be a pointer to a type descriptor. */ diff --git a/libgo/runtime/go-unsafe-pointer.c b/libgo/runtime/go-unsafe-pointer.c index e3a55b4dfb2..ca1d2536412 100644 --- a/libgo/runtime/go-unsafe-pointer.c +++ b/libgo/runtime/go-unsafe-pointer.c @@ -15,7 +15,7 @@ descriptor. */ extern const struct __go_type_descriptor unsafe_Pointer - asm ("__go_tdn_unsafe.Pointer"); + __asm__ (GOSYM_PREFIX "__go_tdn_unsafe.Pointer"); /* Used to determine the field alignment. */ struct field_align @@ -61,7 +61,7 @@ const struct __go_type_descriptor unsafe_Pointer = it to be defined elsewhere. */ extern const struct __go_ptr_type pointer_unsafe_Pointer - asm ("__go_td_pN14_unsafe.Pointer"); + __asm__ (GOSYM_PREFIX "__go_td_pN14_unsafe.Pointer"); /* The reflection string. */ #define PREFLECTION "*unsafe.Pointer" diff --git a/libgo/runtime/goc2c.c b/libgo/runtime/goc2c.c index 22295360a4b..f3e8f380928 100644 --- a/libgo/runtime/goc2c.c +++ b/libgo/runtime/goc2c.c @@ -488,7 +488,7 @@ write_gcc_func_header(char *package, char *name, struct params *params, printf(" %s_%s(", package, name); first = 1; write_params(params, &first); - printf(") asm (\""); + printf(") __asm__ (GOSYM_PREFIX \""); if (pkgpath != NULL) printf("%s", pkgpath); else if (prefix != NULL) diff --git a/libgo/runtime/lfstack.c b/libgo/runtime/lfstack.c index c805be8932b..0f8ea6ea6bc 100644 --- a/libgo/runtime/lfstack.c +++ b/libgo/runtime/lfstack.c @@ -57,7 +57,7 @@ runtime_lfstackpop(uint64 *head) } LFNode* runtime_lfstackpop2(uint64*) - asm("runtime.lfstackpop2"); + __asm__ (GOSYM_PREFIX "runtime.lfstackpop2"); LFNode* runtime_lfstackpop2(uint64 *head) diff --git a/libgo/runtime/malloc.goc b/libgo/runtime/malloc.goc index 2a614e5a186..48460b17959 100644 --- a/libgo/runtime/malloc.goc +++ b/libgo/runtime/malloc.goc @@ -23,7 +23,7 @@ MHeap runtime_mheap; extern MStats mstats; // defined in zruntime_def_$GOOS_$GOARCH.go extern volatile intgo runtime_MemProfileRate - __asm__ ("runtime.MemProfileRate"); + __asm__ (GOSYM_PREFIX "runtime.MemProfileRate"); // Allocate an object of at least size bytes. // Small objects are allocated from the per-thread cache's free lists. @@ -308,7 +308,7 @@ runtime_purgecachedstats(MCache *c) } extern uintptr runtime_sizeof_C_MStats - __asm__ ("runtime.Sizeof_C_MStats"); + __asm__ (GOSYM_PREFIX "runtime.Sizeof_C_MStats"); #define MaxArena32 (2U<<30) diff --git a/libgo/runtime/malloc.h b/libgo/runtime/malloc.h index 710484edecf..172d81d5c31 100644 --- a/libgo/runtime/malloc.h +++ b/libgo/runtime/malloc.h @@ -247,7 +247,7 @@ struct MStats }; extern MStats mstats - __asm__ ("runtime.VmemStats"); + __asm__ (GOSYM_PREFIX "runtime.VmemStats"); // Size classes. Computed and initialized by InitSizes. diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c index 698400b0c50..99063653013 100644 --- a/libgo/runtime/mgc0.c +++ b/libgo/runtime/mgc0.c @@ -1449,7 +1449,7 @@ gc(struct gc_args *args) } void runtime_ReadMemStats(MStats *) - __asm__("runtime.ReadMemStats"); + __asm__ (GOSYM_PREFIX "runtime.ReadMemStats"); void runtime_ReadMemStats(MStats *stats) diff --git a/libgo/runtime/mprof.goc b/libgo/runtime/mprof.goc index 8b3a195b890..2cf2afba433 100644 --- a/libgo/runtime/mprof.goc +++ b/libgo/runtime/mprof.goc @@ -285,7 +285,7 @@ runtime_MProf_Free(void *p, uintptr size) int64 runtime_blockprofilerate; // in CPU ticks -void runtime_SetBlockProfileRate(intgo) asm("runtime.SetBlockProfileRate"); +void runtime_SetBlockProfileRate(intgo) __asm__ (GOSYM_PREFIX "runtime.SetBlockProfileRate"); void runtime_SetBlockProfileRate(intgo rate) diff --git a/libgo/runtime/panic.c b/libgo/runtime/panic.c index 1af96392456..85a56087c08 100644 --- a/libgo/runtime/panic.c +++ b/libgo/runtime/panic.c @@ -106,7 +106,7 @@ runtime_panicstring(const char *s) runtime_panic(err); } -void runtime_Goexit (void) asm ("runtime.Goexit"); +void runtime_Goexit (void) __asm__ (GOSYM_PREFIX "runtime.Goexit"); void runtime_Goexit(void) diff --git a/libgo/runtime/parfor.c b/libgo/runtime/parfor.c index 98ebdebc559..591b968c039 100644 --- a/libgo/runtime/parfor.c +++ b/libgo/runtime/parfor.c @@ -37,7 +37,7 @@ runtime_parforalloc(uint32 nthrmax) // func parforalloc2(nthrmax uint32) *ParFor ParFor *runtime_parforalloc2(uint32) - asm("runtime.parforalloc2"); + __asm__ (GOSYM_PREFIX "runtime.parforalloc2"); ParFor * runtime_parforalloc2(uint32 nthrmax) @@ -78,7 +78,7 @@ runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, v // func parforsetup2(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*ParFor, uint32)) void runtime_parforsetup2(ParFor *, uint32, uint32, void *, bool, void *) - asm("runtime.parforsetup2"); + __asm__ (GOSYM_PREFIX "runtime.parforsetup2"); void runtime_parforsetup2(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void *body) @@ -219,7 +219,7 @@ struct parforiters_ret { }; struct parforiters_ret runtime_parforiters(ParFor *, uintptr) - asm("runtime.parforiters"); + __asm__ (GOSYM_PREFIX "runtime.parforiters"); struct parforiters_ret runtime_parforiters(ParFor *desc, uintptr tid) diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 9b229d6bf46..754c68e0bcd 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -503,8 +503,8 @@ runtime_schedinit(void) runtime_raceinit(); } -extern void main_init(void) __asm__ ("__go_init_main"); -extern void main_main(void) __asm__ ("main.main"); +extern void main_init(void) __asm__ (GOSYM_PREFIX "__go_init_main"); +extern void main_main(void) __asm__ (GOSYM_PREFIX "main.main"); // The main goroutine. void @@ -1500,7 +1500,7 @@ runtime_malg(int32 stacksize, byte** ret_stack, size_t* ret_stacksize) /* For runtime package testing. */ void runtime_testing_entersyscall(void) - __asm__("runtime.entersyscall"); + __asm__ (GOSYM_PREFIX "runtime.entersyscall"); void runtime_testing_entersyscall() @@ -1509,7 +1509,7 @@ runtime_testing_entersyscall() } void runtime_testing_exitsyscall(void) - __asm__("runtime.exitsyscall"); + __asm__ (GOSYM_PREFIX "runtime.exitsyscall"); void runtime_testing_exitsyscall() @@ -1609,7 +1609,7 @@ gfget(void) return gp; } -void runtime_Gosched (void) asm ("runtime.Gosched"); +void runtime_Gosched (void) __asm__ (GOSYM_PREFIX "runtime.Gosched"); void runtime_Gosched(void) @@ -1688,7 +1688,7 @@ runtime_lockedOSThread(void) // for testing of callbacks _Bool runtime_golockedOSThread(void) - asm("runtime.golockedOSThread"); + __asm__ (GOSYM_PREFIX "runtime.golockedOSThread"); _Bool runtime_golockedOSThread(void) @@ -1704,7 +1704,7 @@ runtime_mid() } intgo runtime_NumGoroutine (void) - __asm__ ("runtime.NumGoroutine"); + __asm__ (GOSYM_PREFIX "runtime.NumGoroutine"); intgo runtime_NumGoroutine() diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c index ecd804de686..b090169bbb7 100644 --- a/libgo/runtime/runtime.c +++ b/libgo/runtime/runtime.c @@ -24,8 +24,8 @@ runtime_gotraceback(void) static int32 argc; static byte** argv; -extern Slice os_Args asm ("os.Args"); -extern Slice syscall_Envs asm ("syscall.Envs"); +extern Slice os_Args __asm__ (GOSYM_PREFIX "os.Args"); +extern Slice syscall_Envs __asm__ (GOSYM_PREFIX "syscall.Envs"); void (*runtime_sysargs)(int32, uint8**); @@ -172,7 +172,7 @@ runtime_tickspersecond(void) } int64 runtime_pprof_runtime_cyclesPerSecond(void) - asm("runtime_pprof.runtime_cyclesPerSecond"); + __asm__ (GOSYM_PREFIX "runtime_pprof.runtime_cyclesPerSecond"); int64 runtime_pprof_runtime_cyclesPerSecond(void) diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index c5cd3a08f45..4a0ebf2bd04 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -24,6 +24,10 @@ #include "interface.h" #include "go-alloc.h" +#define _STRINGIFY2_(x) #x +#define _STRINGIFY_(x) _STRINGIFY2_(x) +#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) + /* This file supports C files copied from the 6g runtime library. This is a version of the 6g runtime.h rewritten for gccgo's version of the code. */ @@ -387,8 +391,8 @@ void runtime_park(void(*)(Lock*), Lock*, const char*); void runtime_tsleep(int64, const char*); M* runtime_newm(void); void runtime_goexit(void); -void runtime_entersyscall(void) __asm__("syscall.Entersyscall"); -void runtime_exitsyscall(void) __asm__("syscall.Exitsyscall"); +void runtime_entersyscall(void) __asm__ (GOSYM_PREFIX "syscall.Entersyscall"); +void runtime_exitsyscall(void) __asm__ (GOSYM_PREFIX "syscall.Exitsyscall"); void siginit(void); bool __go_sigsend(int32 sig); int32 runtime_callers(int32, uintptr*, int32); @@ -453,7 +457,7 @@ void runtime_futexwakeup(uint32*, uint32); * so they can be garbage collected if there are no other pointers to nodes. */ void runtime_lfstackpush(uint64 *head, LFNode *node) - asm("runtime.lfstackpush"); + __asm__ (GOSYM_PREFIX "runtime.lfstackpush"); LFNode* runtime_lfstackpop(uint64 *head); /* @@ -466,7 +470,7 @@ LFNode* runtime_lfstackpop(uint64 *head); */ ParFor* runtime_parforalloc(uint32 nthrmax); void runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void (*body)(ParFor*, uint32)); -void runtime_parfordo(ParFor *desc) asm("runtime.parfordo"); +void runtime_parfordo(ParFor *desc) __asm__ (GOSYM_PREFIX "runtime.parfordo"); /* * low level C-called @@ -514,7 +518,7 @@ void runtime_printcomplex(__complex double); struct __go_func_type; void reflect_call(const struct __go_func_type *, const void *, _Bool, _Bool, void **, void **) - asm ("reflect.call"); + __asm__ (GOSYM_PREFIX "reflect.call"); /* Functions. */ #define runtime_panic __go_panic @@ -562,11 +566,11 @@ void runtime_usleep(uint32); * runtime c-called (but written in Go) */ void runtime_printany(Eface) - __asm__("runtime.Printany"); + __asm__ (GOSYM_PREFIX "runtime.Printany"); void runtime_newTypeAssertionError(const String*, const String*, const String*, const String*, Eface*) - __asm__("runtime.NewTypeAssertionError"); + __asm__ (GOSYM_PREFIX "runtime.NewTypeAssertionError"); void runtime_newErrorString(String, Eface*) - __asm__("runtime.NewErrorString"); + __asm__ (GOSYM_PREFIX "runtime.NewErrorString"); /* * wrapped for go users @@ -577,8 +581,8 @@ void runtime_semrelease(uint32 volatile *); int32 runtime_gomaxprocsfunc(int32 n); void runtime_procyield(uint32); void runtime_osyield(void); -void runtime_LockOSThread(void) __asm__("runtime.LockOSThread"); -void runtime_UnlockOSThread(void) __asm__("runtime.UnlockOSThread"); +void runtime_LockOSThread(void) __asm__ (GOSYM_PREFIX "runtime.LockOSThread"); +void runtime_UnlockOSThread(void) __asm__ (GOSYM_PREFIX "runtime.UnlockOSThread"); bool runtime_showframe(String); |