Blob Blame History Raw
--- configure.in.orig	2019-02-13 16:20:34.212035064 -0700
+++ configure.in	2019-02-14 08:25:07.258686468 -0700
@@ -187,6 +187,8 @@ if echo $GCL_CC |grep gcc |grep -q win;
 fi
 AC_SUBST(GCL_CC)
 
+AC_SYS_LARGEFILE
+
 add_arg_to_cflags() {
     
     AC_MSG_CHECKING([for CFLAG $1])
--- configure.orig	2019-02-13 16:20:39.690976951 -0700
+++ configure	2019-02-14 09:11:28.163435714 -0700
@@ -756,6 +756,7 @@ enable_custreloc
 enable_debug
 enable_static
 enable_pic
+enable_largefile
 enable_gprof
 enable_dynsysgmp
 with_x
@@ -1414,6 +1415,7 @@ Optional Features:
   --enable-debug builds gcl with -g in CFLAGS to enable running under gdb
   --enable-static will link your GCL against static as opposed to shared system libraries
   --enable-pic builds gcl with -fPIC in CFLAGS
+  --disable-largefile     omit support for large files
   --enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof
   --enable-dynsysgmp will link against the system libgmp3 overriding certain functions with patched versions from the local source
   --enable-xdr=yes will compile in support for XDR
@@ -4840,6 +4842,207 @@ if echo $GCL_CC |grep gcc |grep -q win;
 fi
 
 
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
+
+
+fi
+
+
 add_arg_to_cflags() {
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLAG $1" >&5
--- h/linux.h.orig	2019-02-13 15:22:21.910697762 -0700
+++ h/linux.h	2019-02-14 08:32:35.532712818 -0700
@@ -12,13 +12,13 @@
 #include <link.h>
 #define SEEK_TO_END_OFILE(fp)\
   do { \
-	long offset = 0, endofelf; int j; \
+	off_t offset = 0, endofelf; int j; \
 	ElfW(Ehdr) eheader; ElfW(Shdr) shdr; \
-        fseek(fp, 0, SEEK_SET); \
+        fseeko(fp, 0, SEEK_SET); \
         massert(1==fread(&eheader, sizeof(eheader), 1, fp));	      \
   /* in case the headers themselves come AFTER the actual sections */ \
 	endofelf=offset = eheader.e_shoff+ eheader.e_shentsize *eheader.e_shnum;\
-        fseek(fp, eheader.e_shoff, SEEK_SET); \
+        fseeko(fp, eheader.e_shoff, SEEK_SET); \
 	if ( eheader.e_shentsize != sizeof(ElfW(Shdr)) ) \
 	  { FEerror("Bad ELF section header size",0); } \
         for ( j = 0; j < eheader.e_shnum; j++ ) \
@@ -26,7 +26,7 @@
             if ( (shdr.sh_offset > offset) && (shdr.sh_type != SHT_NOBITS) ) \
 	      { offset = shdr.sh_offset; endofelf = offset+shdr.sh_size; } \
 	  } \
-	if ( fseek(fp, endofelf, SEEK_SET) ) \
+	if ( fseeko(fp, endofelf, SEEK_SET) ) \
 	    FEerror("Bad ELF file",0); \
       } while(0)
 
--- h/mp.h.orig	2014-10-23 15:29:00.000000000 -0600
+++ h/mp.h	2019-02-14 08:34:26.034642620 -0700
@@ -33,6 +33,22 @@ typedef struct
             
 #define SI_TO_MP(x, temp) (mpz_set_si(MP(temp),(x)), MP(temp))
             
+#define C_INT_TO_OBJ(x) ({					\
+  object temp = big_fixnum1;					\
+  if (x >= MOST_NEGATIVE_FIX && x <= MOST_POSITIVE_FIX)		\
+    temp = make_fixnum(x);					\
+  else if (sizeof(x) <= sizeof(long))				\
+    mpz_set_si(MP(big_fixnum1), x);				\
+  else if (x < 0) {						\
+    __typeof__(x) y = -x;					\
+    mpz_import(MP(big_fixnum2), 1U, 1, sizeof(x), 0, 0U, &y);	\
+    mpz_neg(MP(big_fixnum1), MP(big_fixnum2));			\
+  } else {							\
+    __typeof__(x) y = x;					\
+    mpz_import(MP(big_fixnum1), 1U, 1, sizeof(x), 0, 0U, &y);	\
+  }								\
+  temp;								\
+})
 
 #define INTEGER_TO_MP(x, temp ) \
   (type_of(x) == t_bignum ? MP(x) : SI_TO_MP(fix(x), temp))
