aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2015-12-15 10:44:46 +0100
committerYvan Roux <yvan.roux@linaro.org>2015-12-15 14:41:45 +0100
commit966a7fddb78c4fad3c2efb46c969308686557ec0 (patch)
treeed597a56f1ed08195ec07841c5608cf4d2945a47 /libgo
parent7f7da9776a2100eb6e64c142732c89ecc719d45d (diff)
Merge branches/gcc-5-branch rev 231642.
Change-Id: I58832e31b4e58588e1d0800c3fc09a01f91b6320
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/cmd/cgo/gcc.go5
-rw-r--r--libgo/go/cmd/cgo/out.go5
-rw-r--r--libgo/go/cmd/go/pkg.go6
-rw-r--r--libgo/go/cmd/go/tool.go23
-rw-r--r--libgo/go/net/multicast_test.go4
-rw-r--r--libgo/go/syscall/libcall_linux.go1
-rwxr-xr-xlibgo/mksysinfo.sh20
-rw-r--r--libgo/runtime/go-reflect-call.c6
-rw-r--r--libgo/runtime/netpoll_select.c16
9 files changed, 73 insertions, 13 deletions
diff --git a/libgo/go/cmd/cgo/gcc.go b/libgo/go/cmd/cgo/gcc.go
index abdd369d713..a9e95a5ce43 100644
--- a/libgo/go/cmd/cgo/gcc.go
+++ b/libgo/go/cmd/cgo/gcc.go
@@ -500,6 +500,11 @@ func (p *Package) loadDWARF(f *File, names []*Name) {
name, _ := e.Val(dwarf.AttrName).(string)
typOff, _ := e.Val(dwarf.AttrType).(dwarf.Offset)
if name == "" || typOff == 0 {
+ if e.Val(dwarf.AttrSpecification) != nil {
+ // Since we are reading all the DWARF,
+ // assume we will see the variable elsewhere.
+ break
+ }
fatalf("malformed DWARF TagVariable entry")
}
if !strings.HasPrefix(name, "__cgo__") {
diff --git a/libgo/go/cmd/cgo/out.go b/libgo/go/cmd/cgo/out.go
index d92bed9bf01..276837f0f3e 100644
--- a/libgo/go/cmd/cgo/out.go
+++ b/libgo/go/cmd/cgo/out.go
@@ -102,10 +102,9 @@ func (p *Package) writeDefs() {
}
if !cVars[n.C] {
- fmt.Fprintf(fm, "extern char %s[];\n", n.C)
- fmt.Fprintf(fm, "void *_cgohack_%s = %s;\n\n", n.C, n.C)
-
if !*gccgo {
+ fmt.Fprintf(fm, "extern char %s[];\n", n.C)
+ fmt.Fprintf(fm, "void *_cgohack_%s = %s;\n\n", n.C, n.C)
fmt.Fprintf(fc, "#pragma cgo_import_static %s\n", n.C)
}
diff --git a/libgo/go/cmd/go/pkg.go b/libgo/go/cmd/go/pkg.go
index ef440dd3b74..27671d47bf1 100644
--- a/libgo/go/cmd/go/pkg.go
+++ b/libgo/go/cmd/go/pkg.go
@@ -497,7 +497,11 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
if goTools[p.ImportPath] == toTool {
// This is for 'go tool'.
// Override all the usual logic and force it into the tool directory.
- p.target = filepath.Join(gorootPkg, "tool", full)
+ if buildContext.Compiler == "gccgo" {
+ p.target = filepath.Join(runtime.GCCGOTOOLDIR, elem)
+ } else {
+ p.target = filepath.Join(gorootPkg, "tool", full)
+ }
}
if p.target != "" && buildContext.GOOS == "windows" {
p.target += ".exe"
diff --git a/libgo/go/cmd/go/tool.go b/libgo/go/cmd/go/tool.go
index 3f11c3e3d44..47761e1d79f 100644
--- a/libgo/go/cmd/go/tool.go
+++ b/libgo/go/cmd/go/tool.go
@@ -39,6 +39,12 @@ var (
toolN bool
)
+// List of go tools found in the gccgo tool directory.
+// Other binaries could be in the same directory so don't
+// show those with the 'go tool' command.
+
+var gccgoTools = []string{"cgo", "fix", "cover", "godoc", "vet"}
+
func init() {
cmdTool.Flag.BoolVar(&toolN, "n", false, "")
}
@@ -141,6 +147,21 @@ func listTools() {
if toolIsWindows && strings.HasSuffix(name, toolWindowsExtension) {
name = name[:len(name)-len(toolWindowsExtension)]
}
- fmt.Println(name)
+
+ // The tool directory used by gccgo will have other binaries
+ // in additions to go tools. Only display go tools for this list.
+
+ if buildContext.Compiler == "gccgo" {
+ for _, tool := range gccgoTools {
+ if tool == name {
+ fmt.Println(name)
+ }
+ }
+ } else {
+
+ // Not gccgo, list all the tools found in this dir
+
+ fmt.Println(name)
+ }
}
}
diff --git a/libgo/go/net/multicast_test.go b/libgo/go/net/multicast_test.go
index 5f253f44a45..3951cddaee5 100644
--- a/libgo/go/net/multicast_test.go
+++ b/libgo/go/net/multicast_test.go
@@ -45,7 +45,7 @@ func TestIPv4MulticastListener(t *testing.T) {
// routing stuff for finding out an appropriate
// nexthop containing both network and link layer
// adjacencies.
- if ifi == nil && !*testExternal {
+ if ifi == nil && (testing.Short() || !*testExternal) {
continue
}
for _, tt := range ipv4MulticastListenerTests {
@@ -121,7 +121,7 @@ func TestIPv6MulticastListener(t *testing.T) {
// routing stuff for finding out an appropriate
// nexthop containing both network and link layer
// adjacencies.
- if ifi == nil && (!*testExternal || !*testIPv6) {
+ if ifi == nil && (testing.Short() || !*testExternal || !*testIPv6) {
continue
}
for _, tt := range ipv6MulticastListenerTests {
diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go
index 93137fc7fb7..3b434e3fff6 100644
--- a/libgo/go/syscall/libcall_linux.go
+++ b/libgo/go/syscall/libcall_linux.go
@@ -327,6 +327,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
var soff Offset_t
var psoff *Offset_t
if offset != nil {
+ soff = Offset_t(*offset)
psoff = &soff
}
written, err = sendfile(outfd, infd, psoff, count)
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 942e8319ea5..c68dc352d7f 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1465,4 +1465,24 @@ grep '^type _zone_net_addr_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr/[16]byte/' \
>> ${OUT}
+# The Solaris 12 _flow_arp_desc_t struct.
+grep '^type _flow_arp_desc_t ' gen-sysinfo.go | \
+ sed -e 's/_in6_addr_t/[16]byte/g' \
+ >> ${OUT}
+
+# The Solaris 12 _flow_l3_desc_t struct.
+grep '^type _flow_l3_desc_t ' gen-sysinfo.go | \
+ sed -e 's/_in6_addr_t/[16]byte/g' \
+ >> ${OUT}
+
+# The Solaris 12 _mac_ipaddr_t struct.
+grep '^type _mac_ipaddr_t ' gen-sysinfo.go | \
+ sed -e 's/_in6_addr_t/[16]byte/g' \
+ >> ${OUT}
+
+# The Solaris 12 _mactun_info_t struct.
+grep '^type _mactun_info_t ' gen-sysinfo.go | \
+ sed -e 's/_in6_addr_t/[16]byte/g' \
+ >> ${OUT}
+
exit $?
diff --git a/libgo/runtime/go-reflect-call.c b/libgo/runtime/go-reflect-call.c
index 29e814a793f..2a14d6c6add 100644
--- a/libgo/runtime/go-reflect-call.c
+++ b/libgo/runtime/go-reflect-call.c
@@ -81,6 +81,12 @@ go_results_size (const struct __go_func_type *func)
off = (off + maxalign - 1) & ~ (maxalign - 1);
+ // The libffi library doesn't understand a struct with no fields.
+ // We generate a struct with a single field of type void. When used
+ // as a return value, libffi will think that requires a byte.
+ if (off == 0)
+ off = 1;
+
return off;
}
diff --git a/libgo/runtime/netpoll_select.c b/libgo/runtime/netpoll_select.c
index b4613359118..033661d17f2 100644
--- a/libgo/runtime/netpoll_select.c
+++ b/libgo/runtime/netpoll_select.c
@@ -135,6 +135,8 @@ runtime_netpoll(bool block)
byte b;
struct stat st;
+ allocatedfds = false;
+
retry:
runtime_lock(&selectlock);
@@ -146,11 +148,13 @@ runtime_netpoll(bool block)
}
if(inuse) {
- prfds = runtime_SysAlloc(4 * sizeof fds, &mstats.other_sys);
- pwfds = prfds + 1;
- pefds = pwfds + 1;
- ptfds = pefds + 1;
- allocatedfds = true;
+ if(!allocatedfds) {
+ prfds = runtime_SysAlloc(4 * sizeof fds, &mstats.other_sys);
+ pwfds = prfds + 1;
+ pefds = pwfds + 1;
+ ptfds = pefds + 1;
+ allocatedfds = true;
+ }
} else {
prfds = &grfds;
pwfds = &gwfds;
@@ -216,7 +220,7 @@ runtime_netpoll(bool block)
mode = 'r' + 'w';
--c;
}
- if(i == rdwake) {
+ if(i == rdwake && mode != 0) {
while(read(rdwake, &b, sizeof b) > 0)
;
continue;