[comp.sys.nsc.32k] Gcc 1.39

jkp@sauna.hut.fi (Jyrki Kuoppala) (03/06/91)

I switched to 32-bit structure alignment anyway. I was wrong, the
problem isn't in the file system, just struct stat and probably some
others.  So you'll just have to recompile the kernel, libraries and
binaries, not to redo your file system.

After changing the alignment, the problem with gas coredumping on
gdb's dbxread.c and regex.c went away.  But I suspect the problem
still is there and bigger alignment only hides it.  Might be that the
kludge below fixes the problem, but I wouldn't trust on that.

The diffs in nic.funet.fi:pub/misc/pc532/diffs-1.5 have been updated.

Also, I kludged together a 'fix' to make gas 1.38.1 work with
pc-relative addressing for things like movd _foo(pc),_bar(pc).  Here's
the diff.  After you add this, you can define PC_RELATIVE in
tm-pc532.h for better performance.

*** or/gas-1.38/ns32k.c	Fri Oct 26 19:14:08 1990
--- gas-1.38/ns32k.c	Tue Mar  5 15:06:48 1991
***************
*** 1019,1024 ****
--- 1019,1029 ----
    register char type;
    register char size = 0;
    int	size_so_far=0; /* used to calculate pcrel_adjust */
+   int   pcrel_symbols=0;	/* kludge by jkp@hut.fi to make
+ 				   movd _foo(pc),_bar(pc) work.
+ 				   It should be done with two frags
+ 				   for one insn, but I don't understand
+ 				   enough to make it work */
  
      rem_size=iif.instr_size;
      memP=frag_more(iif.instr_size); /* make sure we have enough bytes for instruction */
***************
*** 1025,1030 ****
--- 1030,1043 ----
      inst_opcode=memP;
      inst_offset=(char*)(memP-frag_now->fr_literal);
      inst_frag=frag_now;
+     for (i=0;i<IIF_ENTRIES;i++) { /* jkp kludge alert */
+       if (iif.iifP[i].type && iif.iifP[i].size == 0 &&
+ 	  iif.iifP[i].pcrel) {
+ 	evaluate_expr(&exprP,(char*)iif.iifP[i].object);
+ 	if (exprP.X_add_symbol || exprP.X_subtract_symbol)
+ 	     pcrel_symbols++;
+       }	   
+     }
      for (i=0;i<IIF_ENTRIES;i++) {
        if (type=iif.iifP[i].type) {			/* the object exist, so handle it */
  	switch (size=iif.iifP[i].size) {
***************
*** 1139,1146 ****
  	  {
  	    int temp;
  	    segment=evaluate_expr(&exprP,(char*)iif.iifP[i].object);
! 	    if ((exprP.X_add_symbol || exprP.X_subtract_symbol) &&
! 		!iif.iifP[i].pcrel) { /* OVE: hack, clamp to 4 bytes */
  	      size=4; /* we dont wan't to frag this, use 4 so it reaches */
  	      fix_new_ns32k(frag_now,
  			    (long)(memP-frag_now->fr_literal),
--- 1152,1159 ----
  	  {
  	    int temp;
  	    segment=evaluate_expr(&exprP,(char*)iif.iifP[i].object);
! 	    if (((exprP.X_add_symbol || exprP.X_subtract_symbol) &&
! 		!iif.iifP[i].pcrel) || pcrel_symbols >= 2 /* jkp*/) { /* OVE: hack, clamp to 4 bytes */
  	      size=4; /* we dont wan't to frag this, use 4 so it reaches */
  	      fix_new_ns32k(frag_now,
  			    (long)(memP-frag_now->fr_literal),
***************
*** 1148,1154 ****
  			    exprP.X_add_symbol,
  			    exprP.X_subtract_symbol,
  			    exprP.X_add_number,
! 			    0, /* never iif.iifP[i].pcrel, */
  			    (char)size_so_far, /*iif.iifP[i].pcrel_adjust,*/
  			    1, /* always iif.iifP[i].im_disp, */
  			    0,0);
--- 1161,1167 ----
  			    exprP.X_add_symbol,
  			    exprP.X_subtract_symbol,
  			    exprP.X_add_number,
! 			    pcrel_symbols >= 2 ? iif.iifP[i].pcrel : 0, /*jkp*//* never iif.iifP[i].pcrel, */
  			    (char)size_so_far, /*iif.iifP[i].pcrel_adjust,*/
  			    1, /* always iif.iifP[i].im_disp, */
  			    0,0);

//Jyrki