385abae
Description: <short summary of the patch>
385abae
 TODO: Put a short summary on the line above and replace this paragraph
385abae
 with a longer explanation of this change. Complete the meta-information
385abae
 with other relevant fields (see below for details). To make it easier, the
385abae
 information below has been extracted from the changelog. Adjust it or drop
385abae
 it.
385abae
 .
385abae
 gcl (2.6.12-83) unstable; urgency=high
385abae
 .
385abae
   * Version_2_6_13pre75
385abae
   * FIx acl2 arm builds (Closes: #919477).
385abae
Author: Camm Maguire <camm@debian.org>
385abae
Bug-Debian: https://bugs.debian.org/919477
385abae
385abae
---
385abae
The information above should follow the Patch Tagging Guidelines, please
385abae
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
385abae
are templates for supplementary fields that you might want to add:
385abae
385abae
Origin: <vendor|upstream|other>, <url of original patch>
385abae
Bug: <url in upstream bugtracker>
385abae
Bug-Debian: https://bugs.debian.org/<bugnumber>
385abae
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
385abae
Forwarded: <no|not-needed|url proving that it has been forwarded>
385abae
Reviewed-By: <name and email of someone who approved the patch>
385abae
Last-Update: 2019-02-05
385abae
385abae
--- gcl-2.6.12.orig/configure
385abae
+++ gcl-2.6.12/configure
385abae
@@ -2679,6 +2679,7 @@ case $canonical in
385abae
     mipsel*linux*) use=mipsel-linux;;
385abae
     sparc*linux*) use=sparc-linux;;
385abae
     aarch64*linux*) use=aarch64-linux;;
385abae
+    arm*linux*hf) use=armhf-linux;;
385abae
     arm*linux*) use=arm-linux;;
385abae
     s390*linux*) use=s390-linux;;
385abae
     ia64*linux*) use=ia64-linux;;
385abae
@@ -4122,11 +4123,12 @@ $as_echo_n "checking working gprof... "
385abae
 		       sh4*)  enableval="no";;
385abae
 		       ia64*) enableval="no";;
385abae
 		       hppa*) enableval="no";;
385abae
-#		       arm*)  enableval="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
385abae
+#		       arm*)  if echo $canonical |grep -q hf$; then enableval="no"; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
385abae
 		       aarch64*) enableval="no";;#unreproducible buildd bug 20170824
385abae
 		       *gnu)  enableval="no";;
385abae
 		   esac
385abae
-		   if test "$enableval" != "yes" ; then
385abae
+                   GP_FLAG=""
385abae
+                   if test "$enableval" != "yes" ; then
385abae
 		       { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
385abae
 $as_echo "disabled" >&6; }
385abae
 		   else
385abae
@@ -4134,7 +4136,8 @@ $as_echo "disabled" >&6; }
385abae
 $as_echo "ok" >&6; }
385abae
 		       OLD_CFLAGS=$CFLAGS  # Do not run configure tests with -pg
385abae
                        assert_arg_to_cflags -pg
385abae
-		       CFLAGS=$OLD_CFLAGS
385abae
+                       GP_FLAG="-pg"
385abae
+                       CFLAGS=$OLD_CFLAGS
385abae
        		       TFPFLAG=""
385abae
 
385abae
 $as_echo "#define GCL_GPROF 1" >>confdefs.h
385abae
@@ -4180,8 +4183,11 @@ case $use in
385abae
 	    ia64*)
385abae
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
385abae
 		;;
385abae
+	    armhf*)
385abae
+		assert_arg_to_cflags -fdollars-in-identifiers
385abae
+		assert_arg_to_cflags -g #?
385abae
+		;;
385abae
 	    arm*)
385abae
-#		assert_arg_to_cflags -mlong-calls
385abae
 		assert_arg_to_cflags -fdollars-in-identifiers
385abae
 		assert_arg_to_cflags -g #?
385abae
 		;;
