This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] to gas: fix for m68k !BFD_ASSEMBLER


OK guys,

As promised, here is the fix for m68k !BFD_ASSEMBLER gas breakage from my
earlier patch. Tested on m68k-aout (!BFD_ASSEMBLER) and m68k-elf
(BFD_ASSEMBLER).

The breakage was caused by my earlier change using BFD_RELOC_* instead of
NO_RELOC when making fixes in the relaxer. In case you haven't guessed this
already, this is in preparation for ELF linker relaxation. The problem is that
BFD_RELOC_* exist only for BFD_ASSEMBLER. My solution here is to use newly
invented RELAX_RELOC_*, defined for BFD_ASSEMBLER to the corresponding
BFD_RELOC_* and for !BFD_ASSEMBLER to 0, just like NO_RELOC that was used
before.

(And yes, Nick, I'll still keep my promise of looking at the testsuite failures
soon. To my great joy my new boss fell in love with DEC hardware and is signing
all my POs for big new VAXen. I'm just waiting now for PacBell to bring the T1
for them and then I'll have all the computing power in the world for
development and testing.)

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

2000-10-14  Michael Sokolov  <msokolov@ivan.Harhan.ORG>

	* config/tc-m68k.h (RELAX_RELOC_*): New definitions for both
	BFD_ASSEMBLER and !BFD_ASSEMBLER.
	* config/tc-m68k.c (md_convert_frag_1): Use them instead of
	BFD_RELOC_*.

Index: config/tc-m68k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.c,v
retrieving revision 1.12
diff -c -r1.12 tc-m68k.c
*** tc-m68k.c	2000/09/26 07:09:18	1.12
--- tc-m68k.c	2000/10/14 19:23:09
***************
*** 4359,4365 ****
        if (disp == 0)
  	as_bad (_("short branch with zero offset: use :w"));
        fixP = fix_new (fragP, fragP->fr_fix - 1, 1, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, BFD_RELOC_8_PCREL);
        fixP->fx_pcrel_adjust = -1;
        break;
      case TAB (BRANCHBWL, SHORT):
--- 4359,4365 ----
        if (disp == 0)
  	as_bad (_("short branch with zero offset: use :w"));
        fixP = fix_new (fragP, fragP->fr_fix - 1, 1, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, RELAX_RELOC_PC8);
        fixP->fx_pcrel_adjust = -1;
        break;
      case TAB (BRANCHBWL, SHORT):
***************
*** 4368,4380 ****
      case TAB (BRANCHBW, SHORT):
        fragP->fr_opcode[1] = 0x00;
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, BFD_RELOC_16_PCREL);
        fragP->fr_fix += 2;
        break;
      case TAB (BRANCHBWL, LONG):
        fragP->fr_opcode[1] = (char) 0xFF;
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 	       1, BFD_RELOC_32_PCREL);
        fragP->fr_fix += 4;
        break;
      case TAB (BRABSJUNC, LONG):
--- 4368,4380 ----
      case TAB (BRANCHBW, SHORT):
        fragP->fr_opcode[1] = 0x00;
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, RELAX_RELOC_PC16);
        fragP->fr_fix += 2;
        break;
      case TAB (BRANCHBWL, LONG):
        fragP->fr_opcode[1] = (char) 0xFF;
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 	       1, RELAX_RELOC_PC32);
        fragP->fr_fix += 4;
        break;
      case TAB (BRABSJUNC, LONG):
***************
*** 4383,4389 ****
  	  fragP->fr_opcode[0] = 0x4E;
  	  fragP->fr_opcode[1] = (char) 0xB9; /* JSR with ABSL LONG operand */
  	  fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 		   0, BFD_RELOC_32);
  	  fragP->fr_fix += 4;
  	}
        else if (fragP->fr_opcode[0] == 0x60)	/* jbra */
--- 4383,4389 ----
  	  fragP->fr_opcode[0] = 0x4E;
  	  fragP->fr_opcode[1] = (char) 0xB9; /* JSR with ABSL LONG operand */
  	  fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 		   0, RELAX_RELOC_ABS32);
  	  fragP->fr_fix += 4;
  	}
        else if (fragP->fr_opcode[0] == 0x60)	/* jbra */
***************
*** 4391,4397 ****
  	  fragP->fr_opcode[0] = 0x4E;
  	  fragP->fr_opcode[1] = (char) 0xF9; /* JMP with ABSL LONG operand */
  	  fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 		   0, BFD_RELOC_32);
  	  fragP->fr_fix += 4;
  	}
        else
