gas .macro quirks, and an ARM bug

Nick Clifton nickc@cygnus.com
Thu Jun 8 12:18:00 GMT 2000


Hi Andrew,

: 4) ARM Specific:  The .byte directive causes a long to be assembled
: instead of a byte.
: 
: Example:
: 	.macro	hello	arg1
: 		.data
: 		.byte	(2f - 1f)
: 1:		.ascii	"\arg1"
: 2:
: 	.endm
: 	hello	"hello world"
: 
: a.out:     file format elf32-littlearm
: Contents of section .text:
: Contents of section .data:
:  0000 0b000000 6c6f2077 6f726c64           ....lo world
: Disassembly of section .text:
: 
: Notice how the "hel" bytes have been overwritten.


I have now tracked this down.  It was a simple omission in
cons_fix_new_arm.  I am going to check in the patch below to fix thios
problem.

Cheers
	Nick

PS. By the way I have not chekced in the other patch that I posted,
just in case anybody wants to comment on it or correct it.


2000-06-08  Nick Clifton  <nickc@cygnus.com>

	* config/tc-arm.c (cons_fix_new_arm): Assign correct reloc value
	for size 1 fixes.

Index: tc-arm.c
===================================================================
RCS file: /cvs/src//src/gas/config/tc-arm.c,v
retrieving revision 1.45
diff -p -r1.45 tc-arm.c
*** tc-arm.c	2000/06/02 02:52:10	1.45
--- tc-arm.c	2000/06/08 19:10:13
*************** cons_fix_new_arm (frag, where, size, exp
*** 6897,6909 ****
  {
    bfd_reloc_code_real_type type;
    int pcrel = 0;
!   
!   /* Pick a reloc ...
!    *
!    * @@ Should look at CPU word size.
!    */
    switch (size) 
      {
      case 2:
        type = BFD_RELOC_16;
        break;
--- 6897,6910 ----
  {
    bfd_reloc_code_real_type type;
    int pcrel = 0;
! 
!   /* Pick a reloc.
!      FIXME: @@ Should look at CPU word size.  */
    switch (size) 
      {
+     case 1:
+       type = BFD_RELOC_8;
+       break;
      case 2:
        type = BFD_RELOC_16;
        break;


More information about the Binutils mailing list