385abae
@@ -9051,6 +9057,7 @@ LDFLAGS="`echo $LDFLAGS | sed 's,gcl.scr
385abae
 
385abae
 LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS $TLIBS"
385abae
 
385abae
+CFLAGS="$CFLAGS $GP_FLAG"
385abae
 FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS"
385abae
 
385abae
 # Work around bug with gcc on ppc -- CM
385abae
--- gcl-2.6.12.orig/configure.in
385abae
+++ gcl-2.6.12/configure.in
385abae
@@ -37,6 +37,7 @@ case $canonical in
385abae
     mipsel*linux*) use=mipsel-linux;;
385abae
     sparc*linux*) use=sparc-linux;;
385abae
     aarch64*linux*) use=aarch64-linux;;
385abae
+    arm*linux*hf) use=armhf-linux;;
385abae
     arm*linux*) use=arm-linux;;
385abae
     s390*linux*) use=s390-linux;;
385abae
     ia64*linux*) use=ia64-linux;;
385abae
@@ -335,17 +336,19 @@ AC_ARG_ENABLE([gprof],[  --enable-gprof
385abae
 		       sh4*)  enableval="no";;
385abae
 		       ia64*) enableval="no";;
385abae
 		       hppa*) enableval="no";;
385abae
-#		       arm*)  enableval="no";;#FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
385abae
+#		       arm*)  if echo $canonical |grep -q hf$; then enableval="no"; fi;;#FIXME CALL and JUMP24 veneers needed for thumb 20190201 #FIXME mcount compiled as a 24/22 bit reloc even with -mlong-calls, marginally accessible
385abae
 		       aarch64*) enableval="no";;#unreproducible buildd bug 20170824
385abae
 		       *gnu)  enableval="no";;
385abae
 		   esac		     
385abae
-		   if test "$enableval" != "yes" ; then
385abae
+                   GP_FLAG=""
385abae
+                   if test "$enableval" != "yes" ; then
385abae
 		       AC_MSG_RESULT([disabled])
385abae
 		   else
385abae
 		       AC_MSG_RESULT([ok])
385abae
 		       OLD_CFLAGS=$CFLAGS  # Do not run configure tests with -pg
385abae
                        assert_arg_to_cflags -pg
385abae
-		       CFLAGS=$OLD_CFLAGS
385abae
+                       GP_FLAG="-pg"
385abae
+                       CFLAGS=$OLD_CFLAGS
385abae
        		       TFPFLAG=""
385abae
 		       AC_DEFINE(GCL_GPROF,1,[use gprof profiling])
385abae
 		   fi
385abae
@@ -387,8 +390,11 @@ case $use in
385abae
 	    ia64*)
385abae
 		if test "$enable_debug" != "yes" ; then TO3FLAGS="-O" ; fi #FIXME needed asof gcc 4.8.1
385abae
 		;;
385abae
+	    armhf*)
385abae
+		assert_arg_to_cflags -fdollars-in-identifiers
385abae
+		assert_arg_to_cflags -g #?
385abae
+		;;
385abae
 	    arm*)
385abae
-#		assert_arg_to_cflags -mlong-calls
385abae
 		assert_arg_to_cflags -fdollars-in-identifiers
385abae
 		assert_arg_to_cflags -g #?
385abae
 		;;
385abae
@@ -2108,6 +2114,7 @@ LDFLAGS="`echo $LDFLAGS | sed 's,gcl.scr
385abae
 AC_SUBST(LDFLAGS)
385abae
 LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS $TLIBS"
385abae
 AC_SUBST(LIBS)
385abae
+CFLAGS="$CFLAGS $GP_FLAG"
385abae
 FINAL_CFLAGS="$CFLAGS $CPPFLAGS $X_CFLAGS"
385abae
 AC_SUBST(FINAL_CFLAGS)
385abae
 # Work around bug with gcc on ppc -- CM
