From 47e70c54174be52f55eb38fe8630af68ef9c2b42 Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Thu, 24 Mar 1994 19:45:23 +0000 Subject: [PATCH] Thu Mar 24 11:33:46 1994 Steve Chamberlain (sac@jonny.cygnus.com) * coff-h8300.c (h8300_reloc16_extra_cases): Add relaxing info for 16bit relative branches. * coff-h8500.c (r_high8, r_low16, r_high16): Don't complain on overflow. --- bfd/ChangeLog | 7 +++++++ bfd/coff-h8300.c | 48 +++++++++++++++++++++++++++++++++++------------- bfd/coff-h8500.c | 10 +++++----- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 59531159a90..0bbb37a9890 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +Thu Mar 24 11:33:46 1994 Steve Chamberlain (sac@jonny.cygnus.com) + + * coff-h8300.c (h8300_reloc16_extra_cases): Add relaxing info + for 16bit relative branches. + * coff-h8500.c (r_high8, r_low16, r_high16): Don't complain on + overflow. + Thu Mar 24 09:21:13 1994 Jeffrey A. Law (law@snake.cs.utah.edu) * som.c (som_bfd_prep_for_ar_write): Ignore non-SOM objects. diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 75b7a81435e..54aa02809cf 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -1,5 +1,5 @@ /* BFD back-end for Hitachi H8/300 COFF binaries. - Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. Written by Steve Chamberlain, . This file is part of BFD, the Binary File Descriptor library. @@ -53,7 +53,7 @@ static reloc_howto_type howto_table[] = /* Turn a howto into a reloc number */ #define SELECT_RELOC(x,howto) \ - { x = select_reloc(howto); } + { x.r_type = select_reloc(howto); } #define BADMAG(x) (H8300BADMAG(x)&& H8300HBADMAG(x)) #define H8300 1 /* Customize coffcode.h */ @@ -148,12 +148,12 @@ rtype2howto (internal, dst) reloc_processing(relent, reloc, symbols, abfd, section) static void -DEFUN (reloc_processing, (relent, reloc, symbols, abfd, section), - arelent * relent AND - struct internal_reloc *reloc AND - asymbol ** symbols AND - bfd * abfd AND - asection * section) +reloc_processing (relent, reloc, symbols, abfd, section) + arelent * relent; + struct internal_reloc *reloc; + asymbol ** symbols; + bfd * abfd; + asection * section; { relent->address = reloc->r_vaddr; rtype2howto (relent, reloc); @@ -177,9 +177,9 @@ DEFUN (reloc_processing, (relent, reloc, symbols, abfd, section), static int -h8300_reloc16_estimate(input_section, symbols, reloc, shrink, link_info) +h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) + bfd *abfd; asection *input_section; - asymbol **symbols; arelent *reloc; unsigned int shrink; struct bfd_link_info *link_info; @@ -218,7 +218,7 @@ h8300_reloc16_estimate(input_section, symbols, reloc, shrink, link_info) /* The place to relc moves back by one */ /* This will be two bytes smaller in the long run */ shrink +=2 ; - bfd_perform_slip(symbols, 2, input_section, address); + bfd_perform_slip(abfd, 2, input_section, address); } break; @@ -246,7 +246,7 @@ h8300_reloc16_estimate(input_section, symbols, reloc, shrink, link_info) reloc->howto = reloc->howto + 1; /* This will be two bytes smaller in the long run */ shrink +=2 ; - bfd_perform_slip(symbols, 2, input_section, address); + bfd_perform_slip(abfd, 2, input_section, address); } break; @@ -274,7 +274,7 @@ h8300_reloc16_estimate(input_section, symbols, reloc, shrink, link_info) /* This will be two bytes smaller in the long run */ shrink +=2 ; - bfd_perform_slip(symbols, 2, input_section, address); + bfd_perform_slip(abfd, 2, input_section, address); } break; } @@ -334,6 +334,28 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, dst_address++; src_address++; + break; + } + case R_PCRWORD: + { + bfd_vma dot = link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma; + int gap = (bfd_coff_reloc16_get_value (reloc, link_info, input_section) + - dot) + 1; + if (gap > 32767 || gap < -32768) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + + bfd_put_16 (abfd, gap, data + dst_address); + dst_address+=2; + src_address+=2; + break; } diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c index fec25d72bf3..cf87258862b 100644 --- a/bfd/coff-h8500.c +++ b/bfd/coff-h8500.c @@ -1,5 +1,5 @@ /* BFD back-end for Hitachi H8/500 COFF binaries. - Copyright 1993 Free Software Foundation, Inc. + Copyright 1993, 1994 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, . @@ -47,11 +47,11 @@ HOWTO (R_H8500_IMM32, 0, 1, 32, false, 0, static reloc_howto_type r_high8 = HOWTO (R_H8500_HIGH8, 0, 1, 8, false, 0, - complain_overflow_bitfield, 0, "r_high8", true, 0x000000ff, 0x000000ff, false); + complain_overflow_dont, 0, "r_high8", true, 0x000000ff, 0x000000ff, false); static reloc_howto_type r_low16 = HOWTO (R_H8500_LOW16, 0, 1, 16, false, 0, - complain_overflow_bitfield, 0, "r_low16", true, 0x0000ffff, 0x0000ffff, false); + complain_overflow_dont, 0, "r_low16", true, 0x0000ffff, 0x0000ffff, false); static reloc_howto_type r_pcrel8 = HOWTO (R_H8500_PCREL8, 0, 1, 8, true, 0, complain_overflow_signed, 0, "r_pcrel8", true, 0, 0, true); @@ -62,7 +62,7 @@ HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel static reloc_howto_type r_high16 = HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0, - complain_overflow_bitfield, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false); + complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false); /* Turn a howto into a reloc number */ @@ -74,7 +74,7 @@ coff_h8500_select_reloc (howto) return howto->type; } -#define SELECT_RELOC(x,howto) x= coff_h8500_select_reloc(howto) +#define SELECT_RELOC(x,howto) x.r_type = coff_h8500_select_reloc(howto) #define BADMAG(x) H8500BADMAG(x) -- 2.30.2