@@ -108,6 +124,20 @@ GEN subss();
 
 #define SI_TO_MP(x,ignore) stoi(x)
 
+#define C_INT_TO_OBJ(x) ({					\
+  object temp = big_fixnum1;					\
+  if (x >= MOST_NEGATIVE_FIX && x <= MOST_POSITIVE_FIX)		\
+    temp = make_fixnum(x);					\
+  else if (sizeof(x) <= sizeof(long))				\
+    MP(big_fixnum1) = stoi(x);					\
+  else if (x < 0) {						\
+    __typeof__(x) y = -x;					\
+    MP(big_fixnum1) = uutoineg((y) >> (sizeof(ulong) * 8), (y) & (ulong)-1); \
+  } else							\
+    MP(big_fixnum1) = uutoi((x) >> (sizeof(ulong) * 8), (x) & (ulong)-1); \
+  temp;								\
+})
+
 #define INT_FLAG 0x1010000
 
 #define MP_ALLOCATED(x) (x)->big.big_length
--- h/protoize.h.orig	2019-02-13 15:21:42.685085800 -0700
+++ h/protoize.h	2019-02-14 08:35:02.931298799 -0700
@@ -512,7 +512,7 @@ typedef void (*funcvoid)(void);
 /* unixfsys.c:329:OF */ extern bool file_exists (object file); /* (file) object file; */
 /* unixfsys.c:359:OF */ extern FILE *backup_fopen (char *filename, char *option); /* (filename, option) char *filename; char *option; */
 /* unixfsys.c:359:OF */ extern FILE *fopen_not_dir (char *filename, char *option); /* (filename, option) char *filename; char *option; */
-/* unixfsys.c:372:OF */ extern int file_len (FILE *fp); /* (fp) FILE *fp; */
+/* unixfsys.c:372:OF */ extern off_t file_len (FILE *fp); /* (fp) FILE *fp; */
 /* unixfsys.c:382:OF */ extern object truename (object); /* () */
 /* unixfsys.c:382:OF */ extern void Ltruename (void); /* () */
 /* unixfsys.c:418:OF */ extern object fSsetenv (object variable, object value); /* (variable, value) object variable; object value; */
