H8S Bug when using -relax for h8300-elf

Nick Clifton nickc@redhat.com
Wed Apr 30 11:56:00 GMT 2003


Hi Shrinivas,

> Thank you for sending the patch. 
> 
> With this patch h8300-elf-ld does not core dump. Hence the ld
> crashing problem is solved.

Excellent.

> However, the objdump shows that still 24 bit absolute address is
> used.  Whereas in this case usage of -relax switch should make it 8
> bit absolute address. Which it is not doing.
> 
> Any clue ?

Yes - my patch just stops the linker from core dumping, it does not
implement relaxing for this form of addressing mode.  That is because
I am completely unfamiliar with the H8300 instruction set, so I do not
know how the instruction should be relaxed.

If you would care to look over the code in elf32_h8_relax_section()
you may be able to work out what needs to be done.  I assume that this
part of the patch:

> ! 		  case 0x20:
> ! 		  case 0xa0:
> ! 		    /* Skip 32bit versions.  */
> ! 		    skip = TRUE;
> ! 		    break;

needs to be changed to be similar to this part:

> ! 		  case 0x00:
> ! 		    bfd_put_8 (abfd, (code & 0xf) | 0x20,
>   			       contents + irel->r_offset - 2);
> ! 		    break;
> ! 		  case 0x80:
> ! 		    bfd_put_8 (abfd, (code & 0xf) | 0x30,
>   			       contents + irel->r_offset - 2);
> ! 		    break;

Cheers
        Nick



More information about the Binutils mailing list