Commit f3ab5720 by Ian Lance Taylor

libgo: Use -fgo-pkgpath.

From-SVN: r187485
parent 517f1b34
......@@ -22,8 +22,8 @@ Gogo::import_unsafe(const std::string& local_name, bool is_local_name_exported,
bool add_to_globals;
Package* package = this->add_imported_package("unsafe", local_name,
is_local_name_exported,
"libgo_unsafe.unsafe",
location, &add_to_globals);
"unsafe", location,
&add_to_globals);
if (package == NULL)
{
......
......@@ -13,7 +13,7 @@
library function, which shouldn't need much stack space. */
int IndexByte (struct __go_open_array, char)
asm ("libgo_bytes.bytes.IndexByte")
asm ("bytes.IndexByte")
__attribute__ ((no_split_stack));
int
......@@ -30,7 +30,7 @@ IndexByte (struct __go_open_array s, char b)
/* Comparison. */
_Bool Equal (struct __go_open_array a, struct __go_open_array b)
asm ("libgo_bytes.bytes.Equal")
asm ("bytes.Equal")
__attribute__ ((no_split_stack));
_Bool
......
......@@ -726,7 +726,7 @@ var marshalErrorTests = []struct {
},
{
Value: map[*Ship]bool{nil: false},
Err: "xml: unsupported type: map[*xml.Ship]bool",
Err: "xml: unsupported type: map[*encoding/xml.Ship]bool",
Kind: reflect.Map,
},
{
......
......@@ -226,7 +226,7 @@ func TestEscape(t *testing.T) {
{
"badMarshaler",
`<button onclick='alert(1/{{.B}}in numbers)'>`,
`<button onclick='alert(1/ /* json: error calling MarshalJSON for type *template.badMarshaler: invalid character &#39;f&#39; looking for beginning of object key string */null in numbers)'>`,
`<button onclick='alert(1/ /* json: error calling MarshalJSON for type *html/template.badMarshaler: invalid character &#39;f&#39; looking for beginning of object key string */null in numbers)'>`,
},
{
"jsMarshaler",
......
......@@ -1383,7 +1383,7 @@ func TestImportPath(t *testing.T) {
t Type
path string
}{
{TypeOf(&base64.Encoding{}).Elem(), "libgo_encoding.base64"},
{TypeOf(&base64.Encoding{}).Elem(), "encoding/base64"},
{TypeOf(uint(0)), ""},
{TypeOf(map[string]int{}), ""},
{TypeOf((*error)(nil)).Elem(), ""},
......
......@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package regexp
package regexp_test
import (
. "regexp"
"strings"
"testing"
)
......
......@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package regexp
package regexp_test
import (
. "regexp"
"bufio"
"compress/bzip2"
"fmt"
......@@ -219,22 +221,22 @@ var run = []func(*Regexp, *Regexp, string) ([]int, string){
}
func runFull(re, refull *Regexp, text string) ([]int, string) {
refull.longest = false
refull.SetLongest(false)
return refull.FindStringSubmatchIndex(text), "[full]"
}
func runPartial(re, refull *Regexp, text string) ([]int, string) {
re.longest = false
re.SetLongest(false)
return re.FindStringSubmatchIndex(text), ""
}
func runFullLongest(re, refull *Regexp, text string) ([]int, string) {
refull.longest = true
refull.SetLongest(true)
return refull.FindStringSubmatchIndex(text), "[full,longest]"
}
func runPartialLongest(re, refull *Regexp, text string) ([]int, string) {
re.longest = true
re.SetLongest(true)
return re.FindStringSubmatchIndex(text), "[longest]"
}
......@@ -246,22 +248,22 @@ var match = []func(*Regexp, *Regexp, string) (bool, string){
}
func matchFull(re, refull *Regexp, text string) (bool, string) {
refull.longest = false
refull.SetLongest(false)
return refull.MatchString(text), "[full]"
}
func matchPartial(re, refull *Regexp, text string) (bool, string) {
re.longest = false
re.SetLongest(false)
return re.MatchString(text), ""
}
func matchFullLongest(re, refull *Regexp, text string) (bool, string) {
refull.longest = true
refull.SetLongest(true)
return refull.MatchString(text), "[full,longest]"
}
func matchPartialLongest(re, refull *Regexp, text string) (bool, string) {
re.longest = true
re.SetLongest(true)
return re.MatchString(text), "[longest]"
}
......@@ -541,7 +543,7 @@ Reading:
}
}
re, err := compile(pattern, syn, true)
re, err := CompileInternal(pattern, syn, true)
if err != nil {
if shouldCompile {
t.Errorf("%s:%d: %#q did not compile", file, lineno, pattern)
......
// Copyright 2012 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.
package regexp
import "regexp/syntax"
func (re *Regexp) SetLongest(b bool) {
re.longest = b
}
func CompileInternal(expr string, mode syntax.Flags, longest bool) (*Regexp, error) {
return compile(expr, mode, longest)
}
......@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package regexp
package regexp_test
import (
. "regexp"
"fmt"
"strings"
"testing"
......
......@@ -7,7 +7,7 @@
#include <stdint.h>
_Bool CompareAndSwapInt32 (int32_t *, int32_t, int32_t)
asm ("libgo_sync.atomic.CompareAndSwapInt32");
asm ("sync_atomic.CompareAndSwapInt32");
_Bool
CompareAndSwapInt32 (int32_t *val, int32_t old, int32_t new)
......@@ -16,7 +16,7 @@ CompareAndSwapInt32 (int32_t *val, int32_t old, int32_t new)
}
_Bool CompareAndSwapInt64 (int64_t *, int64_t, int64_t)
asm ("libgo_sync.atomic.CompareAndSwapInt64");
asm ("sync_atomic.CompareAndSwapInt64");
_Bool
CompareAndSwapInt64 (int64_t *val, int64_t old, int64_t new)
......@@ -25,7 +25,7 @@ CompareAndSwapInt64 (int64_t *val, int64_t old, int64_t new)
}
_Bool CompareAndSwapUint32 (uint32_t *, uint32_t, uint32_t)
asm ("libgo_sync.atomic.CompareAndSwapUint32");
asm ("sync_atomic.CompareAndSwapUint32");
_Bool
CompareAndSwapUint32 (uint32_t *val, uint32_t old, uint32_t new)
......@@ -34,7 +34,7 @@ CompareAndSwapUint32 (uint32_t *val, uint32_t old, uint32_t new)
}
_Bool CompareAndSwapUint64 (uint64_t *, uint64_t, uint64_t)
asm ("libgo_sync.atomic.CompareAndSwapUint64");
asm ("sync_atomic.CompareAndSwapUint64");
_Bool
CompareAndSwapUint64 (uint64_t *val, uint64_t old, uint64_t new)
......@@ -43,7 +43,7 @@ CompareAndSwapUint64 (uint64_t *val, uint64_t old, uint64_t new)
}
_Bool CompareAndSwapUintptr (uintptr_t *, uintptr_t, uintptr_t)
asm ("libgo_sync.atomic.CompareAndSwapUintptr");
asm ("sync_atomic.CompareAndSwapUintptr");
_Bool
CompareAndSwapUintptr (uintptr_t *val, uintptr_t old, uintptr_t new)
......@@ -52,7 +52,7 @@ CompareAndSwapUintptr (uintptr_t *val, uintptr_t old, uintptr_t new)
}
_Bool CompareAndSwapPointer (void **, void *, void *)
asm ("libgo_sync.atomic.CompareAndSwapPointer");
asm ("sync_atomic.CompareAndSwapPointer");
_Bool
CompareAndSwapPointer (void **val, void *old, void *new)
......@@ -61,7 +61,7 @@ CompareAndSwapPointer (void **val, void *old, void *new)
}
int32_t AddInt32 (int32_t *, int32_t)
asm ("libgo_sync.atomic.AddInt32");
asm ("sync_atomic.AddInt32");
int32_t
AddInt32 (int32_t *val, int32_t delta)
......@@ -70,7 +70,7 @@ AddInt32 (int32_t *val, int32_t delta)
}
uint32_t AddUint32 (uint32_t *, uint32_t)
asm ("libgo_sync.atomic.AddUint32");
asm ("sync_atomic.AddUint32");
uint32_t
AddUint32 (uint32_t *val, uint32_t delta)
......@@ -79,7 +79,7 @@ AddUint32 (uint32_t *val, uint32_t delta)
}
int64_t AddInt64 (int64_t *, int64_t)
asm ("libgo_sync.atomic.AddInt64");
asm ("sync_atomic.AddInt64");
int64_t
AddInt64 (int64_t *val, int64_t delta)
......@@ -88,7 +88,7 @@ AddInt64 (int64_t *val, int64_t delta)
}
uint64_t AddUint64 (uint64_t *, uint64_t)
asm ("libgo_sync.atomic.AddUint64");
asm ("sync_atomic.AddUint64");
uint64_t
AddUint64 (uint64_t *val, uint64_t delta)
......@@ -97,7 +97,7 @@ AddUint64 (uint64_t *val, uint64_t delta)
}
uintptr_t AddUintptr (uintptr_t *, uintptr_t)
asm ("libgo_sync.atomic.AddUintptr");
asm ("sync_atomic.AddUintptr");
uintptr_t
AddUintptr (uintptr_t *val, uintptr_t delta)
......@@ -106,7 +106,7 @@ AddUintptr (uintptr_t *val, uintptr_t delta)
}
int32_t LoadInt32 (int32_t *addr)
asm ("libgo_sync.atomic.LoadInt32");
asm ("sync_atomic.LoadInt32");
int32_t
LoadInt32 (int32_t *addr)
......@@ -120,7 +120,7 @@ LoadInt32 (int32_t *addr)
}
int64_t LoadInt64 (int64_t *addr)
asm ("libgo_sync.atomic.LoadInt64");
asm ("sync_atomic.LoadInt64");
int64_t
LoadInt64 (int64_t *addr)
......@@ -134,7 +134,7 @@ LoadInt64 (int64_t *addr)
}
uint32_t LoadUint32 (uint32_t *addr)
asm ("libgo_sync.atomic.LoadUint32");
asm ("sync_atomic.LoadUint32");
uint32_t
LoadUint32 (uint32_t *addr)
......@@ -148,7 +148,7 @@ LoadUint32 (uint32_t *addr)
}
uint64_t LoadUint64 (uint64_t *addr)
asm ("libgo_sync.atomic.LoadUint64");
asm ("sync_atomic.LoadUint64");
uint64_t
LoadUint64 (uint64_t *addr)
......@@ -162,7 +162,7 @@ LoadUint64 (uint64_t *addr)
}
uintptr_t LoadUintptr (uintptr_t *addr)
asm ("libgo_sync.atomic.LoadUintptr");
asm ("sync_atomic.LoadUintptr");
uintptr_t
LoadUintptr (uintptr_t *addr)
......@@ -176,7 +176,7 @@ LoadUintptr (uintptr_t *addr)
}
void *LoadPointer (void **addr)
asm ("libgo_sync.atomic.LoadPointer");
asm ("sync_atomic.LoadPointer");
void *
LoadPointer (void **addr)
......@@ -190,7 +190,7 @@ LoadPointer (void **addr)
}
void StoreInt32 (int32_t *addr, int32_t val)
asm ("libgo_sync.atomic.StoreInt32");
asm ("sync_atomic.StoreInt32");
void
StoreInt32 (int32_t *addr, int32_t val)
......@@ -203,7 +203,7 @@ StoreInt32 (int32_t *addr, int32_t val)
}
void StoreInt64 (int64_t *addr, int64_t val)
asm ("libgo_sync.atomic.StoreInt64");
asm ("sync_atomic.StoreInt64");
void
StoreInt64 (int64_t *addr, int64_t val)
......@@ -216,7 +216,7 @@ StoreInt64 (int64_t *addr, int64_t val)
}
void StoreUint32 (uint32_t *addr, uint32_t val)
asm ("libgo_sync.atomic.StoreUint32");
asm ("sync_atomic.StoreUint32");
void
StoreUint32 (uint32_t *addr, uint32_t val)
......@@ -229,7 +229,7 @@ StoreUint32 (uint32_t *addr, uint32_t val)
}
void StoreUint64 (uint64_t *addr, uint64_t val)
asm ("libgo_sync.atomic.StoreUint64");
asm ("sync_atomic.StoreUint64");
void
StoreUint64 (uint64_t *addr, uint64_t val)
......@@ -242,7 +242,7 @@ StoreUint64 (uint64_t *addr, uint64_t val)
}
void StoreUintptr (uintptr_t *addr, uintptr_t val)
asm ("libgo_sync.atomic.StoreUintptr");
asm ("sync_atomic.StoreUintptr");
void
StoreUintptr (uintptr_t *addr, uintptr_t val)
......@@ -255,7 +255,7 @@ StoreUintptr (uintptr_t *addr, uintptr_t val)
}
void StorePointer (void **addr, void *val)
asm ("libgo_sync.atomic.StorePointer");
asm ("sync_atomic.StorePointer");
void
StorePointer (void **addr, void *val)
......
......@@ -10,8 +10,8 @@
/* errno is typically a macro. These functions set
and get errno specific to the libc being used. */
uintptr_t GetErrno() asm ("libgo_syscall.syscall.GetErrno");
void SetErrno(uintptr_t) asm ("libgo_syscall.syscall.SetErrno");
uintptr_t GetErrno() asm ("syscall.GetErrno");
void SetErrno(uintptr_t) asm ("syscall.SetErrno");
uintptr_t
GetErrno()
......
......@@ -11,7 +11,7 @@
#include "arch.h"
#include "malloc.h"
String Signame (int sig) asm ("libgo_syscall.syscall.Signame");
String Signame (int sig) asm ("syscall.Signame");
String
Signame (int sig)
......
......@@ -11,7 +11,7 @@
#include <sys/wait.h>
extern _Bool Exited (uint32_t *w)
__asm__ ("libgo_syscall.syscall.Exited.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.Exited.N18_syscall.WaitStatus");
_Bool
Exited (uint32_t *w)
......@@ -20,7 +20,7 @@ Exited (uint32_t *w)
}
extern _Bool Signaled (uint32_t *w)
__asm__ ("libgo_syscall.syscall.Signaled.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.Signaled.N18_syscall.WaitStatus");
_Bool
Signaled (uint32_t *w)
......@@ -29,7 +29,7 @@ Signaled (uint32_t *w)
}
extern _Bool Stopped (uint32_t *w)
__asm__ ("libgo_syscall.syscall.Stopped.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.Stopped.N18_syscall.WaitStatus");
_Bool
Stopped (uint32_t *w)
......@@ -38,7 +38,7 @@ Stopped (uint32_t *w)
}
extern _Bool Continued (uint32_t *w)
__asm__ ("libgo_syscall.syscall.Continued.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.Continued.N18_syscall.WaitStatus");
_Bool
Continued (uint32_t *w)
......@@ -47,7 +47,7 @@ Continued (uint32_t *w)
}
extern _Bool CoreDump (uint32_t *w)
__asm__ ("libgo_syscall.syscall.CoreDump.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.CoreDump.N18_syscall.WaitStatus");
_Bool
CoreDump (uint32_t *w)
......@@ -56,7 +56,7 @@ CoreDump (uint32_t *w)
}
extern int ExitStatus (uint32_t *w)
__asm__ ("libgo_syscall.syscall.ExitStatus.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.ExitStatus.N18_syscall.WaitStatus");
int
ExitStatus (uint32_t *w)
......@@ -67,7 +67,7 @@ ExitStatus (uint32_t *w)
}
extern int Signal (uint32_t *w)
__asm__ ("libgo_syscall.syscall.Signal.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.Signal.N18_syscall.WaitStatus");
int
Signal (uint32_t *w)
......@@ -78,7 +78,7 @@ Signal (uint32_t *w)
}
extern int StopSignal (uint32_t *w)
__asm__ ("libgo_syscall.syscall.StopSignal.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.StopSignal.N18_syscall.WaitStatus");
int
StopSignal (uint32_t *w)
......@@ -89,7 +89,7 @@ StopSignal (uint32_t *w)
}
extern int TrapCause (uint32_t *w)
__asm__ ("libgo_syscall.syscall.TrapCause.N32_libgo_syscall.syscall.WaitStatus");
__asm__ ("syscall.TrapCause.N18_syscall.WaitStatus");
int
TrapCause (uint32_t *w __attribute__ ((unused)))
......
......@@ -109,7 +109,7 @@ runtime_makechan_c(ChanType *t, int64 hint)
// For reflect
// func makechan(typ *ChanType, size uint32) (chan)
uintptr reflect_makechan(ChanType *, uint32)
asm ("libgo_reflect.reflect.makechan");
asm ("reflect.makechan");
uintptr
reflect_makechan(ChanType *t, uint32 size)
......@@ -568,7 +568,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__("libgo_reflect.reflect.chansend");
__asm__("reflect.chansend");
_Bool
reflect_chansend(ChanType *t, Hchan *c, uintptr val, _Bool nb)
......@@ -605,7 +605,7 @@ struct chanrecv_ret
};
struct chanrecv_ret reflect_chanrecv(ChanType *, Hchan *, _Bool)
__asm__("libgo_reflect.reflect.chanrecv");
__asm__("reflect.chanrecv");
struct chanrecv_ret
reflect_chanrecv(ChanType *t, Hchan *c, _Bool nb)
......@@ -1161,7 +1161,7 @@ __go_builtin_close(Hchan *c)
// For reflect
// func chanclose(c chan)
void reflect_chanclose(uintptr) __asm__("libgo_reflect.reflect.chanclose");
void reflect_chanclose(uintptr) __asm__("reflect.chanclose");
void
reflect_chanclose(uintptr c)
......@@ -1172,7 +1172,7 @@ reflect_chanclose(uintptr c)
// For reflect
// func chanlen(c chan) (len int32)
int32 reflect_chanlen(uintptr) __asm__("libgo_reflect.reflect.chanlen");
int32 reflect_chanlen(uintptr) __asm__("reflect.chanlen");
int32
reflect_chanlen(uintptr ca)
......@@ -1197,7 +1197,7 @@ __go_chan_len(Hchan *c)
// For reflect
// func chancap(c chan) (cap int32)
int32 reflect_chancap(uintptr) __asm__("libgo_reflect.reflect.chancap");
int32 reflect_chancap(uintptr) __asm__("reflect.chancap");
int32
reflect_chancap(uintptr ca)
......
......@@ -122,7 +122,7 @@ static void LostProfileData(void) {
}
extern void runtime_SetCPUProfileRate(int32)
__asm__("libgo_runtime.runtime.SetCPUProfileRate");
__asm__("runtime.SetCPUProfileRate");
// SetCPUProfileRate sets the CPU profiling rate.
// The user documentation is in debug.go.
......@@ -422,7 +422,7 @@ breakflush:
}
extern Slice runtime_CPUProfile(void)
__asm__("libgo_runtime.runtime.CPUProfile");
__asm__("runtime.CPUProfile");
// CPUProfile returns the next cpu profile block as a []byte.
// The user documentation is in debug.go.
......
......@@ -6,7 +6,7 @@
#include <sched.h>
void Breakpoint (void) asm ("libgo_runtime.runtime.Breakpoint");
void Breakpoint (void) asm ("runtime.Breakpoint");
void
Breakpoint (void)
......
......@@ -36,7 +36,7 @@ static symvalfn_type symvalfn;
function/file/line information. */
void RegisterDebugLookup (infofn_type, symvalfn_type)
__asm__ ("libgo_runtime.runtime.RegisterDebugLookup");
__asm__ ("runtime.RegisterDebugLookup");
void
RegisterDebugLookup (infofn_type pi, symvalfn_type ps)
......@@ -76,9 +76,9 @@ struct caller_ret
_Bool ok;
};
struct caller_ret Caller (int n) asm ("libgo_runtime.runtime.Caller");
struct caller_ret Caller (int n) asm ("runtime.Caller");
Func *FuncForPC (uintptr_t) asm ("libgo_runtime.runtime.FuncForPC");
Func *FuncForPC (uintptr_t) asm ("runtime.FuncForPC");
/* Implement runtime.Caller. */
......@@ -132,7 +132,7 @@ struct funcline_go_return
struct funcline_go_return
runtime_funcline_go (Func *f, uintptr targetpc)
__asm__ ("libgo_runtime.runtime.funcline_go");
__asm__ ("runtime.funcline_go");
struct funcline_go_return
runtime_funcline_go (Func *f __attribute__((unused)), uintptr targetpc)
......
......@@ -67,7 +67,7 @@ runtime_callers (int32 skip, uintptr *pcbuf, int32 m)
}
int Callers (int, struct __go_open_array)
__asm__ ("libgo_runtime.runtime.Callers");
__asm__ ("runtime.Callers");
int
Callers (int skip, struct __go_open_array pc)
......
......@@ -8,7 +8,7 @@
#include "go-string.h"
struct __go_string getgoroot (void) asm ("libgo_runtime.runtime.getgoroot");
struct __go_string getgoroot (void) asm ("runtime.getgoroot");
struct __go_string
getgoroot ()
......
......@@ -15,7 +15,7 @@ struct time_now_ret
};
struct time_now_ret now()
__asm__ ("libgo_time.time.now")
__asm__ ("time.now")
__attribute__ ((no_split_stack));
struct time_now_ret
......
......@@ -24,7 +24,7 @@ struct mapaccess_ret
extern struct mapaccess_ret mapaccess (struct __go_map_type *, uintptr_t,
uintptr_t)
asm ("libgo_reflect.reflect.mapaccess");
asm ("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 ("libgo_reflect.reflect.mapassign");
asm ("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 ("libgo_reflect.reflect.maplen");
asm ("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 ("libgo_reflect.reflect.mapiterinit");
asm ("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 ("libgo_reflect.reflect.mapiternext");
asm ("reflect.mapiternext");
void
mapiternext (unsigned char *it)
......@@ -160,7 +160,7 @@ struct mapiterkey_ret
};
extern struct mapiterkey_ret mapiterkey (unsigned char *)
asm ("libgo_reflect.reflect.mapiterkey");
asm ("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 ("libgo_reflect.reflect.makemap");
asm ("reflect.makemap");
uintptr_t
makemap (const struct __go_map_type *t)
......
......@@ -15,7 +15,7 @@
/* Set the C environment from Go. This is called by syscall.Setenv. */
void setenv_c (struct __go_string, struct __go_string)
__asm__ ("libgo_syscall.syscall.setenv_c");
__asm__ ("syscall.setenv_c");
void
setenv_c (struct __go_string k, struct __go_string v)
......
......@@ -408,7 +408,7 @@ runtime_setsig (int32 i, bool def __attribute__ ((unused)), bool restart)
/* Used by the os package to raise SIGPIPE. */
void os_sigpipe (void) __asm__ ("libgo_os.os.sigpipe");
void os_sigpipe (void) __asm__ ("os.sigpipe");
void
os_sigpipe (void)
......
......@@ -9,7 +9,7 @@
#include "go-string.h"
struct __go_string typestring(struct __go_empty_interface)
asm ("libgo_runtime.runtime.typestring");
asm ("runtime.typestring");
struct __go_string
typestring (struct __go_empty_interface e)
......
......@@ -12,7 +12,7 @@
/* Implement unsafe_New, called from the reflect package. */
void *unsafe_New (struct __go_empty_interface type)
asm ("libgo_reflect.reflect.unsafe_New");
asm ("reflect.unsafe_New");
/* The dynamic type of the argument will be a pointer to a type
descriptor. */
......
......@@ -12,7 +12,7 @@
/* Implement unsafe_NewArray, called from the reflect package. */
void *unsafe_NewArray (struct __go_empty_interface type, int n)
asm ("libgo_reflect.reflect.unsafe_NewArray");
asm ("reflect.unsafe_NewArray");
/* The dynamic type of the argument will be a pointer to a type
descriptor. */
......
......@@ -15,7 +15,7 @@
descriptor. */
extern const struct __go_type_descriptor unsafe_Pointer
asm ("__go_tdn_libgo_unsafe.unsafe.Pointer");
asm ("__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_pN27_libgo_unsafe.unsafe.Pointer");
asm ("__go_td_pN14_unsafe.Pointer");
/* The reflection string. */
#define PREFLECTION "*unsafe.Pointer"
......
......@@ -33,6 +33,9 @@
/* Whether we're emitting for gcc */
static int gcc;
/* Package path to use; only meaningful for gcc */
static const char *pkgpath;
/* Package prefix to use; only meaningful for gcc */
static const char *prefix;
......@@ -579,9 +582,13 @@ write_gcc_func_header(char *package, char *name, struct params *params,
first = 1;
write_params(params, &first);
printf(") asm (\"");
if (prefix != NULL)
printf("%s.", prefix);
printf("%s.%s\");\n", package, name);
if (pkgpath != NULL)
printf("%s", pkgpath);
else if (prefix != NULL)
printf("%s.%s", prefix, package);
else
printf("%s", package);
printf(".%s\");\n", name);
write_gcc_return_type(package, name, rets);
printf(" %s_%s(", package, name);
first = 1;
......@@ -724,7 +731,7 @@ process_file(void)
static void
usage(void)
{
sysfatal("Usage: goc2c [--6g | --gc] [--go-prefix PREFIX] [file]\n");
sysfatal("Usage: goc2c [--6g | --gc] [--go-pkgpath PKGPATH] [--go-prefix PREFIX] [file]\n");
}
void
......@@ -740,7 +747,11 @@ main(int argc, char **argv)
gcc = 0;
else if(strcmp(argv[1], "--gcc") == 0)
gcc = 1;
else if (strcmp(argv[1], "--go-prefix") == 0 && argc > 2) {
else if (strcmp(argv[1], "--go-pkgpath") == 0 && argc > 2) {
pkgpath = argv[2];
argc--;
argv++;
} else if (strcmp(argv[1], "--go-prefix") == 0 && argc > 2) {
prefix = argv[2];
argc--;
argv++;
......
......@@ -23,7 +23,7 @@ MHeap runtime_mheap;
extern MStats mstats; // defined in extern.go
extern volatile int32 runtime_MemProfileRate
__asm__ ("libgo_runtime.runtime.MemProfileRate");
__asm__ ("runtime.MemProfileRate");
// Allocate an object of at least size bytes.
// Small objects are allocated from the per-thread cache's free lists.
......@@ -266,7 +266,7 @@ runtime_purgecachedstats(M* m)
}
extern uintptr runtime_sizeof_C_MStats
__asm__ ("libgo_runtime.runtime.Sizeof_C_MStats");
__asm__ ("runtime.Sizeof_C_MStats");
#define MaxArena32 (2U<<30)
......
......@@ -237,7 +237,7 @@ struct MStats
};
extern MStats mstats
__asm__ ("libgo_runtime.runtime.VmemStats");
__asm__ ("runtime.VmemStats");
// Size classes. Computed and initialized by InitSizes.
......
......@@ -1078,7 +1078,7 @@ runtime_gc(int32 force)
}
void runtime_ReadMemStats(MStats *)
__asm__("libgo_runtime.runtime.ReadMemStats");
__asm__("runtime.ReadMemStats");
void
runtime_ReadMemStats(MStats *stats)
......
......@@ -1300,7 +1300,7 @@ runtime_malg(int32 stacksize, byte** ret_stack, size_t* ret_stacksize)
/* For runtime package testing. */
void runtime_testing_entersyscall(void)
__asm__("libgo_runtime.runtime.entersyscall");
__asm__("runtime.entersyscall");
void
runtime_testing_entersyscall()
......@@ -1309,7 +1309,7 @@ runtime_testing_entersyscall()
}
void runtime_testing_exitsyscall(void)
__asm__("libgo_runtime.runtime.exitsyscall");
__asm__("runtime.exitsyscall");
void
runtime_testing_exitsyscall()
......@@ -1416,7 +1416,7 @@ rundefer(void)
}
}
void runtime_Goexit (void) asm ("libgo_runtime.runtime.Goexit");
void runtime_Goexit (void) asm ("runtime.Goexit");
void
runtime_Goexit(void)
......@@ -1425,7 +1425,7 @@ runtime_Goexit(void)
runtime_goexit();
}
void runtime_Gosched (void) asm ("libgo_runtime.runtime.Gosched");
void runtime_Gosched (void) asm ("runtime.Gosched");
void
runtime_Gosched(void)
......@@ -1504,7 +1504,7 @@ runtime_lockedOSThread(void)
// for testing of callbacks
_Bool runtime_golockedOSThread(void)
asm("libgo_runtime.runtime.golockedOSThread");
asm("runtime.golockedOSThread");
_Bool
runtime_golockedOSThread(void)
......@@ -1520,7 +1520,7 @@ runtime_mid()
}
int32 runtime_NumGoroutine (void)
__asm__ ("libgo_runtime.runtime.NumGoroutine");
__asm__ ("runtime.NumGoroutine");
int32
runtime_NumGoroutine()
......
......@@ -86,8 +86,8 @@ runtime_panicstring(const char *s)
static int32 argc;
static byte** argv;
extern Slice os_Args asm ("libgo_os.os.Args");
extern Slice syscall_Envs asm ("libgo_syscall.syscall.Envs");
extern Slice os_Args asm ("os.Args");
extern Slice syscall_Envs asm ("syscall.Envs");
void
runtime_args(int32 c, byte **v)
......
......@@ -298,8 +298,8 @@ void runtime_gosched(void);
void runtime_tsleep(int64);
M* runtime_newm(void);
void runtime_goexit(void);
void runtime_entersyscall(void) __asm__("libgo_syscall.syscall.Entersyscall");
void runtime_exitsyscall(void) __asm__("libgo_syscall.syscall.Exitsyscall");
void runtime_entersyscall(void) __asm__("syscall.Entersyscall");
void runtime_exitsyscall(void) __asm__("syscall.Exitsyscall");
void siginit(void);
bool __go_sigsend(int32 sig);
int32 runtime_callers(int32, uintptr*, int32);
......@@ -374,7 +374,7 @@ void runtime_panic(Eface);
struct __go_func_type;
void reflect_call(const struct __go_func_type *, const void *, _Bool, _Bool,
void **, void **)
asm ("libgo_reflect.reflect.call");
asm ("reflect.call");
/* Functions. */
#define runtime_panic __go_panic
......@@ -417,11 +417,11 @@ void runtime_usleep(uint32);
* runtime c-called (but written in Go)
*/
void runtime_printany(Eface)
__asm__("libgo_runtime.runtime.Printany");
__asm__("runtime.Printany");
void runtime_newTypeAssertionError(const String*, const String*, const String*, const String*, Eface*)
__asm__("libgo_runtime.runtime.NewTypeAssertionError");
__asm__("runtime.NewTypeAssertionError");
void runtime_newErrorString(String, Eface*)
__asm__("libgo_runtime.runtime.NewErrorString");
__asm__("runtime.NewErrorString");
/*
* wrapped for go users
......@@ -431,8 +431,8 @@ void runtime_semrelease(uint32 volatile *);
int32 runtime_gomaxprocsfunc(int32 n);
void runtime_procyield(uint32);
void runtime_osyield(void);
void runtime_LockOSThread(void) __asm__("libgo_runtime.runtime.LockOSThread");
void runtime_UnlockOSThread(void) __asm__("libgo_runtime.runtime.UnlockOSThread");
void runtime_LockOSThread(void) __asm__("runtime.LockOSThread");
void runtime_UnlockOSThread(void) __asm__("runtime.UnlockOSThread");
uintptr runtime_memlimit(void);
......
......@@ -30,6 +30,7 @@ gofiles=""
pkgfiles=""
loop=true
keep=false
pkgpath=
prefix=
dejagnu=no
GOARCH=""
......@@ -56,6 +57,15 @@ while $loop; do
basedir=`echo $1 | sed -e 's/^--basedir=//'`
shift
;;
x--pkgpath)
pkgpath=$2
shift
shift
;;
x--pkgpath=*)
pkgpath=`echo $1 | sed -e 's/^--pkgpath=//'`
shift
;;
x--prefix)
prefix=$2
shift
......@@ -310,23 +320,28 @@ set -e
package=`echo ${srcdir} | sed -e 's|^.*libgo/go/||'`
pkgpatharg=
xpkgpatharg=
prefixarg=
if test -n "$prefix"; then
if test -n "$pkgpath"; then
pkgpatharg="-fgo-pkgpath=$pkgpath"
xpkgpatharg="-fgo-pkgpath=${pkgpath}_test"
elif test -n "$prefix"; then
prefixarg="-fgo-prefix=$prefix"
fi
if test "$trace" = "true"; then
echo $GC -g $prefixarg -c -I . -fno-toplevel-reorder -o _gotest_.o $gofiles $pkgbasefiles
echo $GC -g $pkgpatharg $prefixarg -c -I . -fno-toplevel-reorder -o _gotest_.o $gofiles $pkgbasefiles
fi
$GC -g $prefixarg -c -I . -fno-toplevel-reorder -o _gotest_.o $gofiles $pkgbasefiles
$GC -g $pkgpatharg $prefixarg -c -I . -fno-toplevel-reorder -o _gotest_.o $gofiles $pkgbasefiles
if $havex; then
mkdir -p `dirname $package`
cp _gotest_.o `dirname $package`/lib`basename $package`.a
if test "$trace" = "true"; then
echo $GC -g -c -I . -fno-toplevel-reorder -o $xofile $xgofiles
echo $GC -g $xpkgpatharg -c -I . -fno-toplevel-reorder -o $xofile $xgofiles
fi
$GC -g -c -I . -fno-toplevel-reorder -o $xofile $xgofiles
$GC -g $xpkgpatharg -c -I . -fno-toplevel-reorder -o $xofile $xgofiles
fi
# They all compile; now generate the code to call them.
......@@ -343,24 +358,26 @@ localname() {
ppc*) text="D" ;;
esac
symtogo='sed -e s/_test/XXXtest/ -e s/.*_\([^_]*\.\)/\1/ -e s/XXXtest/_test/'
# test functions are named TestFoo
# the grep -v eliminates methods and other special names
# that have multiple dots.
pattern='Test([^a-z].*)?'
# The -p option tells GNU nm not to sort.
# The -v option tells Solaris nm to sort by value.
tests=$($NM -p -v _gotest_.o $xofile | egrep " $text .*\."$pattern'$' | grep -v '\..*\..*\.' | fgrep -v '$' | fgrep -v ' __go_' | sed 's/.* //' | sed 's/.*\.\(.*\.\)/\1/')
tests=$($NM -p -v _gotest_.o $xofile | egrep " $text .*\."$pattern'$' | grep -v '\..*\..*\.' | fgrep -v '$' | fgrep -v ' __go_' | sed 's/.* //' | $symtogo)
if [ "x$tests" = x ]; then
echo 'gotest: warning: no tests matching '$pattern in _gotest_.o $xofile 1>&2
exit 2
fi
# benchmarks are named BenchmarkFoo.
pattern='Benchmark([^a-z].*)?'
benchmarks=$($NM -p -v _gotest_.o $xofile | egrep " $test .*\."$pattern'$' | grep -v '\..*\..*\.' | fgrep -v '$' | fgrep -v ' __go_' | sed 's/.* //' | sed 's/.*\.\(.*\.\)/\1/')
benchmarks=$($NM -p -v _gotest_.o $xofile | egrep " $test .*\."$pattern'$' | grep -v '\..*\..*\.' | fgrep -v '$' | fgrep -v ' __go_' | sed 's/.* //' | $symtogo)
# examples are named ExampleFoo
pattern='Example([^a-z].*)?'
examples=$($NM -p -v _gotest_.o $xofile | egrep " $text .*\."$pattern'$' | grep -v '\..*\..*\.' | fgrep -v '$' | fgrep -v ' __go_' | sed 's/.* //' | sed 's/.*\.\(.*\.\)/\1/')
examples=$($NM -p -v _gotest_.o $xofile | egrep " $text .*\."$pattern'$' | grep -v '\..*\..*\.' | fgrep -v '$' | fgrep -v ' __go_' | sed 's/.* //' | $symtogo)
# package spec
echo 'package main'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment