changeset 156:da529eab5618

static initialization powerpc static bug
author kono
date Tue, 05 Aug 2003 14:15:33 +0900
parents ccb2002d8a31
children d5310a5cc8fa
files Changes mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-parse.c
diffstat 5 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Tue Aug 05 13:00:16 2003 +0900
+++ b/Changes	Tue Aug 05 14:15:33 2003 +0900
@@ -3296,3 +3296,11 @@
 
 PowerPC の場合は、PIC symbol がやっぱり遅いね。
 こいつをなんとかするだけでだいぶ違うかも知れない。
+
+Tue Aug  5 13:53:43 JST 2003
+
+む、なんか、もう、そうなってるじゃん。
+
+関数scope 内の staticの初期化が通らないんですけど。
+
+直りました。対応してなかったみたいね。
--- a/mc-code-ia32.c	Tue Aug 05 13:00:16 2003 +0900
+++ b/mc-code-ia32.c	Tue Aug 05 14:15:33 2003 +0900
@@ -1529,7 +1529,7 @@
     float f;
     char *name;
     name = n->nm; 
-    if(mode!=GDECL)  { 
+    if(mode!=GDECL && mode!=STADECL)  { 
 	error(-1); return;
     }
     if (chk) return;
@@ -1627,7 +1627,8 @@
 		data_mode(0);
 		init=1;
 	    }
-	    printf(".lcomm %s,%d\n",n->nm,size(n->ty));
+	    if (n->dsp!= -1) /* -1 means initialized global */
+		printf(".lcomm %s,%d\n",n->nm,size(n->ty));
 	}
     }
 }
--- a/mc-code-mips.c	Tue Aug 05 13:00:16 2003 +0900
+++ b/mc-code-mips.c	Tue Aug 05 14:15:33 2003 +0900
@@ -2169,7 +2169,7 @@
     float f;
     char *name;
     name = n->nm; 
-    if(mode!=GDECL)  { 
+    if(mode!=GDECL&&mode!=STADECL)  { 
 	error(-1); return;
     }
     if (chk) return;
@@ -2278,6 +2278,7 @@
 		data_mode(0);
 		init=1;
 	    }
+	    if (n->dsp!=-1) /* n->dsp = -1 means initialized global */
 	    printf(".lcomm _%s,%d\n",n->nm,size(n->ty));
 	}
     }
--- a/mc-code-powerpc.c	Tue Aug 05 13:00:16 2003 +0900
+++ b/mc-code-powerpc.c	Tue Aug 05 14:15:33 2003 +0900
@@ -2072,7 +2072,7 @@
     float f;
     char *name;
     name = n->nm; 
-    if(mode!=GDECL)  { 
+    if(mode!=GDECL && mode!=STADECL)  { 
 	error(-1); return;
     }
     if (chk) return;
@@ -2236,7 +2236,9 @@
 		data_mode(0);
 		init=1;
 	    }
-	    printf(".lcomm _%s,%d\n",n->nm,size(n->ty));
+	    if (n->dsp != -1) /* initialized static */
+		printf(".lcomm _%s,%d\n",n->nm,size(n->ty));
+	    printf("L_%s$non_lazy_ptr:\n\t.long\t_%s\n",n->nm,n->nm);
 	}
     }
 }
--- a/mc-parse.c	Tue Aug 05 13:00:16 2003 +0900
+++ b/mc-parse.c	Tue Aug 05 14:15:33 2003 +0900
@@ -939,6 +939,9 @@
     if(mode==GDECL) {
  	emit_data(e,t,n);
 	return offset+size(t);
+    } else if(mode==STADECL) {
+ 	emit_data(e,t,n);
+	return offset+size(t);
     } else if(mode==LDECL) {
 	ass = assign_expr0(list2(LVAR,n->dsp+offset),e,t,type);
 	init_vars = list2(ass,init_vars);