* 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.
This commit is contained in:
Ian Lance Taylor
1996-03-27 20:50:53 +00:00
parent 187783e019
commit 9addd1d4fd
2 changed files with 76 additions and 32 deletions

View File

@ -1,5 +1,36 @@
Wed Mar 27 10:43:34 1996 Ian Lance Taylor <ian@cygnus.com> Wed Mar 27 10:43:34 1996 Ian Lance Taylor <ian@cygnus.com>
* 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 * libhppa.h: Define HINLINE rather than INLINE. Define it to
extern inline if using gcc and to static INLINE otherwise. Change extern inline if using gcc and to static INLINE otherwise. Change
all functions from static INLINE to HINLINE. all functions from static INLINE to HINLINE.

View File

@ -293,6 +293,7 @@ static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd,
asection *section, asection *section,
bfd *output_bfd, bfd *output_bfd,
char **error)); char **error));
#if 0
static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd, static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd,
arelent *reloc, arelent *reloc,
asymbol *symbol, asymbol *symbol,
@ -300,6 +301,7 @@ static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd,
asection *section, asection *section,
bfd *output_bfd, bfd *output_bfd,
char **error)); char **error));
#endif
static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd, static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd,
arelent *reloc, arelent *reloc,
asymbol *symbol, asymbol *symbol,
@ -317,6 +319,7 @@ static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd,
bfd *output_bfd, bfd *output_bfd,
char **error)); char **error));
#if 0
static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd, static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd,
arelent *reloc, arelent *reloc,
asymbol *symbol, asymbol *symbol,
@ -324,7 +327,7 @@ static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd,
asection *section, asection *section,
bfd *output_bfd, bfd *output_bfd,
char **error)); char **error));
#endif
static bfd_reloc_status_type ppc_section_reloc PARAMS ((bfd *abfd, static bfd_reloc_status_type ppc_section_reloc PARAMS ((bfd *abfd,
arelent *reloc, arelent *reloc,
asymbol *symbol, 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 */ /* record a toc offset against a symbol */
static int static int
ppc_record_toc_entry(abfd, info, sec, sym, toc_kind) 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; int sym;
enum toc_type toc_kind; 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 ppc_coff_link_hash_entry *h;
struct coff_symbol_struct *target;
int ret_val; int ret_val;
const char *name; const char *name;
@ -964,6 +962,11 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
return ret_val; return ret_val;
} }
#endif /* COFF_IMAGE_WITH_PE */
#if 0
/* FIXME: record a toc offset against a data-in-toc symbol */ /* FIXME: record a toc offset against a data-in-toc symbol */
/* Now, there is currenly some confusion on what this means. In some /* Now, there is currenly some confusion on what this means. In some
compilers one sees the moral equivalent of: 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; int sym;
enum toc_type toc_kind; 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 ppc_coff_link_hash_entry *h = 0;
struct coff_symbol_struct *target;
int ret_val; int ret_val;
const char *name; const char *name;
@ -1081,6 +1077,10 @@ ppc_record_data_in_toc_entry(abfd, info, sec, sym, toc_kind)
return ret_val; return ret_val;
} }
#endif /* 0 */
#ifdef COFF_IMAGE_WITH_PE
/* record a toc offset against a symbol */ /* record a toc offset against a symbol */
static void static void
ppc_mark_symbol_as_glue(abfd, sym, rel) ppc_mark_symbol_as_glue(abfd, sym, rel)
@ -1100,7 +1100,10 @@ ppc_mark_symbol_as_glue(abfd, sym, rel)
return; return;
} }
#endif /* COFF_IMAGE_WITH_PE */
#if 0
/* Provided the symbol, returns the value reffed */ /* Provided the symbol, returns the value reffed */
static long get_symbol_value PARAMS ((asymbol *)); static long get_symbol_value PARAMS ((asymbol *));
@ -1124,6 +1127,8 @@ get_symbol_value (symbol)
return(relocation); return(relocation);
} }
#endif /* 0 */
/* Return true if this relocation should /* Return true if this relocation should
appear in the output .reloc section. */ appear in the output .reloc section. */
@ -1146,6 +1151,8 @@ static boolean in_reloc_p(abfd, howto)
&& (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ; && (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ;
} }
#if 0
/* this function is in charge of performing all the ppc PE relocations */ /* 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) */ /* Don't yet know if we want to do this this particular way ... (krk) */
/* FIXME: (it is not yet enabled) */ /* 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 boolean part1_consth_active = false;
static unsigned long part1_consth_value; static unsigned long part1_consth_value;
unsigned long insn;
unsigned long sym_value; unsigned long sym_value;
unsigned long unsigned_value;
unsigned short r_type; unsigned short r_type;
long signed_value;
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ 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); 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); return(bfd_reloc_ok);
} }
#endif /* 0 */
/* The reloc processing routine for the optimized COFF linker. */ /* The reloc processing routine for the optimized COFF linker. */
static boolean 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_type = EXTRACT_TYPE (rel->r_type);
unsigned short r_flags = EXTRACT_FLAGS(rel->r_type); unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
unsigned short junk = EXTRACT_JUNK (rel->r_type);
#ifdef DEBUG_RELOC #ifdef DEBUG_RELOC
/* now examine flags */ /* now examine flags */
@ -1625,8 +1628,9 @@ fprintf(stderr,
bfd_get_filename(input_bfd), bfd_get_filename(input_bfd),
input_section->name); input_section->name);
fprintf(stderr,"sym %d (%s), r_vaddr %d (%x)\n", fprintf(stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
rel->r_symndx, my_name, rel->r_vaddr, rel->r_vaddr); rel->r_symndx, my_name, (long) rel->r_vaddr,
(unsigned long) rel->r_vaddr);
} }
break; break;
case IMAGE_REL_PPC_IMGLUE: case IMAGE_REL_PPC_IMGLUE:
@ -1794,7 +1798,9 @@ fprintf(stderr,
if (coff_data(output_bfd)->pe) if (coff_data(output_bfd)->pe)
{ {
#ifdef DEBUG_RELOC
bfd_vma before_addr = addr; bfd_vma before_addr = addr;
#endif
addr -= pe_data(output_bfd)->pe_opthdr.ImageBase; addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
#ifdef DEBUG_RELOC #ifdef DEBUG_RELOC
fprintf(stderr, fprintf(stderr,
@ -1926,14 +1932,14 @@ dump_toc(vfile)
else else
{ {
fprintf(file, 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); global_toc_size, global_toc_size, thunk_size, thunk_size);
cat = "Out of bounds!"; cat = "Out of bounds!";
} }
} }
fprintf(file, fprintf(file,
" %04lx (%d)", t->offset, t->offset - 32768); " %04lx (%d)", (unsigned long) t->offset, t->offset - 32768);
fprintf(file, fprintf(file,
" %s %s\n", " %s %s\n",
cat, t->name); 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_type = EXTRACT_TYPE (rel->r_type);
unsigned short r_flags = EXTRACT_FLAGS(rel->r_type); unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
unsigned short junk = EXTRACT_JUNK (rel->r_type);
#ifdef DEBUG_RELOC #ifdef DEBUG_RELOC
/* now examine flags */ /* now examine flags */
@ -2079,6 +2084,8 @@ ppc_process_before_allocation (abfd, info)
} }
} }
} }
return true;
} }
#endif #endif
@ -2109,6 +2116,8 @@ ppc_refhi_reloc (abfd,
return bfd_reloc_undefined; return bfd_reloc_undefined;
} }
#if 0
static bfd_reloc_status_type static bfd_reloc_status_type
ppc_reflo_reloc (abfd, ppc_reflo_reloc (abfd,
reloc_entry, reloc_entry,
@ -2134,6 +2143,8 @@ ppc_reflo_reloc (abfd,
return bfd_reloc_undefined; return bfd_reloc_undefined;
} }
#endif
static bfd_reloc_status_type static bfd_reloc_status_type
ppc_pair_reloc (abfd, ppc_pair_reloc (abfd,
reloc_entry, reloc_entry,
@ -2187,6 +2198,8 @@ ppc_toc16_reloc (abfd,
return bfd_reloc_ok; return bfd_reloc_ok;
} }
#if 0
/* ADDR32NB : 32 bit address relative to the virtual origin. */ /* ADDR32NB : 32 bit address relative to the virtual origin. */
/* (On the alpha, this is always a linker generated thunk)*/ /* (On the alpha, this is always a linker generated thunk)*/
/* (i.e. 32bit addr relative to the image base) */ /* (i.e. 32bit addr relative to the image base) */
@ -2215,6 +2228,8 @@ ppc_addr32nb_reloc (abfd,
return bfd_reloc_ok; return bfd_reloc_ok;
} }
#endif
static bfd_reloc_status_type static bfd_reloc_status_type
ppc_secrel_reloc (abfd, ppc_secrel_reloc (abfd,
reloc_entry, reloc_entry,
@ -2328,8 +2343,8 @@ ppc_coff_rtype2howto (relent, internal)
if ( r_type > MAX_RELOC_INDEX ) if ( r_type > MAX_RELOC_INDEX )
{ {
fprintf(stderr, fprintf(stderr,
"ppc_coff_rtype2howto: reloc index %d out of range [%d, %d]\n", "ppc_coff_rtype2howto: reloc index %d out of range [%d, %ld]\n",
internal->r_type, 0, MAX_RELOC_INDEX); internal->r_type, 0, (long) MAX_RELOC_INDEX);
abort(); abort();
} }
@ -2426,8 +2441,8 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
if ( r_type > MAX_RELOC_INDEX ) if ( r_type > MAX_RELOC_INDEX )
{ {
fprintf(stderr, fprintf(stderr,
"coff_ppc_rtype_to_howto: index %d out of range [%d, %d]\n", "coff_ppc_rtype_to_howto: index %d out of range [%d, %ld]\n",
r_type, 0, MAX_RELOC_INDEX); r_type, 0, (long) MAX_RELOC_INDEX);
abort(); abort();
} }
@ -2588,7 +2603,6 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
PTR ext1; PTR ext1;
PTR in1; PTR in1;
{ {
SYMENT *ext = (SYMENT *)ext1;
struct internal_syment *in = (struct internal_syment *)in1; struct internal_syment *in = (struct internal_syment *)in1;
if (bfd_of_toc_owner != 0) /* we already have a toc, so go home */ 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; flagword flags;
register asection *s; register asection *s;
char *foo;
s = bfd_get_section_by_name ( abfd , TOC_SECTION_NAME); s = bfd_get_section_by_name ( abfd , TOC_SECTION_NAME);
if (s != NULL) if (s != NULL)