ia64/xen-unstable

changeset 18294:26afc8557f9f

stubdom: turn off_t 64bit on x86

We can decide to make off_t 64bit instead of implementing the LFS
tricks. Name corresponding functions foo64 to permit simple caml
programs linking.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Aug 08 10:45:30 2008 +0100 (2008-08-08)
parents 13b4d1efe890
children 9877446e919b
files extras/mini-os/include/fcntl.h extras/mini-os/include/posix/sys/mman.h extras/mini-os/include/posix/sys/stat.h extras/mini-os/lib/sys.c stubdom/newlib.patch
line diff
     1.1 --- a/extras/mini-os/include/fcntl.h	Thu Aug 07 09:56:22 2008 +0100
     1.2 +++ b/extras/mini-os/include/fcntl.h	Fri Aug 08 10:45:30 2008 +0100
     1.3 @@ -91,8 +91,9 @@ struct flock64 {
     1.4  #define F_LINUX_SPECIFIC_BASE	1024
     1.5  */
     1.6  
     1.7 -int open(const char *path, int flags, ...);
     1.8 -int fcntl(int fd, int cmd, ...);
     1.9  #endif
    1.10  
    1.11 +int open(const char *path, int flags, ...) asm("open64");
    1.12 +int fcntl(int fd, int cmd, ...);
    1.13 +
    1.14  #endif
     2.1 --- a/extras/mini-os/include/posix/sys/mman.h	Thu Aug 07 09:56:22 2008 +0100
     2.2 +++ b/extras/mini-os/include/posix/sys/mman.h	Fri Aug 08 10:45:30 2008 +0100
     2.3 @@ -14,7 +14,7 @@
     2.4  
     2.5  #define MAP_FAILED	((void*)0)
     2.6  
     2.7 -void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
     2.8 +void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) asm("mmap64");
     2.9  int munmap(void *start, size_t length);
    2.10  #define munlock(addr, len) ((void)addr, (void)len, 0)
    2.11  #define mlock(addr, len) ((void)addr, (void)len, 0)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/extras/mini-os/include/posix/sys/stat.h	Fri Aug 08 10:45:30 2008 +0100
     3.3 @@ -0,0 +1,7 @@
     3.4 +#ifndef _POSIX_SYS_STAT_H
     3.5 +#define _POSIX_SYS_STAT_H
     3.6 +
     3.7 +#include_next <sys/stat.h>
     3.8 +int fstat(int fd, struct stat *buf) asm("fstat64");
     3.9 +
    3.10 +#endif /* _POSIX_SYS_STAT_H */
     4.1 --- a/extras/mini-os/lib/sys.c	Thu Aug 07 09:56:22 2008 +0100
     4.2 +++ b/extras/mini-os/lib/sys.c	Fri Aug 08 10:45:30 2008 +0100
     4.3 @@ -204,9 +204,6 @@ int open(const char *pathname, int flags
     4.4      files[fd].file.offset = 0;
     4.5      return fd;
     4.6  }
     4.7 -#if defined(__x86_64__) || defined(__ia64__)
     4.8 -__typeof__(open) open64 __attribute__((__alias__("open")));
     4.9 -#endif
    4.10  
    4.11  int isatty(int fd)
    4.12  {
    4.13 @@ -347,9 +344,6 @@ off_t lseek(int fd, off_t offset, int wh
    4.14      }
    4.15      return files[fd].file.offset;
    4.16  }
    4.17 -#if defined(__x86_64__) || defined(__ia64__)
    4.18 -__typeof__(lseek) lseek64 __attribute__((__alias__("lseek")));
    4.19 -#endif
    4.20  
    4.21  int fsync(int fd) {
    4.22      switch (files[fd].type) {
    4.23 @@ -1120,9 +1114,6 @@ void *mmap(void *start, size_t length, i
    4.24          return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, 0, 0);
    4.25      } else ASSERT(0);
    4.26  }
    4.27 -#if defined(__x86_64__) || defined(__ia64__)
    4.28 -__typeof__(mmap) mmap64 __attribute__((__alias__("mmap")));
    4.29 -#endif
    4.30  
    4.31  int munmap(void *start, size_t length)
    4.32  {
     5.1 --- a/stubdom/newlib.patch	Thu Aug 07 09:56:22 2008 +0100
     5.2 +++ b/stubdom/newlib.patch	Fri Aug 08 10:45:30 2008 +0100
     5.3 @@ -627,3 +627,123 @@ diff -u -p -r1.1 memcpy.S
     5.4   
     5.5   #ifdef _I386MACH_NEED_SOTYPE_FUNCTION
     5.6   #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function
     5.7 +
     5.8 +
     5.9 +We want to have a 64bit offsets libc even on 32bit platforms.
    5.10 +
    5.11 +--- ./newlib/configure.host.orig	2008-08-07 16:01:17.801946000 +0100
    5.12 ++++ ./newlib/configure.host	2008-08-07 16:01:34.181064000 +0100
    5.13 +@@ -317,6 +317,8 @@
    5.14 +     oext=lo
    5.15 +     lpfx=
    5.16 +     aext=la ;;
    5.17 ++  i[34567]86-xen-elf)
    5.18 ++    stdio64_dir=stdio64 ;;
    5.19 +   *) ;; #shared library not supported for ${host}
    5.20 + esac
    5.21 + 
    5.22 +--- newlib/libc/include/sys/_types.h.orig	2008-08-07 15:22:44.925008000 +0100
    5.23 ++++ newlib/libc/include/sys/_types.h	2008-08-07 15:22:50.824044000 +0100
    5.24 +@@ -13,8 +13,12 @@
    5.25 + #include <sys/lock.h>
    5.26 + 
    5.27 + #ifndef __off_t_defined
    5.28 ++#ifdef __MINIOS__
    5.29 ++typedef long long _off_t;
    5.30 ++#else
    5.31 + typedef long _off_t;
    5.32 + #endif
    5.33 ++#endif
    5.34 + 
    5.35 + #if defined(__rtems__)
    5.36 + /* device numbers are 32-bit major and and 32-bit minor */
    5.37 +--- ./newlib/libc/include/sys/config.h.orig	2008-08-07 14:43:25.915866000 +0100
    5.38 ++++ ./newlib/libc/include/sys/config.h	2008-08-07 14:44:13.508154000 +0100
    5.39 +@@ -69,6 +69,10 @@
    5.40 + /* we use some glibc header files so turn on glibc large file feature */
    5.41 + #define _LARGEFILE64_SOURCE 1
    5.42 + #endif
    5.43 ++#ifdef __MINIOS__
    5.44 ++#define __LARGE64_FILES 1
    5.45 ++#define _LARGEFILE64_SOURCE 1
    5.46 ++#endif
    5.47 + #endif
    5.48 + 
    5.49 + #ifndef __DYNAMIC_REENT__
    5.50 +--- ./newlib/libc/include/sys/_default_fcntl.h.orig	2008-08-07 15:08:22.377836000 +0100
    5.51 ++++ ./newlib/libc/include/sys/_default_fcntl.h	2008-08-07 15:08:31.651890000 +0100
    5.52 +@@ -170,7 +170,11 @@
    5.53 + /* Provide _<systemcall> prototypes for functions provided by some versions
    5.54 +    of newlib.  */
    5.55 + #ifdef _COMPILING_NEWLIB
    5.56 +-extern int _open _PARAMS ((const char *, int, ...));
    5.57 ++extern int _open _PARAMS ((const char *, int, ...))
    5.58 ++#ifdef __MINIOS__
    5.59 ++    asm("open64")
    5.60 ++#endif
    5.61 ++    ;
    5.62 + extern int _fcntl _PARAMS ((int, int, ...));
    5.63 + #ifdef __LARGE64_FILES
    5.64 + extern int _open64 _PARAMS ((const char *, int, ...));
    5.65 +--- ./newlib/libc/include/sys/unistd.h.orig	2008-08-07 15:09:36.449280000 +0100
    5.66 ++++ ./newlib/libc/include/sys/unistd.h	2008-08-07 15:09:51.210370000 +0100
    5.67 +@@ -101,7 +101,11 @@
    5.68 + int     _EXFUN(link, (const char *__path1, const char *__path2 ));
    5.69 + int	_EXFUN(nice, (int __nice_value ));
    5.70 + #if !defined(__INSIDE_CYGWIN__)
    5.71 +-off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
    5.72 ++off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ))
    5.73 ++#ifdef __MINIOS__
    5.74 ++    asm("lseek64")
    5.75 ++#endif
    5.76 ++    ;
    5.77 + #endif
    5.78 + #if defined(__SPU__)
    5.79 + #define F_ULOCK	0
    5.80 +--- ./newlib/libc/include/sys/stat.h.orig	2008-08-07 16:08:50.495116000 +0100
    5.81 ++++ ./newlib/libc/include/sys/stat.h	2008-08-07 16:10:21.799753000 +0100
    5.82 +@@ -49,6 +49,9 @@
    5.83 +   long	st_spare4[2];
    5.84 + #endif
    5.85 + };
    5.86 ++#ifdef __MINIOS__
    5.87 ++#define stat64 stat
    5.88 ++#endif
    5.89 + #endif
    5.90 + 
    5.91 + #define	_IFMT		0170000	/* type of file */
    5.92 +@@ -132,7 +135,11 @@
    5.93 + /* Provide prototypes for most of the _<systemcall> names that are
    5.94 +    provided in newlib for some compilers.  */
    5.95 + #ifdef _COMPILING_NEWLIB
    5.96 +-int	_EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
    5.97 ++int	_EXFUN(_fstat,( int __fd, struct stat *__sbuf ))
    5.98 ++#ifdef __MINIOS__
    5.99 ++    asm("fstat64")
   5.100 ++#endif
   5.101 ++    ;
   5.102 + int	_EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
   5.103 + #ifdef __LARGE64_FILES
   5.104 + struct stat64;
   5.105 +--- ./newlib/libc/include/_syslist.h.orig	2008-08-07 16:24:19.122605000 +0100
   5.106 ++++ ./newlib/libc/include/_syslist.h	2008-08-07 16:24:21.548628000 +0100
   5.107 +@@ -14,6 +14,7 @@
   5.108 + #define _kill kill
   5.109 + #define _link link
   5.110 + #define _lseek lseek
   5.111 ++#define _lseek64 lseek64
   5.112 + #define _open open
   5.113 + #define _read read
   5.114 + #define _sbrk sbrk
   5.115 +--- newlib/libc/include/reent.h.orig	2008-08-07 16:28:49.846502000 +0100
   5.116 ++++ newlib/libc/include/reent.h	2008-08-07 16:29:02.096586000 +0100
   5.117 +@@ -87,6 +87,9 @@
   5.118 + #if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB)
   5.119 + #define stat64 __stat64
   5.120 + #endif
   5.121 ++#if defined(__MINIOS__)
   5.122 ++#define stat64 stat
   5.123 ++#endif
   5.124 + 
   5.125 + struct stat64;
   5.126 +