On Sat, Apr 2, 2011 at 1:17 AM, Ian Lance Taylor <[email protected]> wrote:
> Rainer Orth <[email protected]> writes:
>
>> I've got a similar issue on IRIX 6.5: <sys/time.h> has
>>
>> struct timeval {
>> #if _MIPS_SZLONG == 64
>> __int32_t :32;
>> #endif
>> time_t tv_sec; /* seconds */
>> long tv_usec; /* and microseconds */
>> };
>>
>> which causes the 64-bit libgo build to break.
>
> I don't immediately see why that would break anything. For a case like
> this I would expect layout_decl to turn the first field into an ordinary
> non-bit-field anyhow.
>
> What does the line for timeval look like in gen-sysinfo.go?
For Alpha, it looks like this:
type _timeval struct { tv_sec int64; tv_usec int64; }
where struct stat, as defined in bits/stat.h looks like:
struct stat
{
...
int __pad0; /* Real padding. */
__ST_TIME(a); /* Time of last access. */
__ST_TIME(m); /* Time of last modification. */
__ST_TIME(c); /* Time of last status change. */
long __unused[3];
};
with __ST_TIME defined as:
#ifdef __USE_MISC
# if __GNUC_PREREQ(3,3)
# define __ST_TIME(X) \
__extension__ union { \
struct timespec st_##X##tim; \
struct { \
__time_t st_##X##time; \
unsigned long st_##X##timensec; \
}; \
}
# else
# define __ST_TIME(X) struct timespec st_##X##tim
# define st_atime st_atim.tv_sec
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
# endif
#else
# define __ST_TIME(X) \
__time_t st_##X##time; \
unsigned long st_##X##timensec
#endif
This results in:
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; _f0 struct { Atime Timespec; }; _f1 struct
{ Mtime Timespec; }; _f2 struct { Ctime Timespec; }; __unused
[2+1]int64; }
Uros.