From cbfe05c4c649f887c078c9b7268e4484fbe5d45c Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 16 Nov 2000 00:54:12 +0000 Subject: [PATCH] 2000-11-15 Kazu Hirata * coff-rs6000.c: Fix formatting. * coff-sh.c: Likewise. * coff-sparc.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-tic80.c: Likewise. * coff-w65.c: Likewise. * coff-we32k.c: Likewise. * coff-z8k.c: Likewise. --- bfd/ChangeLog | 8 +++++++ bfd/coff-rs6000.c | 6 ----- bfd/coff-sh.c | 56 ++++++++++++++++++++++---------------------- bfd/coff-sparc.c | 8 +++---- bfd/coff-tic30.c | 8 +++---- bfd/coff-tic54x.c | 48 ++++++++++++++++++-------------------- bfd/coff-tic80.c | 8 +++---- bfd/coff-w65.c | 59 ++++++++++++++++++----------------------------- bfd/coff-we32k.c | 2 +- bfd/coff-z8k.c | 14 +++-------- 10 files changed, 96 insertions(+), 121 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3ea03b73750..89d0835ca4d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -3,6 +3,14 @@ * coff-arm.c: Fix formatting. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. + * coff-sh.c: Likewise. + * coff-sparc.c: Likewise. + * coff-tic30.c: Likewise. + * coff-tic54x.c: Likewise. + * coff-tic80.c: Likewise. + * coff-w65.c: Likewise. + * coff-we32k.c: Likewise. + * coff-z8k.c: Likewise. 2000-11-15 Richard Henderson diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 86986a504b7..56d356ef910 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1542,7 +1542,6 @@ normalize_filename (abfd) /* Write out an XCOFF armap. */ -/*ARGSUSED*/ static boolean xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) bfd *abfd; @@ -1741,7 +1740,6 @@ xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64, return true; } -/*ARGSUSED*/ static boolean xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) bfd *abfd; @@ -1801,7 +1799,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) return true; } -/*ARGSUSED*/ boolean _bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx) bfd *abfd; @@ -2345,7 +2342,6 @@ _bfd_xcoff_write_archive_contents (abfd) /* We can't use the usual coff_sizeof_headers routine, because AIX always uses an a.out header. */ -/*ARGSUSED*/ int _bfd_xcoff_sizeof_headers (abfd, reloc) bfd *abfd; @@ -2361,5 +2357,3 @@ _bfd_xcoff_sizeof_headers (abfd, reloc) size += abfd->section_count * SCNHSZ; return size; } - - diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 1b78ef4f371..77665d677ae 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/pe.h" #ifndef COFF_IMAGE_WITH_PE -static boolean sh_align_load_span +static boolean sh_align_load_span PARAMS ((bfd *, asection *, bfd_byte *, boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *)); @@ -88,7 +88,7 @@ static boolean in_reloc_p (abfd, howto) reloc_howto_type * howto; { return ! howto->pc_relative && howto->type != R_SH_IMAGEBASE; -} +} #endif /* The supported relocations. There are a lot of relocations defined @@ -171,18 +171,18 @@ static reloc_howto_type sh_coff_howtos[] = EMPTY_HOWTO (15), #ifdef COFF_WITH_PE - HOWTO (R_SH_IMAGEBASE, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ + HOWTO (R_SH_IMAGEBASE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - sh_reloc, /* special_function */ - "rva32", /* name */ - true, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ + sh_reloc, /* special_function */ + "rva32", /* name */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ #else EMPTY_HOWTO (16), /* R_SH_IMM8 */ @@ -391,14 +391,14 @@ static reloc_howto_type sh_coff_howtos[] = /* Get the value of a symbol, when performing a relocation. */ static long -get_symbol_value (symbol) +get_symbol_value (symbol) asymbol *symbol; -{ +{ bfd_vma relocation; if (bfd_is_com_section (symbol->section)) - relocation = 0; - else + relocation = 0; + else relocation = (symbol->value + symbol->section->output_section->vma + symbol->section->output_offset); @@ -676,7 +676,7 @@ sh_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, align load and store instructions on four byte boundaries if we can, by swapping them with one of the adjacent instructions. */ -static boolean +static boolean sh_relax_section (abfd, sec, link_info, again) bfd *abfd; asection *sec; @@ -2144,7 +2144,7 @@ sh_insn_info (insn) return op; } - return NULL; + return NULL; } /* See whether an instruction uses or sets a general purpose register */ @@ -2251,7 +2251,7 @@ sh_insn_uses_freg (insn, op, freg) of a double precision value. So what this all boils down to is that we have to ignore the lowest bit of the register number. */ - + if ((f & USESF1) != 0 && (USESF1_REG (insn) & 0xe) == (freg & 0xe)) return true; @@ -2285,7 +2285,7 @@ sh_insn_sets_freg (insn, op, freg) of a double precision value. So what this all boils down to is that we have to ignore the lowest bit of the register number. */ - + if ((f & SETSF1) != 0 && (SETSF1_REG (insn) & 0xe) == (freg & 0xe)) return true; @@ -2485,7 +2485,7 @@ _bfd_sh_align_load_span (abfd, sec, contents, swap, relocs, if (dsp && i - 2 > start) { unsigned pprev_insn = bfd_get_16 (abfd, contents + i - 4); - + if ((pprev_insn & 0xfc00) == 0xf800) prev_op = NULL; else @@ -2875,7 +2875,7 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, sym = NULL; } else - { + { if (symndx < 0 || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) { @@ -2912,7 +2912,7 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, if (rel->r_type == R_SH_IMAGEBASE) addend -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; #endif - + val = 0; if (h == NULL) @@ -3118,7 +3118,7 @@ CREATE_BIG_COFF_TARGET_VEC (shcoff_vec, "coff-sh", BFD_IS_RELAXABLE, 0, '_', NUL #else #define TARGET_SYM shlcoff_vec #endif - + #ifndef TARGET_SHL_NAME #define TARGET_SHL_NAME "coff-shl" #endif @@ -3270,7 +3270,7 @@ const bfd_target shcoff_small_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), & shlcoff_small_vec, - + (PTR) &bfd_coff_small_swap_table }; @@ -3297,7 +3297,7 @@ const bfd_target shlcoff_small_vec = bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ {_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */ - bfd_generic_archive_p, _bfd_dummy_target}, + bfd_generic_archive_p, _bfd_dummy_target}, {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ bfd_false}, {bfd_false, coff_write_object_contents, /* bfd_write_contents */ @@ -3314,7 +3314,7 @@ const bfd_target shlcoff_small_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), & shcoff_small_vec, - + (PTR) &bfd_coff_small_swap_table }; #endif diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c index 5e919da1f99..93677707830 100644 --- a/bfd/coff-sparc.c +++ b/bfd/coff-sparc.c @@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ enum reloc_type { R_SPARC_NONE = 0, - R_SPARC_8, R_SPARC_16, R_SPARC_32, - R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32, + R_SPARC_8, R_SPARC_16, R_SPARC_32, + R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32, R_SPARC_WDISP30, R_SPARC_WDISP22, R_SPARC_HI22, R_SPARC_22, R_SPARC_13, R_SPARC_LO10, @@ -96,7 +96,7 @@ bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section, return bfd_reloc_continue; } -static reloc_howto_type coff_sparc_howto_table[] = +static reloc_howto_type coff_sparc_howto_table[] = { HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", false,0,0x00000000,true), HOWTO(R_SPARC_8, 0,0, 8,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", false,0,0x000000ff,true), @@ -197,7 +197,7 @@ rtype2howto (cache_ptr, dst) #define __A_MAGIC_SET__ -/* Enable Sparc-specific hacks in coffcode.h. */ +/* Enable Sparc-specific hacks in coffcode.h. */ #define COFF_SPARC diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c index a971f76d7be..267ca974308 100644 --- a/bfd/coff-tic30.c +++ b/bfd/coff-tic30.c @@ -49,7 +49,7 @@ reloc_howto_type tic30_coff_howto_table[] = /* For the case statement use the code values used in tc_gen_reloc to map to the howto table entries that match those in both the aout - and coff implementations. */ + and coff implementations. */ reloc_howto_type * tic30_coff_reloc_type_lookup (abfd, code) bfd *abfd ATTRIBUTE_UNUSED; @@ -86,7 +86,6 @@ coff_tic30_select_reloc (howto) #define SELECT_RELOC(x,howto) x.r_type = coff_tic30_select_reloc(howto) - #define BADMAG(x) TIC30BADMAG(x) #define TIC30 1 /* Customize coffcode.h */ #define __A_MAGIC_SET__ @@ -97,7 +96,7 @@ coff_tic30_select_reloc (howto) #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; -/* Code to turn a r_type into a howto ptr, uses the above howto table. */ +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ static void rtype2howto (internal, dst) @@ -134,7 +133,6 @@ rtype2howto (internal, dst) #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ cache_ptr->addend = ext_reloc.r_offset; - #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ reloc_processing(relent, reloc, symbols, abfd, section) @@ -203,6 +201,6 @@ const bfd_target tic30_coff_vec = BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + COFF_SWAP_TABLE }; diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index 4ae62e31a51..af68d2c013a 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -79,7 +79,7 @@ tic54x_getl_signed_32 (addr) #define coff_get_section_load_page bfd_ticoff_get_section_load_page #define coff_set_section_load_page bfd_ticoff_set_section_load_page -void +void bfd_ticoff_set_section_load_page (sect, page) asection *sect; int page; @@ -87,14 +87,13 @@ bfd_ticoff_set_section_load_page (sect, page) sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page); } - int bfd_ticoff_get_section_load_page (sect) asection *sect; { int page; - /* Provide meaningful defaults for predefined sections. */ + /* Provide meaningful defaults for predefined sections. */ if (sect == &bfd_com_section) page = PG_DATA; @@ -110,7 +109,7 @@ bfd_ticoff_get_section_load_page (sect) } /* Set the architecture appropriately. Allow unkown architectures - (e.g. binary). */ + (e.g. binary). */ static boolean tic54x_set_arch_mach (abfd, arch, machine) bfd *abfd; @@ -127,7 +126,7 @@ tic54x_set_arch_mach (abfd, arch, machine) } static bfd_reloc_status_type -tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, +tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc_entry; @@ -137,7 +136,7 @@ tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; { - + if (output_bfd != (bfd *) NULL) { /* This is a partial relocation, and we want to apply the @@ -157,7 +156,7 @@ reloc_howto_type tic54x_howto_table[] = /* NORMAL BANK */ /* 16-bit direct reference to symbol's address */ - HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, + HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false), /* 7 LSBs of an address */ @@ -183,7 +182,7 @@ reloc_howto_type tic54x_howto_table[] = /* ABSOLUTE BANK */ /* 16-bit direct reference to symbol's address, absolute */ - HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, + HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont, tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false), /* 7 LSBs of an address, absolute */ @@ -243,7 +242,7 @@ tic54x_coff_reloc_type_lookup (abfd, code) } } -/* Code to turn a r_type into a howto ptr, uses the above howto table. +/* Code to turn a r_type into a howto ptr, uses the above howto table. Called after some initial checking by the tic54x_rtype_to_howto fn below */ static void tic54x_lookup_howto (internal, dst) @@ -263,7 +262,7 @@ tic54x_lookup_howto (internal, dst) (*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"), (unsigned int) dst->r_type); - abort(); + abort (); } #define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\ @@ -288,7 +287,7 @@ coff_tic54x_rtype_to_howto (abfd, sec, rel, h, sym, addendp) { /* This is a TI "internal relocation", which means that the relocation amount is the amount by which the current section is being relocated - in the output section. */ + in the output section. */ *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma; } @@ -325,7 +324,7 @@ ticoff1_bad_format_hook (abfd, filehdr) /* replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local labels */ -static boolean +static boolean ticoff_bfd_is_local_label_name (abfd, name) bfd *abfd ATTRIBUTE_UNUSED; const char *name; @@ -337,11 +336,11 @@ ticoff_bfd_is_local_label_name (abfd, name) #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name -/* Customize coffcode.h; the default coff_ functions are set up to use COFF2; +/* Customize coffcode.h; the default coff_ functions are set up to use COFF2; coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1 and COFF0 vectors use custom _bad_format_hook procs instead of setting - BADMAG. - */ + BADMAG. + */ #define BADMAG(x) COFF2_BADMAG(x) #include "coffcode.h" @@ -353,7 +352,7 @@ tic54x_set_section_contents (abfd, section, location, offset, bytes_to_do) file_ptr offset; bfd_size_type bytes_to_do; { - return coff_set_section_contents (abfd, section, location, + return coff_set_section_contents (abfd, section, location, offset, bytes_to_do); } @@ -368,7 +367,7 @@ tic54x_reloc_processing (relent, reloc, symbols, abfd, section) asymbol *ptr; relent->address = reloc->r_vaddr; - + if (reloc->r_symndx != -1) { if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd)) @@ -391,26 +390,26 @@ tic54x_reloc_processing (relent, reloc, symbols, abfd, section) relent->sym_ptr_ptr = section->symbol_ptr_ptr; ptr = *(relent->sym_ptr_ptr); } - + /* The symbols definitions that we have read in have been relocated as if their sections started at 0. But the offsets refering to the symbols in the raw data have not been modified, so we have to have a negative addend to compensate. - + Note that symbols which used to be common must be left alone */ - + /* Calculate any reloc addend by looking at the symbol */ CALC_ADDEND (abfd, ptr, *reloc, relent); - + relent->address -= section->vma; /* !! relent->section = (asection *) NULL;*/ - + /* Fill in the relent->howto field from reloc->r_type */ tic54x_lookup_howto (relent, reloc); } /* COFF0 differs in file/section header size and relocation entry size */ -static CONST bfd_coff_backend_data ticoff0_swap_table = +static CONST bfd_coff_backend_data ticoff0_swap_table = { coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, coff_SWAP_aux_out, coff_SWAP_sym_out, @@ -451,7 +450,7 @@ static CONST bfd_coff_backend_data ticoff0_swap_table = }; /* COFF1 differs in section header size */ -static CONST bfd_coff_backend_data ticoff1_swap_table = +static CONST bfd_coff_backend_data ticoff1_swap_table = { coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, coff_SWAP_aux_out, coff_SWAP_sym_out, @@ -491,7 +490,6 @@ static CONST bfd_coff_backend_data ticoff1_swap_table = coff_link_output_has_begun, coff_final_link_postscript }; - /* TI COFF v0, DOS tools (little-endian headers) */ const bfd_target tic54x_coff0_vec = { diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c index a8ade33ba9c..934603cf9d1 100644 --- a/bfd/coff-tic80.c +++ b/bfd/coff-tic80.c @@ -424,7 +424,7 @@ local16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, /* Code to turn an external r_type into a pointer to an entry in the howto_table. If passed an r_type we don't recognize the abort rather than silently failing - to generate an output file. */ + to generate an output file. */ static void rtype2howto (cache_ptr, dst) @@ -465,7 +465,7 @@ coff_tic80_rtype_to_howto (abfd, sec, rel, h, sym, addendp) { /* This is a TI "internal relocation", which means that the relocation amount is the amount by which the current section is being relocated - in the output section. */ + in the output section. */ *addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma; } RTYPE2HOWTO (&genrel, rel); @@ -518,7 +518,7 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd, sym = NULL; } else - { + { h = obj_coff_sym_hashes (input_bfd)[symndx]; sym = syms + symndx; } @@ -649,7 +649,7 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd, contents[addr + 1] |= hold & 0x80; break; } - + case R_PPBASE: /* Parameter RAM is from 0x1000000 to 0x1000800. */ contents[addr] &=~ 0x3; diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c index c82d4d7844b..ef604164a28 100644 --- a/bfd/coff-w65.c +++ b/bfd/coff-w65.c @@ -42,7 +42,6 @@ static reloc_howto_type howto_table[] = }; - /* Turn a howto into a reloc number */ #define SELECT_RELOC(x,howto) \ @@ -52,7 +51,6 @@ static reloc_howto_type howto_table[] = #define W65 1 /* Customize coffcode.h */ #define __A_MAGIC_SET__ - /* Code to swap in the reloc */ #define SWAP_IN_RELOC_OFFSET bfd_h_get_32 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 @@ -60,7 +58,6 @@ static reloc_howto_type howto_table[] = dst->r_stuff[0] = 'S'; \ dst->r_stuff[1] = 'C'; - static int select_reloc (howto) reloc_howto_type *howto; @@ -81,14 +78,11 @@ rtype2howto (internal, dst) #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) - /* Perform any necessary magic to the addend in a reloc entry */ - #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ cache_ptr->addend = ext_reloc.r_offset; - #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ reloc_processing(relent, reloc, symbols, abfd, section) @@ -112,15 +106,12 @@ reloc_processing (relent, reloc, symbols, abfd, section) relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol); } - - relent->addend = reloc->r_offset; relent->address -= section->vma; /* relent->section = 0;*/ } - static int h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) bfd *abfd; @@ -129,11 +120,11 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) unsigned int shrink; struct bfd_link_info *link_info; { - bfd_vma value; + bfd_vma value; bfd_vma dot; bfd_vma gap; - /* The address of the thing to be relocated will have moved back by + /* The address of the thing to be relocated will have moved back by the size of the shrink - but we don't change reloc->address here, since we need it to know where the relocation lives in the source uncooked section */ @@ -141,10 +132,9 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) /* reloc->address -= shrink; conceptual */ bfd_vma address = reloc->address - shrink; - switch (reloc->howto->type) - { + { case R_MOV16B2: case R_JMP2: shrink+=2; @@ -155,40 +145,40 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) value = bfd_coff_reloc16_get_value(reloc, link_info, input_section); if (value >= 0xff00) - { + { /* Change the reloc type from 16bit, possible 8 to 8bit possible 16 */ - reloc->howto = reloc->howto + 1; + reloc->howto = reloc->howto + 1; /* The place to relc moves back by one */ /* This will be two bytes smaller in the long run */ shrink +=2 ; bfd_perform_slip(abfd, 2, input_section, address); - } + } break; - /* This is the 24 bit branch which could become an 8 bitter, + /* This is the 24 bit branch which could become an 8 bitter, the relocation points to the first byte of the insn, not the actual data */ case R_JMPL1: value = bfd_coff_reloc16_get_value(reloc, link_info, input_section); - + dot = input_section->output_section->vma + input_section->output_offset + address; - + /* See if the address we're looking at within 127 bytes of where we are, if so then we can use a small branch rather than the jump we were going to */ gap = value - dot ; - + if (-120 < (long)gap && (long)gap < 120 ) - { + { /* Change the reloc type from 24bit, possible 8 to 8bit possible 32 */ - reloc->howto = reloc->howto + 1; + reloc->howto = reloc->howto + 1; /* This will be two bytes smaller in the long run */ shrink +=2 ; bfd_perform_slip(abfd, 2, input_section, address); @@ -198,23 +188,22 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) case R_JMP1: value = bfd_coff_reloc16_get_value(reloc, link_info, input_section); - + dot = input_section->output_section->vma + input_section->output_offset + address; - + /* See if the address we're looking at within 127 bytes of where we are, if so then we can use a small branch rather than the jump we were going to */ gap = value - (dot - shrink); - if (-120 < (long)gap && (long)gap < 120 ) - { + { /* Change the reloc type from 16bit, possible 8 to 8bit possible 16 */ - reloc->howto = reloc->howto + 1; + reloc->howto = reloc->howto + 1; /* The place to relc moves back by one */ /* This will be two bytes smaller in the long run */ @@ -224,11 +213,9 @@ h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info) break; } - return shrink; } - /* First phase of a relaxing link */ /* Reloc types @@ -336,8 +323,8 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, { int gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - bfd_vma dot = link_order->offset - + dst_address + bfd_vma dot = link_order->offset + + dst_address + link_order->u.indirect.section->output_section->vma; gap -= dot + 1; @@ -346,7 +333,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), reloc->howto->name, reloc->addend, input_section->owner, input_section, reloc->address))) - abort(); + abort (); } bfd_put_8 (abfd, gap, data + dst_address); dst_address += 1; @@ -358,11 +345,10 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, { bfd_vma gap = bfd_coff_reloc16_get_value (reloc, link_info, input_section); - bfd_vma dot = link_order->offset - + dst_address + bfd_vma dot = link_order->offset + + dst_address + link_order->u.indirect.section->output_section->vma; - /* This wraps within the page, so ignore the relativeness, look at the high part */ if ((gap & 0xf0000) != (dot & 0xf0000)) { @@ -370,7 +356,7 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), reloc->howto->name, reloc->addend, input_section->owner, input_section, reloc->address))) - abort(); + abort (); } gap -= dot + 2; @@ -394,7 +380,6 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, #include "coffcode.h" - #undef coff_bfd_get_relocated_section_contents #undef coff_bfd_relax_section #define coff_bfd_get_relocated_section_contents \ diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c index c559ad7c76f..8d3fa5d164b 100644 --- a/bfd/coff-we32k.c +++ b/bfd/coff-we32k.c @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) -static reloc_howto_type howto_table[] = +static reloc_howto_type howto_table[] = { EMPTY_HOWTO (0), EMPTY_HOWTO (1), diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 21f29a82969..7ad063019a9 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -54,7 +54,7 @@ HOWTO (R_JR, 0, 1, 8, true, 0, complain_overflow_signed, 0, /* Turn a howto into a reloc number */ -static int +static int coff_z8k_select_reloc (howto) reloc_howto_type *howto; { @@ -63,13 +63,10 @@ coff_z8k_select_reloc (howto) #define SELECT_RELOC(x,howto) x.r_type = coff_z8k_select_reloc(howto) - #define BADMAG(x) Z8KBADMAG(x) #define Z8K 1 /* Customize coffcode.h */ #define __A_MAGIC_SET__ - - /* Code to swap in the reloc */ #define SWAP_IN_RELOC_OFFSET bfd_h_get_32 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32 @@ -110,18 +107,15 @@ rtype2howto (internal, dst) #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) - /* Perform any necessary magic to the addend in a reloc entry */ - #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ cache_ptr->addend = ext_reloc.r_offset; - #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ reloc_processing(relent, reloc, symbols, abfd, section) -static void +static void reloc_processing (relent, reloc, symbols, abfd, section) arelent * relent; struct internal_reloc *reloc; @@ -141,7 +135,6 @@ reloc_processing (relent, reloc, symbols, abfd, section) relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; } - relent->addend = reloc->r_offset; relent->address -= section->vma; } @@ -178,7 +171,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) case R_IMM4L: bfd_put_8 (in_abfd, - ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0) + ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0) | (0x0f & bfd_coff_reloc16_get_value (reloc, link_info, input_section))), @@ -230,7 +223,6 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) #include "coffcode.h" - #undef coff_bfd_get_relocated_section_contents #undef coff_bfd_relax_section #define coff_bfd_get_relocated_section_contents \ -- 2.30.2