385abae
--- /dev/null
385abae
+++ gcl-2.6.12/h/armhf-linux.h
385abae
@@ -0,0 +1,17 @@
385abae
+#include "linux.h"
385abae
+
385abae
+#ifdef IN_GBC
385abae
+#undef MPROTECT_ACTION_FLAGS
385abae
+#define MPROTECT_ACTION_FLAGS SA_RESTART|SA_SIGINFO
385abae
+#define GET_FAULT_ADDR(sig,code,sv,a) \
385abae
+ ((siginfo_t *)code)->si_addr
385abae
+/*  #define GET_FAULT_ADDR(sig,code,sv,a) \ */
385abae
+/*      ((void *)(*((char ***)(&code)))[44]) */
385abae
+#endif
385abae
+
385abae
+#define SGC
385abae
+
385abae
+#define RELOC_H "elf32_armhf_reloc.h"
385abae
+#define SPECIAL_RELOC_H "elf32_armhf_reloc_special.h"
385abae
+
385abae
+#define NEED_STACK_CHK_GUARD
385abae
--- gcl-2.6.12.orig/h/elf32_arm_reloc.h
385abae
+++ gcl-2.6.12/h/elf32_arm_reloc.h
385abae
@@ -1,44 +1,7 @@
385abae
-#define R_ARM_THM_CALL        10
385abae
-#define R_ARM_CALL 28
385abae
-#define R_ARM_V4BX 40
385abae
-#define R_ARM_THM_MOVW_ABS_NC 47
385abae
-#define R_ARM_THM_MOVW_ABS    48
385abae
 #define R_ARM_MOVW_ABS_NC 43
385abae
 #define R_ARM_MOVT_ABS    44
385abae
-    case R_ARM_THM_JUMP24:
385abae
-      s+=a; 
385abae
-      if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1; 
385abae
-      s-=p+4; /*FIXME maybe drop 4 and add_val below*/
385abae
-      s=((long)s>>1); 
385abae
-      massert(!(abs(s)&0xff000000));  
385abae
-      store_val(where,MASK(11)<<16,(s&0x7ff)<<16); 
385abae
-      store_val(where,MASK(10),s>>11); 
385abae
-      store_val(where,MASK(1)<<(16+11),(~((s>>21&0x1)^(s>>23&0x1)))<<(16+11)); 
385abae
-      store_val(where,MASK(1)<<(16+13),(~((s>>22&0x1)^(s>>23&0x1)))<<(16+13)); 
385abae
-      store_val(where,MASK(1)<<10,(s>>23&0x1)<<10); 
385abae
-      break; 
385abae
-    case R_ARM_THM_CALL: 
385abae
-      s+=a; 
385abae
-      if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1; 
385abae
-      s-=p+4; /*FIXME maybe drop 4 and add_val below*/
385abae
-      s=((long)s>>1); 
385abae
-      massert(!(abs(s)&0xffc00000));  
385abae
-      store_val(where,MASK(11),s>>11); 
385abae
-      store_val(where,MASK(11)<<16,(s&0x7ff)<<16); 
385abae
-      break; 
385abae
-    case R_ARM_THM_MOVW_ABS_NC:
385abae
-      s+=a;
385abae
-      if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1;
385abae
-      s&=0xffff;
385abae
-      s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
385abae
-      add_vals(where,~0L,s);
385abae
-      break;
385abae
-    case R_ARM_THM_MOVW_ABS:
385abae
-      s+=a;
385abae
-      s>>=16;
385abae
-      s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
385abae
-      add_vals(where,~0L,s);
385abae
-      break;
385abae
+#define R_ARM_CALL 28
385abae
+#define R_ARM_V4BX 40
385abae
     case R_ARM_MOVW_ABS_NC:
385abae
       s+=a;
385abae
       s&=0xffff;
385abae
@@ -53,21 +16,21 @@
385abae
       break;
385abae
     case R_ARM_CALL:
385abae
     case R_ARM_JUMP24:
