This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

go for linux - incompatiblities? (or: three hacks to support older linux versions)


Hi,

I think I found some incompatiblities of gccgo/libgo to older linux versions.
I tried with linux 2.6.18.8-0.7-bigsmp from UnitedLinux 1.0 (i586).

I used three hacks to get it building successfully.

  (I have no clue about what I was doing and my changes are based
  on find|grep results etc.)




1) SYS_TGKILL

hacked in gcc-4.6.0/libgo/syscalls/syscall_linux.go:

   // used by libgo/go/debug/proc/proc_linux.go
   func Tgkill(tgid int, tid int, sig int) (errno int) {
           return -1234;
   }


Is the function syscall.Tgkill essential or could something work
without it? The directory of the only using function is in
debug, so maybe I can live without it?




2) problem with type Stat_t

my "man 2 stat" tells:

   struct stat {
      .....
      time_t        st_atime;    /* time of last access */
      time_t        st_mtime;    /* time of last modification */
      time_t        st_ctime;    /* time of last change */
   };

with "gcc-4.6.0/libgo/mksysinfo.sh" doing:

    314 # The stat type.
    315 # Prefer largefile variant if available.
    316 stat=`grep '^type _stat64 ' gen-sysinfo.go || true`
    ...
    332          -e 's/st_atim/Atime/' \
    333          -e 's/st_mtim/Mtime/' \
    334          -e 's/st_ctim/Ctime/' \

resulting in "i686-pc-linux-gnu/libgo/sysinfo.go"

   // orignally one single line:
   type Stat_t struct { Dev uint64; __pad1 uint32; __Ino uint32;
      Mode uint32; Nlink uint32; Uid uint32; Gid uint32; Rdev uint64;
      __pad2 uint32; Size int64; Blksize int32; Blocks int64;
      Atimee int32; __unused1 uint32;
      Mtimee int32; __unused2 uint32;
      Ctimee int32; __unused3 uint32;
      Ino uint64; }

so I hacked in libgo/go/os/stat.go:

     15 func fileInfoFromStat(
        name string, fi *FileInfo, lstat, stat *syscall.Stat_t) *FileInfo {
   ...
     26         // i686-pc-linux-gnu/libgo/sysinfo.go
     27         fi.Atime_ns = int64(stat.Atimee)*1e9 // stat.__unused1
     28         fi.Mtime_ns = int64(stat.Mtimee)*1e9 // stat.__unused2
     29         fi.Ctime_ns = int64(stat.Ctimee)*1e9 // stat.__unused3

I think this would work well for me, right?




3) epoll

manually added (to continue testing) in "i686-pc-linux-gnu/libgo/sysinfo.go"

   // from /usr/include/sys/epoll.h
   const EPOLLIN = 0x001
   const EPOLLOUT = 0x004
   const EPOLLONESHOT = (1 << 30)
   const EPOLL_CTL_MOD = 3
   const EPOLL_CTL_ADD = 1
   const EPOLL_CTL_DEL = 2

no idea why they are missing.


With those hacks I was able to compile gccgo on UnitedLinux 1.0 (i586).



Should I try to adjust "gcc-4.6.0/libgo/mksysinfo.sh",
maybe trying to create some patch,
or won't this make sense, because useless anyway?

oki,

Steffen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]