diff mbox

libgo patch committed: Use __USER_LABEL_PREFIX__ for asm symbols

Message ID mcry5fi8ixw.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 24, 2013, 7:44 p.m. UTC
This patch from minux changes libgo to use __USER_LABEL_PREFIX__ for all
asm symbols.  This is a necessary step for Darwin support.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

https://codereview.appspot.com/7086062/

Ian
diff mbox

Patch

diff -r 246ddf77db61 libgo/go/bytes/indexbyte.c
--- a/libgo/go/bytes/indexbyte.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/go/bytes/indexbyte.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 @@ 
 /* 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 -r 246ddf77db61 libgo/go/log/syslog/syslog_c.c
--- a/libgo/go/log/syslog/syslog_c.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/go/log/syslog/syslog_c.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/go/sync/atomic/atomic.c
--- a/libgo/go/sync/atomic/atomic.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/go/sync/atomic/atomic.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 @@ 
 }
 
 _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 @@ 
 }
 
 _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 @@ 
 }
 
 _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 @@ 
 }
 
 _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 @@ 
 }
 
 _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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 void *LoadPointer (void **addr)
-  asm ("sync_atomic.LoadPointer");
+  __asm__ (GOSYM_PREFIX "sync_atomic.LoadPointer");
 
 void *
 LoadPointer (void **addr)
@@ -190,7 +192,7 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 void StorePointer (void **addr, void *val)
-  asm ("sync_atomic.StorePointer");
+  __asm__ (GOSYM_PREFIX "sync_atomic.StorePointer");
 
 void
 StorePointer (void **addr, void *val)
diff -r 246ddf77db61 libgo/go/sync/cas.c
--- a/libgo/go/sync/cas.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/go/sync/cas.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/go/syscall/errno.c
--- a/libgo/go/syscall/errno.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/go/syscall/errno.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/go/syscall/signame.c
--- a/libgo/go/syscall/signame.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/go/syscall/signame.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/go/syscall/wait.c
--- a/libgo/go/syscall/wait.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/go/syscall/wait.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 @@ 
 }
 
 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 -r 246ddf77db61 libgo/runtime/chan.c
--- a/libgo/runtime/chan.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/chan.c	Thu Jan 24 11:41:35 2013 -0800
@@ -118,7 +118,7 @@ 
 // 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 @@ 
 }
 
 _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 @@ 
 // 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 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 @@ 
 
 // 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 @@ 
 // 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 @@ 
 // 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 @@ 
 // 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 @@ 
 
 // 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 @@ 
 
 // 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 @@ 
 // 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 @@ 
 // 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 @@ 
 // 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 @@ 
 // 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 -r 246ddf77db61 libgo/runtime/cpuprof.c
--- a/libgo/runtime/cpuprof.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/cpuprof.c	Thu Jan 24 11:41:35 2013 -0800
@@ -125,7 +125,7 @@ 
 }
 
 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 @@ 
 }
 
 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 -r 246ddf77db61 libgo/runtime/env_posix.c
--- a/libgo/runtime/env_posix.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/env_posix.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/runtime/go-breakpoint.c
--- a/libgo/runtime/go-breakpoint.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-breakpoint.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/runtime/go-caller.c
--- a/libgo/runtime/go-caller.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-caller.c	Thu Jan 24 11:41:35 2013 -0800
@@ -156,9 +156,9 @@ 
   _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
 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 -r 246ddf77db61 libgo/runtime/go-callers.c
--- a/libgo/runtime/go-callers.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-callers.c	Thu Jan 24 11:41:35 2013 -0800
@@ -60,7 +60,7 @@ 
 }
 
 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 -r 246ddf77db61 libgo/runtime/go-cgo.c
--- a/libgo/runtime/go-cgo.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-cgo.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 @@ 
 }
 
 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 @@ 
 
 /* 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 -r 246ddf77db61 libgo/runtime/go-fieldtrack.c
--- a/libgo/runtime/go-fieldtrack.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-fieldtrack.c	Thu Jan 24 11:41:35 2013 -0800
@@ -34,7 +34,7 @@ 
 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 -r 246ddf77db61 libgo/runtime/go-getgoroot.c
--- a/libgo/runtime/go-getgoroot.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-getgoroot.c	Thu Jan 24 11:41:35 2013 -0800
@@ -8,7 +8,7 @@ 
 
 #include "runtime.h"
 
-String getgoroot (void) asm ("runtime.getgoroot");
+String getgoroot (void) __asm__ (GOSYM_PREFIX "runtime.getgoroot");
 
 String
 getgoroot ()
diff -r 246ddf77db61 libgo/runtime/go-now.c
--- a/libgo/runtime/go-now.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-now.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 now()
-  __asm__ ("time.now")
+  __asm__ (GOSYM_PREFIX "time.now")
   __attribute__ ((no_split_stack));
 
 struct time_now_ret
diff -r 246ddf77db61 libgo/runtime/go-reflect-map.c
--- a/libgo/runtime/go-reflect-map.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-reflect-map.c	Thu Jan 24 11:41:35 2013 -0800
@@ -24,7 +24,7 @@ 
 
 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 @@ 
 
 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 @@ 
 }
 
 extern int32_t maplen (uintptr_t)
-  asm ("reflect.maplen");
+  __asm__ (GOSYM_PREFIX "reflect.maplen");
 
 int32_t
 maplen (uintptr_t m)
@@ -131,7 +131,7 @@ 
 }
 
 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 @@ 
 }
 
 extern void mapiternext (unsigned char *)
-  asm ("reflect.mapiternext");
+  __asm__ (GOSYM_PREFIX "reflect.mapiternext");
 
 void
 mapiternext (unsigned char *it)
@@ -160,7 +160,7 @@ 
 };
 
 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 @@ 
 /* 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 -r 246ddf77db61 libgo/runtime/go-setenv.c
--- a/libgo/runtime/go-setenv.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-setenv.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/runtime/go-signal.c
--- a/libgo/runtime/go-signal.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-signal.c	Thu Jan 24 11:41:35 2013 -0800
@@ -457,7 +457,7 @@ 
 
 /* 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 -r 246ddf77db61 libgo/runtime/go-typestring.c
--- a/libgo/runtime/go-typestring.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-typestring.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/runtime/go-unsafe-new.c
--- a/libgo/runtime/go-unsafe-new.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-unsafe-new.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/runtime/go-unsafe-newarray.c
--- a/libgo/runtime/go-unsafe-newarray.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-unsafe-newarray.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 -r 246ddf77db61 libgo/runtime/go-unsafe-pointer.c
--- a/libgo/runtime/go-unsafe-pointer.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/go-unsafe-pointer.c	Thu Jan 24 11:41:35 2013 -0800
@@ -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 @@ 
    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 -r 246ddf77db61 libgo/runtime/goc2c.c
--- a/libgo/runtime/goc2c.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/goc2c.c	Thu Jan 24 11:41:35 2013 -0800
@@ -488,7 +488,7 @@ 
 	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 -r 246ddf77db61 libgo/runtime/lfstack.c
--- a/libgo/runtime/lfstack.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/lfstack.c	Thu Jan 24 11:41:35 2013 -0800
@@ -57,7 +57,7 @@ 
 }
 
 LFNode* runtime_lfstackpop2(uint64*)
-  asm("runtime.lfstackpop2");
+  __asm__ (GOSYM_PREFIX "runtime.lfstackpop2");
 
 LFNode*
 runtime_lfstackpop2(uint64 *head)
diff -r 246ddf77db61 libgo/runtime/malloc.goc
--- a/libgo/runtime/malloc.goc	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/malloc.goc	Thu Jan 24 11:41:35 2013 -0800
@@ -23,7 +23,7 @@ 
 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 @@ 
 }
 
 extern uintptr runtime_sizeof_C_MStats
-  __asm__ ("runtime.Sizeof_C_MStats");
+  __asm__ (GOSYM_PREFIX "runtime.Sizeof_C_MStats");
 
 #define MaxArena32 (2U<<30)
 
diff -r 246ddf77db61 libgo/runtime/malloc.h
--- a/libgo/runtime/malloc.h	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/malloc.h	Thu Jan 24 11:41:35 2013 -0800
@@ -247,7 +247,7 @@ 
 };
 
 extern MStats mstats
-  __asm__ ("runtime.VmemStats");
+  __asm__ (GOSYM_PREFIX "runtime.VmemStats");
 
 
 // Size classes.  Computed and initialized by InitSizes.
diff -r 246ddf77db61 libgo/runtime/mgc0.c
--- a/libgo/runtime/mgc0.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/mgc0.c	Thu Jan 24 11:41:35 2013 -0800
@@ -1449,7 +1449,7 @@ 
 }
 
 void runtime_ReadMemStats(MStats *)
-  __asm__("runtime.ReadMemStats");
+  __asm__ (GOSYM_PREFIX "runtime.ReadMemStats");
 
 void
 runtime_ReadMemStats(MStats *stats)
diff -r 246ddf77db61 libgo/runtime/mprof.goc
--- a/libgo/runtime/mprof.goc	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/mprof.goc	Thu Jan 24 11:41:35 2013 -0800
@@ -285,7 +285,7 @@ 
 
 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 -r 246ddf77db61 libgo/runtime/panic.c
--- a/libgo/runtime/panic.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/panic.c	Thu Jan 24 11:41:35 2013 -0800
@@ -106,7 +106,7 @@ 
 	runtime_panic(err);
 }
 
-void runtime_Goexit (void) asm ("runtime.Goexit");
+void runtime_Goexit (void) __asm__ (GOSYM_PREFIX "runtime.Goexit");
 
 void
 runtime_Goexit(void)
diff -r 246ddf77db61 libgo/runtime/parfor.c
--- a/libgo/runtime/parfor.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/parfor.c	Thu Jan 24 11:41:35 2013 -0800
@@ -37,7 +37,7 @@ 
 // 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 @@ 
 // 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 runtime_parforiters(ParFor *, uintptr)
-  asm("runtime.parforiters");
+  __asm__ (GOSYM_PREFIX "runtime.parforiters");
 
 struct parforiters_ret
 runtime_parforiters(ParFor *desc, uintptr tid)
diff -r 246ddf77db61 libgo/runtime/proc.c
--- a/libgo/runtime/proc.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/proc.c	Thu Jan 24 11:41:35 2013 -0800
@@ -503,8 +503,8 @@ 
 		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 @@ 
 /* 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 @@ 
 }
 
 void runtime_testing_exitsyscall(void)
-  __asm__("runtime.exitsyscall");
+  __asm__ (GOSYM_PREFIX "runtime.exitsyscall");
 
 void
 runtime_testing_exitsyscall()
@@ -1609,7 +1609,7 @@ 
 	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 @@ 
 // for testing of callbacks
 
 _Bool runtime_golockedOSThread(void)
-  asm("runtime.golockedOSThread");
+  __asm__ (GOSYM_PREFIX "runtime.golockedOSThread");
 
 _Bool
 runtime_golockedOSThread(void)
@@ -1704,7 +1704,7 @@ 
 }
 
 intgo runtime_NumGoroutine (void)
-  __asm__ ("runtime.NumGoroutine");
+  __asm__ (GOSYM_PREFIX "runtime.NumGoroutine");
 
 intgo
 runtime_NumGoroutine()
diff -r 246ddf77db61 libgo/runtime/runtime.c
--- a/libgo/runtime/runtime.c	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/runtime.c	Thu Jan 24 11:41:35 2013 -0800
@@ -24,8 +24,8 @@ 
 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 @@ 
 }
 
 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 -r 246ddf77db61 libgo/runtime/runtime.h
--- a/libgo/runtime/runtime.h	Thu Jan 24 10:11:42 2013 -0800
+++ b/libgo/runtime/runtime.h	Thu Jan 24 11:41:35 2013 -0800
@@ -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_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 @@ 
  * 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 @@ 
  */
 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 @@ 
 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 @@ 
  * 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 @@ 
 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);