--- 4391,4397 ----
  	  fragP->fr_opcode[0] = 0x4E;
  	  fragP->fr_opcode[1] = (char) 0xF9; /* JMP with ABSL LONG operand */
  	  fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 		   0, RELAX_RELOC_ABS32);
  	  fragP->fr_fix += 4;
  	}
        else
***************
*** 4415,4439 ****
        *buffer_address++ = (char) 0xf9;
        fragP->fr_fix += 2;	/* account for jmp instruction */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
! 	       fragP->fr_offset, 0, BFD_RELOC_32);
        fragP->fr_fix += 4;
        break;
      case TAB (FBRANCH, SHORT):
        know ((fragP->fr_opcode[1] & 0x40) == 0);
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, BFD_RELOC_16_PCREL);
        fragP->fr_fix += 2;
        break;
      case TAB (FBRANCH, LONG):
        fragP->fr_opcode[1] |= 0x40;	/* Turn on LONG bit */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 	       1, BFD_RELOC_32_PCREL);
        fragP->fr_fix += 4;
        break;
      case TAB (DBCCLBR, SHORT):
      case TAB (DBCCABSJ, SHORT):
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, BFD_RELOC_16_PCREL);
        fragP->fr_fix += 2;
        break;
      case TAB (DBCCLBR, LONG):
--- 4415,4439 ----
        *buffer_address++ = (char) 0xf9;
        fragP->fr_fix += 2;	/* account for jmp instruction */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
! 	       fragP->fr_offset, 0, RELAX_RELOC_ABS32);
        fragP->fr_fix += 4;
        break;
      case TAB (FBRANCH, SHORT):
        know ((fragP->fr_opcode[1] & 0x40) == 0);
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, RELAX_RELOC_PC16);
        fragP->fr_fix += 2;
        break;
      case TAB (FBRANCH, LONG):
        fragP->fr_opcode[1] |= 0x40;	/* Turn on LONG bit */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 	       1, RELAX_RELOC_PC32);
        fragP->fr_fix += 4;
        break;
      case TAB (DBCCLBR, SHORT):
      case TAB (DBCCABSJ, SHORT):
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, RELAX_RELOC_PC16);
        fragP->fr_fix += 2;
        break;
      case TAB (DBCCLBR, LONG):
***************
*** 4450,4456 ****
  
        fragP->fr_fix += 6;	/* account for bra/jmp instructions */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, 1,
! 	       BFD_RELOC_32_PCREL);
        fragP->fr_fix += 4;
        break;
      case TAB (DBCCABSJ, LONG):
--- 4450,4456 ----
  
        fragP->fr_fix += 6;	/* account for bra/jmp instructions */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, 1,
! 	       RELAX_RELOC_PC32);
        fragP->fr_fix += 4;
        break;
      case TAB (DBCCABSJ, LONG):
***************
*** 4467,4480 ****
  
        fragP->fr_fix += 6;	/* account for bra/jmp instructions */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, 0,
! 	       BFD_RELOC_32);
        fragP->fr_fix += 4;
        break;
      case TAB (PCREL1632, SHORT):
        fragP->fr_opcode[1] &= ~0x3F;
        fragP->fr_opcode[1] |= 0x3A; /* 072 - mode 7.2 */
        fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
! 	       fragP->fr_offset, 1, BFD_RELOC_16_PCREL);
        fragP->fr_fix += 2;
        break;
      case TAB (PCREL1632, LONG):
--- 4467,4480 ----
  
        fragP->fr_fix += 6;	/* account for bra/jmp instructions */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, 0,
! 	       RELAX_RELOC_ABS32);
        fragP->fr_fix += 4;
        break;
      case TAB (PCREL1632, SHORT):
        fragP->fr_opcode[1] &= ~0x3F;
        fragP->fr_opcode[1] |= 0x3A; /* 072 - mode 7.2 */
        fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
! 	       fragP->fr_offset, 1, RELAX_RELOC_PC16);
        fragP->fr_fix += 2;
        break;
      case TAB (PCREL1632, LONG):
***************
*** 4484,4490 ****
        *buffer_address++ = 0x70;
        fragP->fr_fix += 2;
        fixP = fix_new (fragP, (int) (fragP->fr_fix), 4, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, BFD_RELOC_32_PCREL);
        fixP->fx_pcrel_adjust = 2;
        fragP->fr_fix += 4;
        break;
--- 4484,4490 ----
        *buffer_address++ = 0x70;
        fragP->fr_fix += 2;
        fixP = fix_new (fragP, (int) (fragP->fr_fix), 4, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, RELAX_RELOC_PC32);
        fixP->fx_pcrel_adjust = 2;
        fragP->fr_fix += 4;
        break;