@@ -738,11 +738,11 @@ edit_double(int, double, int *, char *,
 void
 sethash(object,object,object);
 
-int
+off_t
 file_position(object);
 
 int
-file_position_set(object, int);
+file_position_set(object, off_t);
 
 void
 princ_str(char *s, object);
--- misc/test-seek.c.orig	2014-10-23 15:29:00.000000000 -0600
+++ misc/test-seek.c	2019-02-14 08:46:01.418583399 -0700
@@ -13,12 +13,12 @@
  do{ int m; \
      Elf32_Ehdr eheader; \
      Elf32_Shdr shdr;  \
-     fseek(fp,0,SEEK_SET);   \
+     fseeko(fp,0,SEEK_SET);   \
      fread(&eheader,sizeof(eheader),1,fp); \
-     fseek(fp,eheader.e_shoff+(eheader.e_shnum -1) \
+     fseeko(fp,eheader.e_shoff+(eheader.e_shnum -1) \
 	   *eheader.e_shentsize,0); \
      fread(&shdr,eheader.e_shentsize,1,fp); \
-     fseek(fp,OUR_MAX(shdr.sh_offset+ shdr.sh_size, \
+     fseeko(fp,OUR_MAX(shdr.sh_offset+ shdr.sh_size, \
 		      eheader.e_shoff+(eheader.e_shnum) \
 		      *eheader.e_shentsize) \
 		      , SEEK_SET);\
@@ -32,6 +32,6 @@ main(argc,argv)
   fp = fopen (argv[1],"r");
 
   SEEK_TO_END_OFILE(fp); 
-  printf("end = %d\n",ftell(fp));
+  printf("end = %ld\n",ftello(fp));
 }
   
--- o/fasdump.c.orig	2019-02-13 15:21:53.791975938 -0700
+++ o/fasdump.c	2019-02-14 08:44:47.036406103 -0700
@@ -23,6 +23,7 @@
 #ifndef FAT_STRING
 #include "include.h"
 #endif
+#include "num_include.h"
 
 static void
 clrhash(object);
@@ -599,7 +600,7 @@ DEFUN_NEW("OPEN-FASD",object,fSopen_fasd
     fd->eof=eof;
     fd->index=small_fixnum(0);
     fd->package=symbol_value(sLApackageA);
-    fd->filepos = make_fixnum(ftell(stream->sm.sm_fp));
+    fd->filepos = C_INT_TO_OBJ(ftello(stream->sm.sm_fp));
     
     SETUP_FASD_IN(fd);
     if (direction==sKoutput){
@@ -647,13 +648,13 @@ DEFUN_NEW("CLOSE-FASD",object,fSclose_fa
        {clrhash(fd->table);
 	SETUP_FASD_IN(fd);
 	PUT_OP(d_end_of_file);
-	{int i = ftell(fd->stream->sm.sm_fp);
+	{off_t i = ftello(fd->stream->sm.sm_fp);
 	 if(type_of(fd->filepos) == t_fixnum)
-	   { fseek(fd->stream->sm.sm_fp,fix(fd->filepos)+2,SEEK_SET);
+	   { fseeko(fd->stream->sm.sm_fp,fix(fd->filepos)+2,SEEK_SET);
 	    /* record the length of array needed to read the indices */
 	    PUT4(fix(fd->index));
 	    /* move back to where we were */
-	    fseek(fd->stream->sm.sm_fp,i,SEEK_SET);
+	    fseeko(fd->stream->sm.sm_fp,i,SEEK_SET);
 	  }}
 	 
       }
--- o/file.d.orig	2019-02-13 15:21:44.136071449 -0700
+++ o/file.d	2019-02-14 08:40:41.293124154 -0700
@@ -370,7 +370,7 @@ open_stream(object fn,enum smmode smm, o
 	while ((n=fread(FN4,1,sizeof(FN3),pp)))
 	  massert(fwrite(FN4,1,n,fp)==n);
 	massert(pclose(pp)>=0);
-	massert(!fseek(fp,0,SEEK_SET));
+	massert(!fseeko(fp,0,SEEK_SET));
 
       }
 
--- o/sfaslelf.c.orig	2019-02-13 15:21:42.687085780 -0700
+++ o/sfaslelf.c	2019-02-14 08:51:08.430230968 -0700
@@ -524,7 +524,7 @@ seek_to_end_ofile(FILE *fp) {
 
   massert(!parse_map(v1,&sec1,&sece,&sn,&sym1,&syme,&st1,&end,&dsym1,&dsyme,&dst1));
 
-  massert(!fseek(fp,end,SEEK_SET));
+  massert(!fseeko(fp,end,SEEK_SET));
 
   massert(!un_mmap(v1,ve));
 
@@ -573,7 +573,7 @@ fasload(object faslfile) {
   
   massert(!relocate_code(v1,sec1,sece,sym1,got,gote));
   
-  massert(!fseek(fp,end,SEEK_SET));
+  massert(!fseeko(fp,end,SEEK_SET));
   
   massert(!un_mmap(v1,ve));
   
--- o/unexelf.c.orig	2019-02-13 15:22:28.712630472 -0700
+++ o/unexelf.c	2019-02-14 09:00:01.641779304 -0700
@@ -657,7 +657,8 @@ unexec (char *new_name, char *old_name,
   char *old_section_names;
 
   ElfW(Addr) old_bss_addr, new_bss_addr,new_data2_addr;
-  ElfW(Off)  old_bss_size, new_data2_size,old_bss_offset,new_data2_offset,old_file_size,new_file_size,data_bss_offset;
+  ElfW(Off)  old_bss_size, new_data2_size,old_bss_offset,new_data2_offset,data_bss_offset;
+  off_t old_file_size, new_file_size;
 
   int n, nn;
   int old_bss_index, old_sbss_index;
--- o/unixfasl.c.orig	2019-02-13 15:21:42.688085770 -0700
+++ o/unixfasl.c	2019-02-14 08:52:47.454218531 -0700
@@ -138,12 +138,12 @@ SEEK_TO_END_OFILE(faslfile->sm.sm_fp);
 #else  
 	fp = faslfile->sm.sm_fp;
 	fread(&faslheader, sizeof(faslheader), 1, fp);
-	fseek(fp,
+	fseeko(fp,
 	      faslheader.a_text+faslheader.a_data+
 	      faslheader.a_syms+faslheader.a_trsize+faslheader.a_drsize,
 	      1);
 	fread(&i, sizeof(i), 1, fp);
-	fseek(fp, i - sizeof(i), 1);
+	fseeko(fp, i - sizeof(i), 1);
 #endif
 	data = read_fasl_vector(faslfile);
 	vs_push(data);
@@ -165,7 +165,7 @@ SEEK_TO_END_OFILE(faslfile->sm.sm_fp);
 	vs_push(tempfile);
 	fp = tempfile->sm.sm_fp;
 
-	if (fseek(fp, textstart, 0) < 0)
+	if (fseeko(fp, textstart, 0) < 0)
 		error("file seek error");
 
 	fread(memory->cfd.cfd_start, textsize + datasize, 1, fp);
--- o/unixfsys.c.orig	2019-02-13 15:21:29.933211931 -0700
+++ o/unixfsys.c	2019-02-14 08:31:33.516400892 -0700
@@ -25,6 +25,7 @@ Foundation, 675 Mass Ave, Cambridge, MA
 
 #define IN_UNIXFSYS
 #include "include.h"
+#include "num_include.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifndef NO_PWD_H
@@ -145,7 +146,7 @@ fopen_not_dir(char *filename,char *optio
 
 }
 
-int
+off_t
 file_len(FILE *fp) {/*FIXME dir*/
 
   struct stat filestatus;
@@ -211,7 +212,7 @@ DEFUNM_NEW("STAT",object,fSstat,SI,1,1,N
 
   if (stat_internal(x,&ss))
     RETURN4(stat_mode_key(&ss),
-	    make_fixnum(ss.st_size),
+	    C_INT_TO_OBJ(ss.st_size),
 	    make_fixnum(ss.st_mtime),
 	    make_fixnum(ss.st_uid));
   else
@@ -221,13 +222,13 @@ DEFUNM_NEW("STAT",object,fSstat,SI,1,1,N
 
 DEFUN_NEW("FTELL",object,fSftell,SI,1,1,NONE,IO,OO,OO,OO,(object x),"") {
 
-  RETURN1((x=file_stream(x))!=Cnil&&x->sm.sm_fp ? (object)ftell(x->sm.sm_fp) : (object)0);
+  RETURN1((x=file_stream(x))!=Cnil&&x->sm.sm_fp ? C_INT_TO_OBJ(ftello(x->sm.sm_fp)) : (object)0);
 
 }
 
 DEFUN_NEW("FSEEK",object,fSfseek,SI,2,2,NONE,OO,IO,OO,OO,(object x,fixnum pos),"") {
 
-  RETURN1((x=file_stream(x))!=Cnil&&x->sm.sm_fp&&!fseek(x->sm.sm_fp,pos,SEEK_SET) ? Ct : Cnil);
+  RETURN1((x=file_stream(x))!=Cnil&&x->sm.sm_fp&&!fseeko(x->sm.sm_fp,pos,SEEK_SET) ? Ct : Cnil);
 
 }
 
--- o/unixsave.c.orig	2019-02-13 15:18:42.560874666 -0700
+++ o/unixsave.c	2019-02-14 08:50:07.639860056 -0700
@@ -93,7 +93,7 @@ memory_save(original_file, save_file)
 char *original_file, *save_file;
 {	MEM_SAVE_LOCALS;
 	char *data_begin, *data_end;
-	int original_data;
+	off_t original_data = 0;
 	FILE *original, *save;
 	register int n;
 	register char *p;
@@ -130,7 +130,7 @@ char *original_file, *save_file;
 		} else
 			break;
 
-	fseek(original, original_data, 1);
+	fseeko(original, original_data, 1);
 
 	COPY_TO_SAVE;
 
--- unixport/bsd_rsym.c.orig	2014-10-23 15:29:00.000000000 -0600
+++ unixport/bsd_rsym.c	2019-02-14 08:47:50.465377269 -0700
@@ -65,12 +65,12 @@ char *filename;
 		fprintf(stderr, "Can't open %s\n", filename);
 		exit(1);
 	}
-	ftell(ldptr);
+	ftello(ldptr);
 	fread(&my_header,sizeof(struct exec),1,ldptr);
 	if(N_BADMAG(my_header)){fprintf(stderr,"Bad magic %s",filename);
 				exit(1);};
 
-	if(fseek(ldptr,(int)N_SYMOFF(my_header),0))
+	if(fseeko(ldptr,(off_t)N_SYMOFF(my_header),0))
 	  {fprintf(stderr,"seek error");
 					       exit(1);}
        
@@ -86,7 +86,7 @@ char *filename;
 	its length is stored after the symbol table,
 	This is not described in the manual, and may change in the future.
 	*/
-	/* fseek(ldptr,N_STROFF(my_header),0);
+	/* fseeko(ldptr,N_STROFF(my_header),0);
 	   strings follow symbol table! */
 
 	if (FREAD(&i, 4, 1, ldptr) > 0)	{
@@ -121,7 +121,7 @@ tab.n_symbols=0;tab.tot_leng=0;
  symout=fopen(outfile,"w");
  if (!symout)
    {perror(outfile); exit(1);};
- fseek(symout,sizeof(struct lsymbol_table),0);
+ fseeko(symout,sizeof(struct lsymbol_table),0);
  end = my_symbol_table + NSYMS(my_header);
  for (p = my_symbol_table; p < end; p++)	{
    /*
@@ -146,7 +146,7 @@ tab.n_symbols=0;tab.tot_leng=0;
    dprintf( index , (int) (p - my_symbol_table)  / sizeof(struct syment));
    p = p + NUM_AUX(p); }
  }
- fseek(symout,0,0);
+ fseeko(symout,0,0);
  fwrite(&tab,sizeof(tab),1,symout);
  fclose(symout);
  return 0;
--- unixport/rsym.c.orig	2014-10-23 15:29:00.000000000 -0600
+++ unixport/rsym.c	2019-02-14 08:55:02.260840248 -0700
@@ -102,7 +102,7 @@ char *filename;
 	sizeof(struct syment) and SYMESZ are not always the same.
 	*/
 
-	if(fseek(fp,(int)(N_SYMOFF(my_header)),0))
+	if(fseeko(fp,N_SYMOFF(my_header),0))
 	  {fprintf(stderr,"seek error");
 					       exit(1);}
 
@@ -113,7 +113,7 @@ char *filename;
 		dprintf(string_size %d,string_size);
 		symbol_table[i].n_un.n_strx = string_size;
 		string_size += symbol_table[i].n_length + 1;
-		fseek(fp,symbol_table[i].n_length,1);
+		fseeko(fp,symbol_table[i].n_length,1);
 	      }
 #else	
 		fread((char *)&symbol_table[i], SYMESZ, 1, fp);
@@ -127,14 +127,14 @@ char *filename;
 	   strings follow symbol table! */
 #ifndef HPUX
 #ifdef N_STROFF
-	fseek(fp,N_STROFF(my_header),0);
+	fseeko(fp,N_STROFF(my_header),0);
 #endif	
 	if (fread((char *)&string_size, 4, 1, fp) > 0)	{
 		my_string_table = malloc(string_size);
                 if(debug)
-		  {printf(" string_size is %d fseek %d ",string_size,fseek(fp,string_size-1,1));
-		   printf(" fseek back %d ",fseek(fp,1-string_size,1));};
-		fseek(fp, -4, 1);
+		  {printf(" string_size is %d fseek %ld ",string_size,fseeko(fp,string_size-1,1));
+		   printf(" fseek back %ld ",fseeko(fp,1-string_size,1));};
+		fseeko(fp, -4, 1);
 		if(string_size!=(fread(my_string_table, 1, string_size, fp)))
 		  {dprintf( string_size was %d ,string_size);
 		   perror("rsym could not read bad string table") ;
@@ -149,10 +149,10 @@ char *filename;
 		int slen;
 		p = my_string_table=malloc((unsigned int)string_size);
 		dprintf( string table leng = %d, string_size);
-		fseek(fp,(int)( LESYM_OFFSET(my_header)),  0);
+		fseeko(fp, LESYM_OFFSET(my_header),  0);
 		for (i = 0;  i < nsyms; i++)
 		{
-			fseek(fp,SYMESZ, 1);
+			fseeko(fp,SYMESZ, 1);
 			slen = symbol_table[i].n_length;
 			dprintf( slen = %d,slen);
 			fread(p,slen,1,fp);
@@ -182,7 +182,7 @@ char *out;
  symout=fopen(out,"wr");
  if (!symout)
    {perror(out); exit(1);};
- fseek(symout,sizeof(struct lsymbol_table),0);
+ fseeko(symout,sizeof(struct lsymbol_table),0);
  end = symbol_table + nsyms;
  for (p = symbol_table; p < end; p++)	{
    /*
@@ -219,7 +219,7 @@ char *out;
        dprintf( index , (int) (p - symbol_table)  / sizeof(struct syment));
        p = p + NUM_AUX(p); }
  }
- fseek(symout,0,0);
+ fseeko(symout,0,0);
  fwrite(&tab,sizeof(tab),1,symout);
  fclose(symout);
 #ifdef AIX3
@@ -323,7 +323,7 @@ char *out;
   symin=fopen(out,"w");
   if(symin==0) perror("can't open");
   fwrite(&tab,sizeof(tab),1,symin);
-  fseek(symin,sizeof(tab),0);
+  fseeko(symin,sizeof(tab),0);
   {int i,j;
    unsigned short k;
    for (i=0 ; i < tab.n_symbols ; i++)
--- unixport/rsym_elf.c.orig	2014-10-23 15:29:00.000000000 -0600
+++ unixport/rsym_elf.c	2019-02-14 08:56:03.475214372 -0700
@@ -147,7 +147,7 @@ get_section(fp,name)
   else
     shndx = get_section_number(name);
   { 
-      fseek(fp,SECTION_H(shndx).sh_offset,SEEK_SET);
+      fseeko(fp,SECTION_H(shndx).sh_offset,SEEK_SET);
       ans = malloc(SECTION_H(shndx).sh_size);
       fread(ans,SECTION_H(shndx).sh_size,1,fp);
       return ans;
@@ -173,7 +173,7 @@ char *filename;
 	}
 
 	fread(&eheader,sizeof(eheader),1,fp);
-	fseek(fp,eheader.e_ehsize,SEEK_SET);
+	fseeko(fp,eheader.e_ehsize,SEEK_SET);
 	fread(&pheader,sizeof(pheader),1,fp);
 
 	if(ELFMAG0 != eheader.e_ident[0]){
@@ -182,7 +182,7 @@ char *filename;
 
 	section_headers = (void *)malloc(sizeof(ElfW(Shdr))*
 				 (1+ eheader.e_shnum));
-	fseek(fp,eheader.e_shoff,0);
+	fseeko(fp,eheader.e_shoff,0);
 	for (i=0 ; i< eheader.e_shnum ; i++)
 	  fread(&section_headers[i],eheader.e_shentsize,1,fp);
 				 
@@ -196,7 +196,7 @@ char *filename;
 	sizeof(struct syment) and SYMESZ are not always the same.
 	*/
 
-	if(fseek(fp,(int)SECTION_H(symbol_index).sh_offset,0))
+	if(fseeko(fp,(off_t)SECTION_H(symbol_index).sh_offset,0))
 	  {fprintf(stderr,"seek error");
 					       exit(1);}
 
@@ -242,7 +242,7 @@ char *out;
  symout=fopen(out,"wr");
  if (!symout)
    {perror(out); exit(1);};
- fseek(symout,sizeof(struct lsymbol_table),0);
+ fseeko(symout,sizeof(struct lsymbol_table),0);
  end = symbol_table + nsyms;
  for (p = symbol_table; p < end; p++)	{
    /*
@@ -300,7 +300,7 @@ char *out;
        dprintf( index , (int) (p - symbol_table)  / sizeof(STRUCT_SYMENT));
        p = p + NUM_AUX(p); }
  }
- fseek(symout,0,0);
+ fseeko(symout,0,0);
  fwrite(&tab,sizeof(tab),1,symout);
  fclose(symout);
 #ifdef AIX3
--- xbin/spp.c.orig	2014-10-23 15:29:00.000000000 -0600
+++ xbin/spp.c	2019-02-14 08:56:31.866924079 -0700
@@ -93,7 +93,7 @@ char *argv[];
 	header.a_data = 0;
 	header.a_bss  = 0;
 	fwrite(&header,sizeof(header),1,sfile);
-	fseek(file,skip,0);
+	fseeko(file,skip,0);
 	filecpy(sfile,file,size0);
 	stabcpy(sfile,file,header.a_lesyms);
 	filecpy(sfile,file,size1);