385abae
-      massert(!a);
385abae
       {
385abae
-	long x=((long)(s-p))/4;
385abae
-	if (abs(x)&(~MASK(23))) {
385abae
+	long x=((long)(s+a-p))/4;
385abae
+	if (abs(x)&(~MASK(23))) {/*24?*/
385abae
           got+=(sym->st_size-1)*tz;
385abae
 	  memcpy(got,tramp,sizeof(tramp));
385abae
+	  /*relocate*/
385abae
           got[sizeof(tramp)/sizeof(*got)]=s;
385abae
 	  x=((long)got-p)/4;
385abae
 	}
385abae
 	add_vals(where,MASK(24),x);
385abae
       }
385abae
       break;
385abae
-    case R_ARM_ABS32:
385abae
+    case R_ARM_V4BX:
385abae
       add_vals(where,~0L,s+a);
385abae
       break;
385abae
-    case R_ARM_V4BX:
385abae
+    case R_ARM_ABS32:
385abae
       add_vals(where,~0L,s+a);
385abae
       break;
385abae
--- gcl-2.6.12.orig/h/elf32_arm_reloc_special.h
385abae
+++ gcl-2.6.12/h/elf32_arm_reloc_special.h
385abae
@@ -1,9 +1,7 @@
385abae
-/* #define R_AARCH64_TRAMP 1 */
385abae
-static int tramp[]={0xe59fc000,  /*ldr r12, [pc]*/ /*FIXME?  Can this refer to an earlier address?*/
385abae
-		    0xe12fff1c}; /*br r12*/
385abae
+static int tramp[]={0xe59fc000,   /*ldr r12, [pc]*/ /*FIXME?  Can this refer to an earlier address?*/
385abae
+		    0xe12fff1c};  /*br r12*/
385abae
 static ul tz=1+sizeof(tramp)/sizeof(ul);
385abae
 
385abae
-
385abae
 static int
385abae
 find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
385abae
 		    const char *st1,Sym *ds1,Sym *dse,Sym *sym,Sym *syme) {
385abae
@@ -26,8 +24,10 @@ label_got_symbols(void *v1,Shdr *sec1,Sh
385abae
   for (*gs=0,sec=sec1;sec
385abae
     if (sec->sh_type==SHT_REL)
385abae
       for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;v<ve;v+=sec->sh_entsize,r=v)
385abae
-	if (ELF_R_TYPE(r->r_info)==R_ARM_CALL ||
385abae
-	    ELF_R_TYPE(r->r_info)==R_ARM_JUMP24) {
385abae
+	if (
385abae
+	    ELF_R_TYPE(r->r_info)==R_ARM_CALL ||
385abae
+	    ELF_R_TYPE(r->r_info)==R_ARM_JUMP24
385abae
+	    ) {
385abae
 
385abae
 	  sym=sym1+ELF_R_SYM(r->r_info);
385abae
 
385abae
--- /dev/null
385abae
+++ gcl-2.6.12/h/elf32_armhf_reloc.h
385abae
@@ -0,0 +1,71 @@
385abae
+#define R_ARM_THM_CALL        10
385abae
+#define R_ARM_THM_MOVW_ABS_NC 47
385abae
+#define R_ARM_THM_MOVW_ABS    48
385abae
+     case R_ARM_THM_JUMP24:
385abae
+      {
385abae
+    	long x=(long)(s+a-p);
385abae
+    	if (1||abs(x)&(~MASK(25))) {
385abae
+
385abae
+          got+=(sym->st_size-1)*tz;
385abae
+    	  memcpy(got,tramp,sizeof(tramp));
385abae
+
385abae
+	  r->r_offset=(void *)got-(void *)start;
385abae
+	  r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS_NC);
385abae
+	  relocate(sym1,r,0,start,got,gote);
385abae
+
385abae
+	  r->r_offset=(void *)(got+1)-(void *)start;
385abae
+	  r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS);
385abae
+	  relocate(sym1,r,0,start,got,gote);
385abae
+
385abae
+    	  x=((long)got-p);
385abae
+    	}
385abae
+        if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) x|=1;
385abae
+        x-=4; /*FIXME maybe drop 4 and add_val below*/
385abae
+        x=((long)x>>1);
385abae
+        store_val(where,MASK(11)<<16,(x&0x7ff)<<16);
385abae
+        store_val(where,MASK(10),x>>11);
385abae
+        store_val(where,MASK(1)<<(16+11),(~((x>>21&0x1)^(x>>23&0x1)))<<(16+11));
385abae
+        store_val(where,MASK(1)<<(16+13),(~((x>>22&0x1)^(x>>23&0x1)))<<(16+13));
385abae
+        store_val(where,MASK(1)<<10,(x>>23&0x1)<<10);
385abae
+      }
385abae
+      break;
385abae
+    case R_ARM_THM_CALL:
385abae
+      {
385abae
+    	long x=(long)(s+a-p);
385abae
+    	if (1||abs(x)&(~MASK(23))) {/*24?*/
385abae
+          got+=(sym->st_size-1)*tz;
385abae
+    	  memcpy(got,tramp,sizeof(tramp));
385abae
+
385abae
+	  r->r_offset=(void *)got-(void *)start;
385abae
+	  r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS_NC);
385abae
+	  relocate(sym1,r,0,start,got,gote);
385abae
+
385abae
+	  r->r_offset=(void *)(got+1)-(void *)start;
385abae
+	  r->r_info=ELF_R_INFO(ELF_R_SYM(r->r_info),R_ARM_THM_MOVW_ABS);
385abae
+	  relocate(sym1,r,0,start,got,gote);
385abae
+
385abae
+    	  x=((long)got-p);
385abae
+    	}
385abae
+        if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) x|=1;
385abae
+        x-=4; /*FIXME maybe drop 4 and add_val below*/
385abae
+        x=((long)x>>1);
385abae
+        store_val(where,MASK(11),x>>11);
385abae
+        store_val(where,MASK(11)<<16,(x&0x7ff)<<16);
385abae
+      }
385abae
+      break;
385abae
+    case R_ARM_THM_MOVW_ABS_NC:
385abae
+      s+=a;
385abae
+      if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1;
385abae
+      s&=0xffff;
385abae
+      s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
385abae
+      add_vals(where,~0L,s);
385abae
+      break;
385abae
+    case R_ARM_THM_MOVW_ABS:
385abae
+      s+=a;
385abae
+      s>>=16;
385abae
+      s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
385abae
+      add_vals(where,~0L,s);
385abae
+      break;
385abae
+    case R_ARM_ABS32:
385abae
+      add_vals(where,~0L,s+a);
385abae
+      break;
385abae
--- /dev/null
385abae
+++ gcl-2.6.12/h/elf32_armhf_reloc_special.h
385abae
@@ -0,0 +1,85 @@
385abae
+static int tramp[]={0x0c00f240,  /*movw	r12, #0*/
385abae
+		    0x0c00f2c0,  /*movt	r12, #0*/
385abae
+		    0xbf004760}; /*bx r12   nop*/
385abae
+static ul tz=sizeof(tramp)/sizeof(ul);
385abae
+
385abae
+static ul *
385abae
+next_plt_entry(ul *p,ul *pe) {
385abae
+
385abae
+  ul l0=0xe5bef000,/*ldr pc,[ip,#]*/
385abae
+     l1=0xe5bcf000;/*ldr pc,[lr,#]*/
385abae
+
385abae
+  for (;p
385abae
+  if ((*p&l0)==l0) p++;
385abae
+
385abae
+  return p+1;
385abae
+
385abae
+}
385abae
+
385abae
+static int
385abae
+find_special_params(void *v,Shdr *sec1,Shdr *sece,const char *sn,
385abae
+		    const char *st1,Sym *ds1,Sym *dse,Sym *sym,Sym *syme) {
385abae
+
385abae
+  Shdr *sec,*psec;
385abae
+  Rel *r;
385abae
+  ul *p,*pe;
385abae
+  void *ve;
385abae
+
385abae
+  /*plt entries are not of uniform size*/
385abae
+
385abae
+  massert(psec=get_section(".plt",sec1,sece,sn));
385abae
+  p=(void *)psec->sh_addr;
385abae
+  pe=(void *)p+psec->sh_size;
385abae
+
385abae
+  massert((sec=get_section( ".rel.plt",sec1,sece,sn)) ||
385abae
+	  (sec=get_section(".rela.plt",sec1,sece,sn)));
385abae
+
385abae
+  v+=sec->sh_offset;
385abae
+  ve=v+sec->sh_size;
385abae
+
385abae
+  p=next_plt_entry(p,pe);/*plt0*/
385abae
+
385abae
+  for (r=v;v<ve && p<pe;v+=sec->sh_entsize,r=v,p=next_plt_entry(p,pe)) {
385abae
+    if (!ds1[ELF_R_SYM(r->r_info)].st_value)
385abae
+      ds1[ELF_R_SYM(r->r_info)].st_value=(ul)p;
385abae
+  }
385abae
+
385abae
+  massert(p==pe);
385abae
+  massert(v==ve);
385abae
+
385abae
+  return 0;
385abae
+
385abae
+}
385abae
+
385abae
+static int
385abae
+label_got_symbols(void *v1,Shdr *sec1,Shdr *sece,Sym *sym1,Sym *syme,const char *st1,const char *sn,ul *gs) {
385abae
+
385abae
+  Rel *r;
385abae
+  Sym *sym;
385abae
+  Shdr *sec;
385abae
+  void *v,*ve;
385abae
+
385abae
+  for (sym=sym1;sym
385abae
+    sym->st_size=0;
385abae
+
385abae
+  for (*gs=0,sec=sec1;sec
385abae
+    if (sec->sh_type==SHT_REL)
385abae
+      for (v=v1+sec->sh_offset,ve=v+sec->sh_size,r=v;v<ve;v+=sec->sh_entsize,r=v)
385abae
+	if (
385abae
+#define R_ARM_THM_CALL        10
385abae
+	    ELF_R_TYPE(r->r_info)==R_ARM_THM_CALL ||
385abae
+	    ELF_R_TYPE(r->r_info)==R_ARM_THM_JUMP24
385abae
+	    ) {
385abae
+
385abae
+	  sym=sym1+ELF_R_SYM(r->r_info);
385abae
+
385abae
+	  if (!sym->st_size)
385abae
+	    sym->st_size=++*gs;
385abae
+
385abae
+	}
385abae
+
385abae
+  (*gs)*=tz;
385abae
+
385abae
+  return 0;
385abae
+
385abae
+}
385abae
--- gcl-2.6.12.orig/makedefc.in
385abae
+++ gcl-2.6.12/makedefc.in
385abae
@@ -6,10 +6,6 @@
385abae
 # for main link of raw_gcl
385abae
 LIBS=@LIBS@
385abae
 
385abae
-#The multi precision library stuff
385abae
-MPFILES=$(MPDIR)/@MPI_FILE@ $(MPDIR)/libmport.a
385abae
-
385abae
-
385abae
 # root for the installation, eg /usr/local
385abae
 # This would cause make install to create /usr/local/bin/gcl and
385abae
 # /usr/local/lib/gcl-2-??/* with some basic files.
385abae
--- gcl-2.6.12.orig/o/unexelf.c
385abae
+++ gcl-2.6.12/o/unexelf.c
385abae
@@ -887,7 +887,7 @@ unexec (char *new_name, char *old_name,
385abae
 
385abae
   /* Walk through all section headers, insert the new data2 section right
385abae
      before the new bss section. */
385abae
-  for (n = 1, nn = 1; n < (int) old_file_h->e_shnum; n++, nn++)
385abae
+  for (n = 0, nn = 0; n < (int) old_file_h->e_shnum; n++, nn++)
385abae
     {
385abae
       caddr_t src;
385abae
       /* If it is (s)bss section, insert the new data2 section before it.  */