PATCH: Use printing 32-bit complex reloc values

Nick Clifton nickc@redhat.com
Wed Jul 4 12:00:00 GMT 2007


Hi Guys,

  I am applying the patch below to fix a small problem with the
  code to generate the name of a symbol involved in a complex reloc.
  The problem was that sprintf_vma was being called directly which
  would result in a 64-bit value being put into the reloc if the
  assembler was running on a 64-bit host, even if the target
  architecture was only a 32-bit architecture.  The solution is to use
  the bfd_sprintf_vma function which handles this sort of thing
  correctly.

Cheers
  Nick

gas/ChangeLog
2007-07-04  Nick Clifton  <nickc@redhat.com>

	* symbols.c (symbol_relc_make_value): Use bfd_sprintf_vma in order
	to get the right length of printed value.

Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.85
diff -c -3 -p -r1.85 symbols.c
*** gas/symbols.c	3 Jul 2007 11:01:03 -0000	1.85
--- gas/symbols.c	4 Jul 2007 11:11:41 -0000
*************** symbol_relc_make_value (offsetT val)
*** 3004,3010 ****
    char * terminal = xmalloc (28);  /* Enough for long long.  */
  
    terminal[0] = '#';
!   sprintf_vma (& terminal[1], val);
    return terminal;
  }
  
--- 3004,3010 ----
    char * terminal = xmalloc (28);  /* Enough for long long.  */
  
    terminal[0] = '#';
!   bfd_sprintf_vma (stdoutput, terminal + 1, val);
    return terminal;
  }
  



More information about the Binutils mailing list