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]

More H8 assembler changes




Some of my own code plus trivial reworks of some of Joern's code.

        * config/tc-h8300.c (build_bytes): For OBJ_ELF, make relocation's
        offset match H8 ELF spec.
        (md_section_align): Alternate implementation for BFD_ASSEMBLER.
        (md_apply_fix): Fix argument and return types for BFD_ASSEMBLER.

Index: tc-h8300.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/tc-h8300.c,v
retrieving revision 1.78
diff -c -3 -p -r1.78 tc-h8300.c
*** tc-h8300.c	2001/08/31 17:45:30	1.78
--- tc-h8300.c	2001/08/31 22:28:42
*************** build_bytes (this_try, operand)
*** 1140,1145 ****
--- 1140,1155 ----
  	}
        else if (x & ABSJMP)
  	{
+ 	  int where = 0;
+ 
+ #ifdef OBJ_ELF
+ 	  /* To be compatible with the proposed H8 ELF format, we
+ 	     want the relocation's offset to point to the first byte
+ 	     that will be modified, not to the start of the instruction.  */
+ 	  where += 1;
+ 
+ 	     
+ #endif
  	  /* This jmp may be a jump or a branch.  */
  
  	  check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@");
*************** build_bytes (this_try, operand)
*** 1152,1158 ****
  	    operand[i].exp.X_add_number =
  	      ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000;
  	  fix_new_exp (frag_now,
! 		       output - frag_now->fr_literal,
  		       4,
  		       &operand[i].exp,
  		       0,
--- 1162,1168 ----
  	    operand[i].exp.X_add_number =
  	      ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000;
  	  fix_new_exp (frag_now,
! 		       output - frag_now->fr_literal + where,
  		       4,
  		       &operand[i].exp,
  		       0,
*************** md_convert_frag (headers, seg, fragP)
*** 1458,1478 ****
    abort ();
  }
  
  valueT
  md_section_align (seg, size)
       segT seg;
       valueT size;
  {
    return ((size + (1 << section_alignment[(int) seg]) - 1)
! 	  & (-1 << section_alignment[(int) seg]));
  }
  
  void
  md_apply_fix (fixP, val)
       fixS *fixP;
       long val;
  {
    char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
  
    switch (fixP->fx_size)
      {
--- 1468,1510 ----
    abort ();
  }
  
+ #ifdef BFD_ASSEMBLER
+ valueT
+ md_section_align (segment, size)
+      segT segment;
+      valueT size;
+ {
+   int align = bfd_get_section_alignment (stdoutput, segment);
+   return ((size + (1 << align) - 1) & (-1 << align));
+ }
+ #else
  valueT
  md_section_align (seg, size)
       segT seg;
       valueT size;
  {
    return ((size + (1 << section_alignment[(int) seg]) - 1)
!           & (-1 << section_alignment[(int) seg]));
  }
+ #endif
+ 
  
+ #ifdef BFD_ASSEMBLER
+ int
+ md_apply_fix (fixP, valp)
+      fixS *fixP;
+      valueT *valp;
+ #else
  void
  md_apply_fix (fixP, val)
       fixS *fixP;
       long val;
+ #endif
  {
    char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
+ #ifdef BFD_ASSEMBLER
+   long val = *valp;
+ #endif
  
    switch (fixP->fx_size)
      {




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