Patchwork [RFC,go] : Port to ALPHA arch - sysinfo.go fixup

login
register
mail settings
Submitter Uros Bizjak
Date May 2, 2011, 8:28 a.m.
Message ID <BANLkTikBR_LuPufmMvFxCVubqzAAA=RKaw@mail.gmail.com>
Download mbox | patch
Permalink /patch/93609/
State New
Headers show

Comments

Uros Bizjak - May 2, 2011, 8:28 a.m.
On Fri, Apr 22, 2011 at 1:39 AM, Ian Lance Taylor <iant@google.com> wrote:
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> Here's the error I run into:
>>
>> /vol/gcc/src/hg/trunk/irix/libgo/go/os/file.go:432:12: error: incompatible types in assignment (implicit assignment of 'syscall.Timeval' hidden field '_f0')
>> /vol/gcc/src/hg/trunk/irix/libgo/go/os/file.go:433:12: error: incompatible types in assignment (implicit assignment of 'syscall.Timeval' hidden field '_f0')
>> /vol/gcc/src/hg/trunk/irix/libgo/go/os/file.go:434:37: error: argument 2 has incompatible type (implicit assignment of 'syscall.Timeval' hidden field '_f0')
>> make[8]: *** [os/os.lo] Error 1
>>
>>> What does the line for timeval look like in gen-sysinfo.go?
>>
>> I get
>>
>> type Timeval struct { _f0 int32; Sec Timeval_sec_t; Usec Timeval_usec_t; }
>
> Thanks.  I fixed this problem with this patch.  Bootstrapped and ran Go
> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.
>
> Ian
>
>
> 2011-04-21  Ian Lance Taylor  <iant@google.com>
>
>        * godump.c (go_format_type): Use exported Go name for anonymous
>        field name.

This still doesn't fix the build for alpha due to extra struct.  From
sysinfo.go:

type Timespec struct { Sec Timespec_sec_t; Nsec Timespec_nsec_t; }
type Stat_t struct { Dev uint64; Ino uint64; Rdev uint64; Size int64;
Blocks uint64; Mode uint32; Uid uint32; Gid uint32; Blksize uint32;
Nlink uint32; __pad0 int32; Go0 struct { Atime Timespec; }; Go1 struct
{ Mtime Timespec; }; Go2 struct { Ctime Timespec; }; __unused
[2+1]int64; }

Following patch enables the build to proceed:


(BTW: Original calculation of Ctime_ns has a cut'n'paste error,
stat.Ctime.Nsec should be used instead of stat.Atime.Nsec).

Is there a solution for this problem?

Uros.
Ian Taylor - May 2, 2011, 2:42 p.m.
Uros Bizjak <ubizjak@gmail.com> writes:

> This still doesn't fix the build for alpha due to extra struct.  From
> sysinfo.go:
>
> type Timespec struct { Sec Timespec_sec_t; Nsec Timespec_nsec_t; }
> type Stat_t struct { Dev uint64; Ino uint64; Rdev uint64; Size int64;
> Blocks uint64; Mode uint32; Uid uint32; Gid uint32; Blksize uint32;
> Nlink uint32; __pad0 int32; Go0 struct { Atime Timespec; }; Go1 struct
> { Mtime Timespec; }; Go2 struct { Ctime Timespec; }; __unused
> [2+1]int64; }

> Is there a solution for this problem?

I haven't fixed it yet but I think the way to fix it is to edit
mksysinfo.sh to strip out the unexpected structs.

Ian

Patch

Index: go/os/stat.go
===================================================================
--- go/os/stat.go	(revision 173234)
+++ go/os/stat.go	(working copy)
@@ -23,9 +23,9 @@ 
 	fi.Size = int64(stat.Size)
 	fi.Blksize = int64(stat.Blksize)
 	fi.Blocks = int64(stat.Blocks)
-	fi.Atime_ns = int64(stat.Atime.Sec)*1e9 + int64(stat.Atime.Nsec)
-	fi.Mtime_ns = int64(stat.Mtime.Sec)*1e9 + int64(stat.Mtime.Nsec)
-	fi.Ctime_ns = int64(stat.Ctime.Sec)*1e9 + int64(stat.Atime.Nsec)
+	fi.Atime_ns = int64(stat.Go0.Atime.Sec)*1e9 + int64(stat.Go0.Atime.Nsec)
+	fi.Mtime_ns = int64(stat.Go1.Mtime.Sec)*1e9 + int64(stat.Go1.Mtime.Nsec)
+	fi.Ctime_ns = int64(stat.Go2.Ctime.Sec)*1e9 + int64(stat.Go2.Ctime.Nsec)
 	for i := len(name)-1; i >= 0; i-- {
 		if name[i] == '/' {
 			name = name[i+1:]