From 9addd1d4fdf2514723a9d847271cd546a3d0f207 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 27 Mar 1996 20:50:53 +0000 Subject: [PATCH] * coff-ppc.c (ppc_record_toc_entry): Put inside COFF_IMAGE_WITH_PE ifdef. Remove unused variables. (ppc_record_data_in_toc_entry): Ifdef out. Removed unused variables. (ppc_mark_symbol_as_glue): Put inside COFF_IMAGE_WITH_PE ifdef. (get_symbol_value): Ifdef out. (pe_ppc_reloc): Ifdef out. Remove unused variables. (coff_ppc_relocate_section): Remove unused variables. Make fprintf strings and argument types correspond. Put before_addr in DEBUG_RELOC ifdef. (ppc_reflo_reloc): Ifdef out. (ppc_addr32nb_reloc): Ifdef out. (ppc_coff_rtype2howto): Make fprintf strings and argument types correspond. (coff_ppc_rtype_to_howto): Likewise. (ppc_coff_swap_sym_in_hook): Remove unused variables. --- bfd/ChangeLog | 31 ++++++++++++++++++++ bfd/coff-ppc.c | 77 +++++++++++++++++++++++++++++--------------------- 2 files changed, 76 insertions(+), 32 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4169cfef28..91a23bf173 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,36 @@ Wed Mar 27 10:43:34 1996 Ian Lance Taylor + * coff-ppc.c (ppc_record_toc_entry): Put inside COFF_IMAGE_WITH_PE + ifdef. Remove unused variables. + (ppc_record_data_in_toc_entry): Ifdef out. Removed unused + variables. + (ppc_mark_symbol_as_glue): Put inside COFF_IMAGE_WITH_PE ifdef. + (get_symbol_value): Ifdef out. + (pe_ppc_reloc): Ifdef out. Remove unused variables. + (coff_ppc_relocate_section): Remove unused variables. Make + fprintf strings and argument types correspond. Put before_addr in + DEBUG_RELOC ifdef. + (ppc_reflo_reloc): Ifdef out. + (ppc_addr32nb_reloc): Ifdef out. + (ppc_coff_rtype2howto): Make fprintf strings and argument types + correspond. + (coff_ppc_rtype_to_howto): Likewise. + (ppc_coff_swap_sym_in_hook): Remove unused variables. + + * peicode.h (pe_print_idata): Move otherwise unused variables into + the #ifdef where they are used. Always return a value. + (pe_print_edata): Change fprintf strings and add cast to make + fprintf strings correspond to actual types. Always return a + value. + (pe_print_pdata): Removed unused variable addr_value. Always + return a value. + (pe_print_reloc): Remove unused variable onaline. Make fprintf + strings and arguments correspond. Always return a value. + + * elf32-ppc.c (ppc_elf_fake_sections): Return true. + (ppc_elf_finish_dynamic_symbol): Move definition of unused + variable rela inside #if 0 section where it is used. + * libhppa.h: Define HINLINE rather than INLINE. Define it to extern inline if using gcc and to static INLINE otherwise. Change all functions from static INLINE to HINLINE. diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 67fcef38cf..a991fe6c50 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -293,6 +293,7 @@ static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd, asection *section, bfd *output_bfd, char **error)); +#if 0 static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -300,6 +301,7 @@ static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd, asection *section, bfd *output_bfd, char **error)); +#endif static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -317,6 +319,7 @@ static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd, bfd *output_bfd, char **error)); +#if 0 static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -324,7 +327,7 @@ static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd, asection *section, bfd *output_bfd, char **error)); - +#endif static bfd_reloc_status_type ppc_section_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -846,6 +849,8 @@ record_toc(toc_section, our_toc_offset, cat, name) } } +#ifdef COFF_IMAGE_WITH_PE + /* record a toc offset against a symbol */ static int ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) @@ -855,14 +860,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) int sym; enum toc_type toc_kind; { - bfd_byte *t; - bfd_byte *old_contents; - asection *s; - int element_size; - int data; - int offset; struct ppc_coff_link_hash_entry *h; - struct coff_symbol_struct *target; int ret_val; const char *name; @@ -964,6 +962,11 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) return ret_val; } + +#endif /* COFF_IMAGE_WITH_PE */ + +#if 0 + /* FIXME: record a toc offset against a data-in-toc symbol */ /* Now, there is currenly some confusion on what this means. In some compilers one sees the moral equivalent of: @@ -988,14 +991,7 @@ ppc_record_data_in_toc_entry(abfd, info, sec, sym, toc_kind) int sym; enum toc_type toc_kind; { - bfd_byte *t; - bfd_byte *old_contents; - asection *s; - int element_size; - int data; - int offset; struct ppc_coff_link_hash_entry *h = 0; - struct coff_symbol_struct *target; int ret_val; const char *name; @@ -1081,6 +1077,10 @@ ppc_record_data_in_toc_entry(abfd, info, sec, sym, toc_kind) return ret_val; } +#endif /* 0 */ + +#ifdef COFF_IMAGE_WITH_PE + /* record a toc offset against a symbol */ static void ppc_mark_symbol_as_glue(abfd, sym, rel) @@ -1100,7 +1100,10 @@ ppc_mark_symbol_as_glue(abfd, sym, rel) return; } +#endif /* COFF_IMAGE_WITH_PE */ +#if 0 + /* Provided the symbol, returns the value reffed */ static long get_symbol_value PARAMS ((asymbol *)); @@ -1124,6 +1127,8 @@ get_symbol_value (symbol) return(relocation); } +#endif /* 0 */ + /* Return true if this relocation should appear in the output .reloc section. */ @@ -1146,6 +1151,8 @@ static boolean in_reloc_p(abfd, howto) && (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ; } +#if 0 + /* this function is in charge of performing all the ppc PE relocations */ /* Don't yet know if we want to do this this particular way ... (krk) */ /* FIXME: (it is not yet enabled) */ @@ -1166,14 +1173,9 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, static boolean part1_consth_active = false; static unsigned long part1_consth_value; - unsigned long insn; unsigned long sym_value; - unsigned long unsigned_value; unsigned short r_type; - long signed_value; - unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ - bfd_byte *hit_data =addr + (bfd_byte *)(data); fprintf(stderr, "pe_ppc_reloc (%s)\n", TARGET_LITTLE_NAME); @@ -1211,6 +1213,8 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, return(bfd_reloc_ok); } +#endif /* 0 */ + /* The reloc processing routine for the optimized COFF linker. */ static boolean @@ -1266,7 +1270,6 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, unsigned short r_type = EXTRACT_TYPE (rel->r_type); unsigned short r_flags = EXTRACT_FLAGS(rel->r_type); - unsigned short junk = EXTRACT_JUNK (rel->r_type); #ifdef DEBUG_RELOC /* now examine flags */ @@ -1625,8 +1628,9 @@ fprintf(stderr, bfd_get_filename(input_bfd), input_section->name); - fprintf(stderr,"sym %d (%s), r_vaddr %d (%x)\n", - rel->r_symndx, my_name, rel->r_vaddr, rel->r_vaddr); + fprintf(stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", + rel->r_symndx, my_name, (long) rel->r_vaddr, + (unsigned long) rel->r_vaddr); } break; case IMAGE_REL_PPC_IMGLUE: @@ -1794,7 +1798,9 @@ fprintf(stderr, if (coff_data(output_bfd)->pe) { +#ifdef DEBUG_RELOC bfd_vma before_addr = addr; +#endif addr -= pe_data(output_bfd)->pe_opthdr.ImageBase; #ifdef DEBUG_RELOC fprintf(stderr, @@ -1926,14 +1932,14 @@ dump_toc(vfile) else { fprintf(file, - "**** global_toc_size %d(%x), thunk_size %d(%x)\n", + "**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n", global_toc_size, global_toc_size, thunk_size, thunk_size); cat = "Out of bounds!"; } } fprintf(file, - " %04lx (%d)", t->offset, t->offset - 32768); + " %04lx (%d)", (unsigned long) t->offset, t->offset - 32768); fprintf(file, " %s %s\n", cat, t->name); @@ -2029,7 +2035,6 @@ ppc_process_before_allocation (abfd, info) { unsigned short r_type = EXTRACT_TYPE (rel->r_type); unsigned short r_flags = EXTRACT_FLAGS(rel->r_type); - unsigned short junk = EXTRACT_JUNK (rel->r_type); #ifdef DEBUG_RELOC /* now examine flags */ @@ -2079,6 +2084,8 @@ ppc_process_before_allocation (abfd, info) } } } + + return true; } #endif @@ -2109,6 +2116,8 @@ ppc_refhi_reloc (abfd, return bfd_reloc_undefined; } +#if 0 + static bfd_reloc_status_type ppc_reflo_reloc (abfd, reloc_entry, @@ -2134,6 +2143,8 @@ ppc_reflo_reloc (abfd, return bfd_reloc_undefined; } +#endif + static bfd_reloc_status_type ppc_pair_reloc (abfd, reloc_entry, @@ -2187,6 +2198,8 @@ ppc_toc16_reloc (abfd, return bfd_reloc_ok; } +#if 0 + /* ADDR32NB : 32 bit address relative to the virtual origin. */ /* (On the alpha, this is always a linker generated thunk)*/ /* (i.e. 32bit addr relative to the image base) */ @@ -2215,6 +2228,8 @@ ppc_addr32nb_reloc (abfd, return bfd_reloc_ok; } +#endif + static bfd_reloc_status_type ppc_secrel_reloc (abfd, reloc_entry, @@ -2328,8 +2343,8 @@ ppc_coff_rtype2howto (relent, internal) if ( r_type > MAX_RELOC_INDEX ) { fprintf(stderr, - "ppc_coff_rtype2howto: reloc index %d out of range [%d, %d]\n", - internal->r_type, 0, MAX_RELOC_INDEX); + "ppc_coff_rtype2howto: reloc index %d out of range [%d, %ld]\n", + internal->r_type, 0, (long) MAX_RELOC_INDEX); abort(); } @@ -2426,8 +2441,8 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp) if ( r_type > MAX_RELOC_INDEX ) { fprintf(stderr, - "coff_ppc_rtype_to_howto: index %d out of range [%d, %d]\n", - r_type, 0, MAX_RELOC_INDEX); + "coff_ppc_rtype_to_howto: index %d out of range [%d, %ld]\n", + r_type, 0, (long) MAX_RELOC_INDEX); abort(); } @@ -2588,7 +2603,6 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1) PTR ext1; PTR in1; { - SYMENT *ext = (SYMENT *)ext1; struct internal_syment *in = (struct internal_syment *)in1; if (bfd_of_toc_owner != 0) /* we already have a toc, so go home */ @@ -2598,7 +2612,6 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1) { flagword flags; register asection *s; - char *foo; s = bfd_get_section_by_name ( abfd , TOC_SECTION_NAME); if (s != NULL)