***************
*** 4492,4498 ****
        assert (fragP->fr_fix >= 2);
        buffer_address[-2] &= ~1;
        fixP = fix_new (fragP, fragP->fr_fix - 1, 1, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, BFD_RELOC_8_PCREL);
        fixP->fx_pcrel_adjust = 1;
        break;
      case TAB (PCINDEX, SHORT):
--- 4492,4498 ----
        assert (fragP->fr_fix >= 2);
        buffer_address[-2] &= ~1;
        fixP = fix_new (fragP, fragP->fr_fix - 1, 1, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, RELAX_RELOC_PC8);
        fixP->fx_pcrel_adjust = 1;
        break;
      case TAB (PCINDEX, SHORT):
***************
*** 4500,4506 ****
        buffer_address[-2] |= 0x1;
        buffer_address[-1] = 0x20;
        fixP = fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, BFD_RELOC_16_PCREL);
        fixP->fx_pcrel_adjust = 2;
        fragP->fr_fix += 2;
        break;
--- 4500,4506 ----
        buffer_address[-2] |= 0x1;
        buffer_address[-1] = 0x20;
        fixP = fix_new (fragP, (int) (fragP->fr_fix), 2, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, RELAX_RELOC_PC16);
        fixP->fx_pcrel_adjust = 2;
        fragP->fr_fix += 2;
        break;
***************
*** 4509,4521 ****
        buffer_address[-2] |= 0x1;
        buffer_address[-1] = 0x30;
        fixP = fix_new (fragP, (int) (fragP->fr_fix), 4, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, BFD_RELOC_32_PCREL);
        fixP->fx_pcrel_adjust = 2;
        fragP->fr_fix += 4;
        break;
      case TAB (ABSTOPCREL, SHORT):
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, BFD_RELOC_16_PCREL);
        fragP->fr_fix += 2;
        break;
      case TAB (ABSTOPCREL, LONG):
--- 4509,4521 ----
        buffer_address[-2] |= 0x1;
        buffer_address[-1] = 0x30;
        fixP = fix_new (fragP, (int) (fragP->fr_fix), 4, fragP->fr_symbol,
! 		      fragP->fr_offset, 1, RELAX_RELOC_PC32);
        fixP->fx_pcrel_adjust = 2;
        fragP->fr_fix += 4;
        break;
      case TAB (ABSTOPCREL, SHORT):
        fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
! 	       1, RELAX_RELOC_PC16);
        fragP->fr_fix += 2;
        break;
      case TAB (ABSTOPCREL, LONG):
***************
*** 4526,4532 ****
        fragP->fr_opcode[1] &= ~0x3F;
        fragP->fr_opcode[1] |= 0x39;	/* Mode 7.1 */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 	       0, BFD_RELOC_32);
        fragP->fr_fix += 4;
        break;
      }
--- 4526,4532 ----
        fragP->fr_opcode[1] &= ~0x3F;
        fragP->fr_opcode[1] |= 0x39;	/* Mode 7.1 */
        fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset,
! 	       0, RELAX_RELOC_ABS32);
        fragP->fr_fix += 4;
        break;
      }
Index: config/tc-m68k.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.h,v
retrieving revision 1.7
diff -c -r1.7 tc-m68k.h
*** tc-m68k.h	2000/09/26 07:09:18	1.7
--- tc-m68k.h	2000/10/14 19:23:10
***************
*** 157,162 ****
--- 157,168 ----
  while (0)
  
  #define NO_RELOC BFD_RELOC_NONE
+ #define RELAX_RELOC_ABS8 BFD_RELOC_8
+ #define RELAX_RELOC_ABS16 BFD_RELOC_16
+ #define RELAX_RELOC_ABS32 BFD_RELOC_32
+ #define RELAX_RELOC_PC8 BFD_RELOC_8_PCREL
+ #define RELAX_RELOC_PC16 BFD_RELOC_16_PCREL
+ #define RELAX_RELOC_PC32 BFD_RELOC_32_PCREL
  
  #ifdef OBJ_ELF
  
***************
*** 195,200 ****
--- 201,212 ----
  #define tc_frob_coff_symbol(sym) m68k_frob_symbol (sym)
  
  #define NO_RELOC 0
+ #define RELAX_RELOC_ABS8 0
+ #define RELAX_RELOC_ABS16 0
+ #define RELAX_RELOC_ABS32 0
+ #define RELAX_RELOC_PC8 0
+ #define RELAX_RELOC_PC16 0
+ #define RELAX_RELOC_PC32 0
  
  #endif /* ! BFD_ASSEMBLER */
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]