Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from get_symtab_upper_bound, bfd_canonicalize_symtab, bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now return long instead of unsigned int, and use -1 to indicate an error. Along the way, rename get_symtab_upper_bound to bfd_get_symtab_upper_bound. * bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on errors. (bfd_canonicalize_reloc): Likewise. * syms.c (bfd_get_symtab_upper_bound): Renamed from get_symtab_upper_bound. * targets.c (bfd_target): Renamed _get_symtab_upper_bound to _bfd_get_symtab_upper_bound, and changed it and _bfd_canonicalize_symtab and _get_reloc_upper_bound and _bfd_canonicalize_reloc to all return long. * aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors. (NAME(aout,canonicalize_reloc)): Likewise. (NAME(aout,get_reloc_upper_bound)): Likewise. (NAME(aout,get_symtab_upper_bound)): Likewise. * bout.c (b_out_canonicalize_reloc): Likewise. (b_out_get_reloc_upper_bound): Likewise. * coffcode.h (coff_canonicalize_reloc): Likewise. * coffgen.c (coff_get_symtab_upper_bound): Likewise. (coff_get_symtab): Likewise. (coff_get_reloc_upper_bound): Likewise. * ecoff.c (ecoff_get_symtab_upper_bound): Likewise. (ecoff_get_symtab): Likewise. (ecoff_canonicalize_reloc): Likewise. * elfcode.h (elf_get_symtab_upper_bound): Likewise. (elf_get_reloc_upper_bound): Likewise. (elf_canonicalize_reloc): Likewise. (elf_get_symtab): Likewise. * hp300hpux.c (MY(get_symtab)): Likewise. (MY(get_symtab_upper_bound)): Likewise. (MY(canonicalize_reloc)): Likewise. * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise. * ieee.c (ieee_slurp_external_symbols): Change return type to boolean. Check for errors from get_symbol. (ieee_slurp_symbol_table): Change return type to boolean. Check for errors from ieee_slurp_external_symbols. (ieee_get_symtab_upper_bound): Return long, and -1 on errors. (ieee_get_symtab): Likewise. (ieee_get_reloc_upper_bound): Likewise. (ieee_canonicalize_reloc): Likewise. * mipsbsd.c (MY(canonicalize_reloc)): Likewise. * nlmcode.h (nlm_get_symtab_upper_bound): Likewise. (nlm_get_symtab): Likewise. (nlm_get_reloc_upper_bound): Likewise. (nlm_canonicalize_reloc): Likewise. * oasys.c (oasys_get_symtab_upper_bound): Likewise. (oasys_get_symtab): Likewise. (oasys_get_reloc_upper_bound): Likewise. (oasys_canonicalize_reloc): Likewise. * som.c (som_get_symtab_upper_bound): Likewise. (som_get_symtab): Likewise. (som_get_reloc_upper_bound): Likewise. (som_canonicalize_reloc): Likewise. * srec.c (srec_get_symtab_upper_bound): Likewise. (srec_get_symtab): Likewise. (srec_get_reloc_upper_bound): Define as bfd_0l. (srec_canonicalize_reloc): Likewise. * tekhex.c (tekhex_get_symtab): Return long, and -1 on errors. (tekhex_get_symtab_upper_bound): Likewise. (tekhex_get_reloc_upper_bound): Define as bfd_0l. (tekhex_canonicalize_reloc): Likewise. * libaout.h (NAME(aout,get_symtab_upper_bound)): Change declaration to return long. (NAME(aout,get_symtab)): Likewise. (NAME(aout,canonicalize_reloc)): Likewise. (NAME(aout,get_reloc_upper_bound)): Likewise. * libcoff-in.h (coff_get_symtab_upper_bound): Likewise. (coff_get_symtab): Likewise. (coff_get_reloc_upper_bound): Likewise. * libecoff.h (ecoff_get_symtab_upper_bound): Likewise. (ecoff_get_symtab): Likewise. (ecoff_canonicalize_reloc): Likewise. * libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise. (bfd_elf32_get_symtab): Likewise. (bfd_elf32_get_reloc_upper_bound): Likewise. (bfd_elf32_canonicalize_reloc): Likewise. (bfd_elf64_get_symtab_upper_bound): Likewise. (bfd_elf64_get_symtab): Likewise. (bfd_elf64_get_reloc_upper_bound): Likewise. (bfd_elf64_canonicalize_reloc): Likewise. * libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise. (nlmNAME(get_symtab)): Likewise. (nlmNAME(get_reloc_upper_bound)): Likewise. (nlmNAME(canonicalize_reloc)): Likewise. * archive.c (compute_and_write_armap): Use error_return and no_memory_return labels rather than freeing information in various places. Change storage, symcount and src_count to long. Check errors from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. * bout.c (b_out_relax_section): Change reloc_size to long. Check for errors from bfd_get_reloc_upper_bound and bfd_canonicalize_reloc. (b_out_get_relocated_section_contents): Likewise. * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise. * elf32-mips.c: Likewise. * elf32-hppa.c (hppa_elf_stub_finish): Likewise. (hppa_look_for_stubs_in_section): Check for errors from bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and bfd_canonicalize_reloc. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. * linker.c (generic_link_read_symbols): Likewise. (_bfd_generic_final_link): Check for errors from bfd_get_reloc_upper_bound and bfd_canonicalize_reloc. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise. * reloc16.c (bfd_coff_reloc16_relax_section): Likewise. (bfd_coff_reloc16_get_relocated_section_contents): Likewise. * libbfd.c (bfd_0l): New function. * libbfd-in.h (bfd_0l): Declare. * aix386-core.c: Change get_symtab_upper_bound, get_symtab, get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather than bfd_0u. * cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise. * irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise. * bfd-in2.h: Rebuilt. * libbfd.h: Rebuilt. * libcoff.h: Rebuilt. * nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables temp and name.
This commit is contained in:
parent
70f42bae0b
commit
326e32d7ce
128
bfd/ChangeLog
128
bfd/ChangeLog
@ -1,3 +1,131 @@
|
||||
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
Changes to let BFD return an error indication from
|
||||
get_symtab_upper_bound, bfd_canonicalize_symtab,
|
||||
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
|
||||
return long instead of unsigned int, and use -1 to indicate an
|
||||
error. Along the way, rename get_symtab_upper_bound to
|
||||
bfd_get_symtab_upper_bound.
|
||||
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
|
||||
errors.
|
||||
(bfd_canonicalize_reloc): Likewise.
|
||||
* syms.c (bfd_get_symtab_upper_bound): Renamed from
|
||||
get_symtab_upper_bound.
|
||||
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
|
||||
_bfd_get_symtab_upper_bound, and changed it and
|
||||
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
|
||||
_bfd_canonicalize_reloc to all return long.
|
||||
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
|
||||
(NAME(aout,canonicalize_reloc)): Likewise.
|
||||
(NAME(aout,get_reloc_upper_bound)): Likewise.
|
||||
(NAME(aout,get_symtab_upper_bound)): Likewise.
|
||||
* bout.c (b_out_canonicalize_reloc): Likewise.
|
||||
(b_out_get_reloc_upper_bound): Likewise.
|
||||
* coffcode.h (coff_canonicalize_reloc): Likewise.
|
||||
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
|
||||
(coff_get_symtab): Likewise.
|
||||
(coff_get_reloc_upper_bound): Likewise.
|
||||
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
|
||||
(ecoff_get_symtab): Likewise.
|
||||
(ecoff_canonicalize_reloc): Likewise.
|
||||
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
|
||||
(elf_get_reloc_upper_bound): Likewise.
|
||||
(elf_canonicalize_reloc): Likewise.
|
||||
(elf_get_symtab): Likewise.
|
||||
* hp300hpux.c (MY(get_symtab)): Likewise.
|
||||
(MY(get_symtab_upper_bound)): Likewise.
|
||||
(MY(canonicalize_reloc)): Likewise.
|
||||
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
|
||||
* ieee.c (ieee_slurp_external_symbols): Change return type to
|
||||
boolean. Check for errors from get_symbol.
|
||||
(ieee_slurp_symbol_table): Change return type to boolean. Check
|
||||
for errors from ieee_slurp_external_symbols.
|
||||
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
|
||||
(ieee_get_symtab): Likewise.
|
||||
(ieee_get_reloc_upper_bound): Likewise.
|
||||
(ieee_canonicalize_reloc): Likewise.
|
||||
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
|
||||
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
|
||||
(nlm_get_symtab): Likewise.
|
||||
(nlm_get_reloc_upper_bound): Likewise.
|
||||
(nlm_canonicalize_reloc): Likewise.
|
||||
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
|
||||
(oasys_get_symtab): Likewise.
|
||||
(oasys_get_reloc_upper_bound): Likewise.
|
||||
(oasys_canonicalize_reloc): Likewise.
|
||||
* som.c (som_get_symtab_upper_bound): Likewise.
|
||||
(som_get_symtab): Likewise.
|
||||
(som_get_reloc_upper_bound): Likewise.
|
||||
(som_canonicalize_reloc): Likewise.
|
||||
* srec.c (srec_get_symtab_upper_bound): Likewise.
|
||||
(srec_get_symtab): Likewise.
|
||||
(srec_get_reloc_upper_bound): Define as bfd_0l.
|
||||
(srec_canonicalize_reloc): Likewise.
|
||||
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
|
||||
(tekhex_get_symtab_upper_bound): Likewise.
|
||||
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
|
||||
(tekhex_canonicalize_reloc): Likewise.
|
||||
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
|
||||
declaration to return long.
|
||||
(NAME(aout,get_symtab)): Likewise.
|
||||
(NAME(aout,canonicalize_reloc)): Likewise.
|
||||
(NAME(aout,get_reloc_upper_bound)): Likewise.
|
||||
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
|
||||
(coff_get_symtab): Likewise.
|
||||
(coff_get_reloc_upper_bound): Likewise.
|
||||
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
|
||||
(ecoff_get_symtab): Likewise.
|
||||
(ecoff_canonicalize_reloc): Likewise.
|
||||
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
|
||||
(bfd_elf32_get_symtab): Likewise.
|
||||
(bfd_elf32_get_reloc_upper_bound): Likewise.
|
||||
(bfd_elf32_canonicalize_reloc): Likewise.
|
||||
(bfd_elf64_get_symtab_upper_bound): Likewise.
|
||||
(bfd_elf64_get_symtab): Likewise.
|
||||
(bfd_elf64_get_reloc_upper_bound): Likewise.
|
||||
(bfd_elf64_canonicalize_reloc): Likewise.
|
||||
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
|
||||
(nlmNAME(get_symtab)): Likewise.
|
||||
(nlmNAME(get_reloc_upper_bound)): Likewise.
|
||||
(nlmNAME(canonicalize_reloc)): Likewise.
|
||||
* archive.c (compute_and_write_armap): Use error_return and
|
||||
no_memory_return labels rather than freeing information in various
|
||||
places. Change storage, symcount and src_count to long. Check
|
||||
errors from bfd_get_symtab_upper_bound and
|
||||
bfd_canonicalize_symtab.
|
||||
* bout.c (b_out_relax_section): Change reloc_size to long. Check
|
||||
for errors from bfd_get_reloc_upper_bound and
|
||||
bfd_canonicalize_reloc.
|
||||
(b_out_get_relocated_section_contents): Likewise.
|
||||
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
|
||||
Likewise.
|
||||
* elf32-mips.c: Likewise.
|
||||
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
|
||||
(hppa_look_for_stubs_in_section): Check for errors from
|
||||
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
|
||||
bfd_canonicalize_reloc.
|
||||
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
|
||||
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
|
||||
* linker.c (generic_link_read_symbols): Likewise.
|
||||
(_bfd_generic_final_link): Check for errors from
|
||||
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
|
||||
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
|
||||
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
|
||||
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
|
||||
* libbfd.c (bfd_0l): New function.
|
||||
* libbfd-in.h (bfd_0l): Declare.
|
||||
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
|
||||
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
|
||||
than bfd_0u.
|
||||
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
|
||||
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
|
||||
* bfd-in2.h: Rebuilt.
|
||||
* libbfd.h: Rebuilt.
|
||||
* libcoff.h: Rebuilt.
|
||||
|
||||
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
|
||||
temp and name.
|
||||
|
||||
Wed Mar 30 08:33:04 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* hosts/dpx2.h: Define POSIX_UTIME.
|
||||
|
@ -261,13 +261,13 @@ aix386_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
#define aix386_get_section_contents bfd_generic_get_section_contents
|
||||
#define aix386_new_section_hook (PROTO (boolean, (*), \
|
||||
(bfd *, sec_ptr))) bfd_true
|
||||
#define aix386_get_symtab_upper_bound bfd_0u
|
||||
#define aix386_get_symtab (PROTO (unsigned int, (*), \
|
||||
(bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define aix386_get_reloc_upper_bound (PROTO (unsigned int, (*), \
|
||||
(bfd *, sec_ptr))) bfd_0u
|
||||
#define aix386_canonicalize_reloc (PROTO (unsigned int, (*), \
|
||||
(bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define aix386_get_symtab_upper_bound bfd_0l
|
||||
#define aix386_get_symtab (PROTO (long, (*), \
|
||||
(bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define aix386_get_reloc_upper_bound (PROTO (long, (*), \
|
||||
(bfd *, sec_ptr))) bfd_0l
|
||||
#define aix386_canonicalize_reloc (PROTO (long, (*), \
|
||||
(bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define aix386_make_empty_symbol (PROTO ( \
|
||||
struct symbol_cache_entry *, (*), (bfd *))) bfd_false
|
||||
#define aix386_print_symbol (PROTO (void, (*), \
|
||||
|
22
bfd/aoutx.h
22
bfd/aoutx.h
@ -1998,7 +1998,7 @@ NAME(aout,write_syms) (abfd)
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,get_symtab) (abfd, location)
|
||||
bfd *abfd;
|
||||
asymbol **location;
|
||||
@ -2006,7 +2006,8 @@ NAME(aout,get_symtab) (abfd, location)
|
||||
unsigned int counter = 0;
|
||||
aout_symbol_type *symbase;
|
||||
|
||||
if (!NAME(aout,slurp_symbol_table)(abfd)) return 0;
|
||||
if (!NAME(aout,slurp_symbol_table)(abfd))
|
||||
return -1;
|
||||
|
||||
for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);)
|
||||
*(location++) = (asymbol *)( symbase++);
|
||||
@ -2504,7 +2505,7 @@ NAME(aout,squirt_out_relocs) (abfd, section)
|
||||
}
|
||||
|
||||
/* This is stupid. This function should be a boolean predicate */
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
@ -2515,7 +2516,7 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
unsigned int count;
|
||||
|
||||
if (!(tblptr || NAME(aout,slurp_reloc_table)(abfd, section, symbols)))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
if (section->flags & SEC_CONSTRUCTOR) {
|
||||
arelent_chain *chain = section->constructor_chain;
|
||||
@ -2538,7 +2539,7 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
return section->reloc_count;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,get_reloc_upper_bound) (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
@ -2547,7 +2548,7 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
|
||||
|
||||
if (bfd_get_format (abfd) != bfd_object) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
if (asect->flags & SEC_CONSTRUCTOR) {
|
||||
return (sizeof (arelent *) * (asect->reloc_count+1));
|
||||
@ -2561,7 +2562,7 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
|
||||
dynrel_count = ((*aout_backend_info (abfd)->read_dynamic_relocs)
|
||||
(abfd, &dynrels));
|
||||
if (dynrel_count == (bfd_size_type) -1)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (asect == obj_datasec (abfd))
|
||||
@ -2575,15 +2576,16 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
|
||||
+ dynrel_count + 1));
|
||||
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,get_symtab_upper_bound) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (!NAME(aout,slurp_symbol_table)(abfd)) return 0;
|
||||
if (!NAME(aout,slurp_symbol_table)(abfd))
|
||||
return -1;
|
||||
|
||||
return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
|
||||
}
|
||||
|
@ -1596,15 +1596,15 @@ compute_and_write_armap (arch, elength)
|
||||
bfd *arch;
|
||||
unsigned int elength;
|
||||
{
|
||||
char *first_name;
|
||||
char *first_name = NULL;
|
||||
bfd *current;
|
||||
file_ptr elt_no = 0;
|
||||
struct orl *map;
|
||||
struct orl *map = NULL;
|
||||
int orl_max = 1024; /* fine initial default */
|
||||
int orl_count = 0;
|
||||
int stridx = 0; /* string index */
|
||||
asymbol **syms = NULL;
|
||||
unsigned int syms_max = 0;
|
||||
long syms_max = 0;
|
||||
boolean ret;
|
||||
|
||||
/* Dunno if this is the best place for this info... */
|
||||
@ -1614,20 +1614,13 @@ compute_and_write_armap (arch, elength)
|
||||
|
||||
map = (struct orl *) malloc (orl_max * sizeof (struct orl));
|
||||
if (map == NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
goto no_memory_return;
|
||||
|
||||
/* We put the symbol names on the arch obstack, and then discard
|
||||
them when done. */
|
||||
first_name = bfd_alloc (arch, 1);
|
||||
if (first_name == NULL)
|
||||
{
|
||||
free (map);
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
goto no_memory_return;
|
||||
|
||||
/* Drop all the files called __.SYMDEF, we're going to make our
|
||||
own */
|
||||
@ -1643,11 +1636,14 @@ compute_and_write_armap (arch, elength)
|
||||
if ((bfd_check_format (current, bfd_object) == true)
|
||||
&& ((bfd_get_file_flags (current) & HAS_SYMS)))
|
||||
{
|
||||
unsigned int storage;
|
||||
unsigned int symcount;
|
||||
unsigned int src_count;
|
||||
long storage;
|
||||
long symcount;
|
||||
long src_count;
|
||||
|
||||
storage = bfd_get_symtab_upper_bound (current);
|
||||
if (storage < 0)
|
||||
goto error_return;
|
||||
|
||||
storage = get_symtab_upper_bound (current);
|
||||
if (storage != 0)
|
||||
{
|
||||
if (storage > syms_max)
|
||||
@ -1655,16 +1651,13 @@ compute_and_write_armap (arch, elength)
|
||||
if (syms_max > 0)
|
||||
free (syms);
|
||||
syms_max = storage;
|
||||
syms = (asymbol **) malloc (syms_max);
|
||||
syms = (asymbol **) malloc ((size_t) syms_max);
|
||||
if (syms == NULL)
|
||||
{
|
||||
free (map);
|
||||
bfd_release (arch, first_name);
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
goto no_memory_return;
|
||||
}
|
||||
symcount = bfd_canonicalize_symtab (current, syms);
|
||||
if (symcount < 0)
|
||||
goto error_return;
|
||||
|
||||
/* Now map over all the symbols, picking out the ones we want */
|
||||
for (src_count = 0; src_count < symcount; src_count++)
|
||||
@ -1689,14 +1682,7 @@ compute_and_write_armap (arch, elength)
|
||||
realloc ((PTR) map,
|
||||
orl_max * sizeof (struct orl)));
|
||||
if (new_map == (struct orl *) NULL)
|
||||
{
|
||||
free_and_quit:
|
||||
free (syms);
|
||||
free (map);
|
||||
bfd_release (arch, first_name);
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
goto no_memory_return;
|
||||
|
||||
map = new_map;
|
||||
}
|
||||
@ -1706,10 +1692,10 @@ compute_and_write_armap (arch, elength)
|
||||
bfd_alloc (arch,
|
||||
sizeof (char *)));
|
||||
if (map[orl_count].name == NULL)
|
||||
goto free_and_quit;
|
||||
goto no_memory_return;
|
||||
*(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
|
||||
if (*(map[orl_count].name) == NULL)
|
||||
goto free_and_quit;
|
||||
goto no_memory_return;
|
||||
strcpy (*(map[orl_count].name), syms[src_count]->name);
|
||||
(map[orl_count]).pos = (file_ptr) current;
|
||||
(map[orl_count]).namidx = stridx;
|
||||
@ -1728,10 +1714,25 @@ compute_and_write_armap (arch, elength)
|
||||
|
||||
if (syms_max > 0)
|
||||
free (syms);
|
||||
free (map);
|
||||
bfd_release (arch, first_name);
|
||||
if (map != NULL)
|
||||
free (map);
|
||||
if (first_name != NULL)
|
||||
bfd_release (arch, first_name);
|
||||
|
||||
return ret;
|
||||
|
||||
no_memory_return:
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
|
||||
error_return:
|
||||
if (syms_max > 0)
|
||||
free (syms);
|
||||
if (map != NULL)
|
||||
free (map);
|
||||
if (first_name != NULL)
|
||||
bfd_release (arch, first_name);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean
|
||||
|
@ -1640,8 +1640,8 @@ typedef struct symbol_cache_entry
|
||||
PTR udata;
|
||||
|
||||
} asymbol;
|
||||
#define get_symtab_upper_bound(abfd) \
|
||||
BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
|
||||
#define bfd_get_symtab_upper_bound(abfd) \
|
||||
BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
|
||||
boolean
|
||||
bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
|
||||
|
||||
@ -1802,6 +1802,7 @@ struct _bfd
|
||||
struct sgi_core_struct *sgi_core_data;
|
||||
struct lynx_core_struct *lynx_core_data;
|
||||
struct osf_core_struct *osf_core_data;
|
||||
struct cisco_core_struct *cisco_core_data;
|
||||
PTR any;
|
||||
} tdata;
|
||||
|
||||
@ -1845,10 +1846,10 @@ bfd_errmsg PARAMS ((bfd_error_type error_tag));
|
||||
void
|
||||
bfd_perror PARAMS ((CONST char *message));
|
||||
|
||||
unsigned int
|
||||
long
|
||||
bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
|
||||
|
||||
unsigned int
|
||||
long
|
||||
bfd_canonicalize_reloc
|
||||
PARAMS ((bfd *abfd,
|
||||
asection *sec,
|
||||
@ -1915,9 +1916,8 @@ bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
|
||||
BFD_SEND (abfd, _bfd_get_relocated_section_contents, \
|
||||
(abfd, link_info, link_order, data, relocateable, symbols))
|
||||
|
||||
#define bfd_relax_section(abfd, section, link_info, symbols) \
|
||||
BFD_SEND (abfd, _bfd_relax_section, \
|
||||
(abfd, section, link_info, symbols))
|
||||
#define bfd_relax_section(abfd, section, link_info, again) \
|
||||
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
||||
|
||||
#define bfd_link_hash_table_create(abfd) \
|
||||
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
||||
@ -2040,12 +2040,12 @@ typedef struct bfd_target
|
||||
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
|
||||
bfd *, sec_ptr));
|
||||
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
|
||||
unsigned int (*_get_symtab_upper_bound) PARAMS ((bfd *));
|
||||
unsigned int (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
||||
struct symbol_cache_entry **));
|
||||
unsigned int (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
||||
unsigned int (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
|
||||
struct symbol_cache_entry **));
|
||||
long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
|
||||
long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
||||
struct symbol_cache_entry **));
|
||||
long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
||||
long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
|
||||
struct symbol_cache_entry **));
|
||||
struct symbol_cache_entry *
|
||||
(*_bfd_make_empty_symbol) PARAMS ((bfd *));
|
||||
void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
|
||||
@ -2083,7 +2083,7 @@ typedef struct bfd_target
|
||||
struct symbol_cache_entry **));
|
||||
|
||||
boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
|
||||
struct bfd_link_info *, struct symbol_cache_entry **));
|
||||
struct bfd_link_info *, boolean *again));
|
||||
|
||||
/* See documentation on reloc types. */
|
||||
CONST struct reloc_howto_struct *
|
||||
|
44
bfd/bfd.c
44
bfd/bfd.c
@ -168,6 +168,7 @@ CODE_FRAGMENT
|
||||
. struct sgi_core_struct *sgi_core_data;
|
||||
. struct lynx_core_struct *lynx_core_data;
|
||||
. struct osf_core_struct *osf_core_data;
|
||||
. struct cisco_core_struct *cisco_core_data;
|
||||
. PTR any;
|
||||
. } tdata;
|
||||
.
|
||||
@ -366,24 +367,24 @@ FUNCTION
|
||||
bfd_get_reloc_upper_bound
|
||||
|
||||
SYNOPSIS
|
||||
unsigned int bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
|
||||
long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
|
||||
|
||||
DESCRIPTION
|
||||
Return the number of bytes required to store the
|
||||
relocation information associated with section @var{sect}
|
||||
attached to bfd @var{abfd}.
|
||||
attached to bfd @var{abfd}. If an error occurs, return -1.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
unsigned int
|
||||
long
|
||||
bfd_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
{
|
||||
if (abfd->format != bfd_object) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect));
|
||||
@ -394,7 +395,7 @@ FUNCTION
|
||||
bfd_canonicalize_reloc
|
||||
|
||||
SYNOPSIS
|
||||
unsigned int bfd_canonicalize_reloc
|
||||
long bfd_canonicalize_reloc
|
||||
(bfd *abfd,
|
||||
asection *sec,
|
||||
arelent **loc,
|
||||
@ -406,14 +407,15 @@ DESCRIPTION
|
||||
information attached to @var{sec} into the internal canonical
|
||||
form. Place the table into memory at @var{loc}, which has
|
||||
been preallocated, usually by a call to
|
||||
<<bfd_get_reloc_upper_bound>>.
|
||||
<<bfd_get_reloc_upper_bound>>. Returns the number of relocs, or
|
||||
-1 on error.
|
||||
|
||||
The @var{syms} table is also needed for horrible internal magic
|
||||
reasons.
|
||||
|
||||
|
||||
*/
|
||||
unsigned int
|
||||
long
|
||||
bfd_canonicalize_reloc (abfd, asect, location, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
@ -422,7 +424,7 @@ bfd_canonicalize_reloc (abfd, asect, location, symbols)
|
||||
{
|
||||
if (abfd->format != bfd_object) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
return BFD_SEND (abfd, _bfd_canonicalize_reloc,
|
||||
(abfd, asect, location, symbols));
|
||||
@ -737,6 +739,27 @@ bfd_scan_vma (string, end, base)
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_copy_private_bfd_data
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
|
||||
|
||||
DESCRIPTION
|
||||
Copy private BFD information from the BFD @var{ibfd} to the
|
||||
the BFD @var{obfd}. Return <<true>> on success, <<false>> on error.
|
||||
Possible error returns are:
|
||||
|
||||
o <<bfd_error_no_memory>> -
|
||||
Not enough memory exists to create private data for @var{obfd}.
|
||||
|
||||
.#define bfd_copy_private_bfd_data(ibfd, obfd) \
|
||||
. BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \
|
||||
. (ibfd, obfd))
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
stuff
|
||||
@ -771,9 +794,8 @@ DESCRIPTION
|
||||
. BFD_SEND (abfd, _bfd_get_relocated_section_contents, \
|
||||
. (abfd, link_info, link_order, data, relocateable, symbols))
|
||||
.
|
||||
.#define bfd_relax_section(abfd, section, link_info, symbols) \
|
||||
. BFD_SEND (abfd, _bfd_relax_section, \
|
||||
. (abfd, section, link_info, symbols))
|
||||
.#define bfd_relax_section(abfd, section, link_info, again) \
|
||||
. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
||||
.
|
||||
.#define bfd_link_hash_table_create(abfd) \
|
||||
. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
||||
|
50
bfd/bout.c
50
bfd/bout.c
@ -797,7 +797,7 @@ b_out_squirt_out_relocs (abfd, section)
|
||||
}
|
||||
|
||||
/* This is stupid. This function should be a boolean predicate */
|
||||
static unsigned int
|
||||
static long
|
||||
b_out_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
@ -807,9 +807,11 @@ b_out_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
arelent *tblptr = section->relocation;
|
||||
unsigned int count = 0;
|
||||
|
||||
if (!(tblptr || b_out_slurp_reloc_table (abfd, section, symbols))) return 0;
|
||||
if (!(tblptr || b_out_slurp_reloc_table (abfd, section, symbols)))
|
||||
return -1;
|
||||
tblptr = section->relocation;
|
||||
if (!tblptr) return 0;
|
||||
if (!tblptr)
|
||||
return -1;
|
||||
|
||||
for (; count++ < section->reloc_count;)
|
||||
*relptr++ = tblptr++;
|
||||
@ -819,14 +821,14 @@ b_out_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
return section->reloc_count;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
b_out_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
{
|
||||
if (bfd_get_format (abfd) != bfd_object) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (asect == obj_datasec (abfd))
|
||||
@ -843,7 +845,7 @@ b_out_get_reloc_upper_bound (abfd, asect)
|
||||
return 0;
|
||||
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static boolean
|
||||
@ -1099,8 +1101,11 @@ b_out_relax_section (abfd, i, link_info, again)
|
||||
asection *input_section = i;
|
||||
int shrink = 0 ;
|
||||
arelent **reloc_vector = NULL;
|
||||
bfd_size_type reloc_size = bfd_get_reloc_upper_bound(input_bfd,
|
||||
input_section);
|
||||
long reloc_size = bfd_get_reloc_upper_bound(input_bfd,
|
||||
input_section);
|
||||
|
||||
if (reloc_size < 0)
|
||||
return false;
|
||||
|
||||
/* We only run this relaxation once. It might work to run it
|
||||
multiple times, but it hasn't been tested. */
|
||||
@ -1108,6 +1113,8 @@ b_out_relax_section (abfd, i, link_info, again)
|
||||
|
||||
if (reloc_size)
|
||||
{
|
||||
long reloc_count;
|
||||
|
||||
reloc_vector = (arelent **) malloc (reloc_size);
|
||||
if (reloc_vector == NULL && reloc_size != 0)
|
||||
{
|
||||
@ -1116,8 +1123,12 @@ b_out_relax_section (abfd, i, link_info, again)
|
||||
}
|
||||
|
||||
/* Get the relocs and think about them */
|
||||
if (bfd_canonicalize_reloc(input_bfd, input_section, reloc_vector,
|
||||
_bfd_generic_link_get_symbols (input_bfd)))
|
||||
reloc_count =
|
||||
bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
|
||||
_bfd_generic_link_get_symbols (input_bfd));
|
||||
if (reloc_count < 0)
|
||||
goto error_return;
|
||||
if (reloc_count > 0)
|
||||
{
|
||||
arelent **parent;
|
||||
for (parent = reloc_vector; *parent; parent++)
|
||||
@ -1165,9 +1176,13 @@ b_out_get_relocated_section_contents (in_abfd, link_info, link_order, data,
|
||||
/* Get enough memory to hold the stuff */
|
||||
bfd *input_bfd = link_order->u.indirect.section->owner;
|
||||
asection *input_section = link_order->u.indirect.section;
|
||||
bfd_size_type reloc_size = bfd_get_reloc_upper_bound(input_bfd,
|
||||
input_section);
|
||||
long reloc_size = bfd_get_reloc_upper_bound(input_bfd,
|
||||
input_section);
|
||||
arelent **reloc_vector = NULL;
|
||||
long reloc_count;
|
||||
|
||||
if (reloc_size < 0)
|
||||
goto error_return;
|
||||
|
||||
/* If producing relocateable output, don't bother to relax. */
|
||||
if (relocateable)
|
||||
@ -1192,10 +1207,13 @@ b_out_get_relocated_section_contents (in_abfd, link_info, link_order, data,
|
||||
0,
|
||||
input_section->_raw_size));
|
||||
|
||||
if (bfd_canonicalize_reloc(input_bfd,
|
||||
input_section,
|
||||
reloc_vector,
|
||||
symbols) )
|
||||
reloc_count = bfd_canonicalize_reloc (input_bfd,
|
||||
input_section,
|
||||
reloc_vector,
|
||||
symbols);
|
||||
if (reloc_count < 0)
|
||||
goto error_return;
|
||||
if (reloc_count > 0)
|
||||
{
|
||||
arelent **parent = reloc_vector;
|
||||
arelent *reloc ;
|
||||
|
@ -112,8 +112,9 @@ cisco_core_file_p (abfd)
|
||||
|
||||
/* OK, we believe you. You're a core file. */
|
||||
|
||||
abfd->tdata.cisco_core_data = (struct cisco_core_struct *)
|
||||
bfd_zmalloc (abfd, sizeof (struct cisco_core_struct));
|
||||
abfd->tdata.cisco_core_data =
|
||||
((struct cisco_core_struct *)
|
||||
bfd_zmalloc (sizeof (struct cisco_core_struct)));
|
||||
if (abfd->tdata.cisco_core_data == NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
@ -245,7 +246,7 @@ cisco_core_file_p (abfd)
|
||||
free (asect);
|
||||
asect = nextsect;
|
||||
}
|
||||
free (abfd->tdata);
|
||||
free (abfd->tdata.cisco_core_data);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -290,13 +291,13 @@ cisco_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
#define cisco_get_section_contents bfd_generic_get_section_contents
|
||||
#define cisco_new_section_hook (boolean (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_true
|
||||
#define cisco_get_symtab_upper_bound bfd_0u
|
||||
#define cisco_get_symtab (unsigned int (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define cisco_get_reloc_upper_bound (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0u
|
||||
#define cisco_canonicalize_reloc (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define cisco_get_symtab_upper_bound bfd_0l
|
||||
#define cisco_get_symtab (long (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define cisco_get_reloc_upper_bound (long (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0l
|
||||
#define cisco_canonicalize_reloc (long (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define cisco_make_empty_symbol (struct symbol_cache_entry * \
|
||||
(*) PARAMS ((bfd *))) bfd_false
|
||||
#define cisco_print_symbol (void (*) PARAMS \
|
||||
@ -337,7 +338,7 @@ cisco_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
#define cisco_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
|
||||
#define cisco_bfd_is_local_label \
|
||||
((boolean (*) PARAMS ((bfd *, asection *))) bfd_false)
|
||||
((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
|
||||
|
||||
bfd_target cisco_core_vec =
|
||||
{
|
||||
|
@ -714,14 +714,17 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
{
|
||||
bfd *input_bfd = link_order->u.indirect.section->owner;
|
||||
asection *input_section = link_order->u.indirect.section;
|
||||
size_t reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
|
||||
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
|
||||
arelent **reloc_vector = NULL;
|
||||
long reloc_count;
|
||||
bfd *output_bfd = relocateable ? abfd : (bfd *) NULL;
|
||||
bfd_vma gp;
|
||||
boolean gp_undefined;
|
||||
bfd_vma stack[RELOC_STACKSIZE];
|
||||
int tos = 0;
|
||||
|
||||
if (reloc_size < 0)
|
||||
goto error_return;
|
||||
reloc_vector = (arelent **) malloc (reloc_size);
|
||||
if (reloc_vector == NULL && reloc_size != 0)
|
||||
{
|
||||
@ -737,9 +740,11 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
input_section->_cooked_size = input_section->_raw_size;
|
||||
input_section->reloc_done = true;
|
||||
|
||||
if (bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
|
||||
symbols)
|
||||
== 0)
|
||||
reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
|
||||
reloc_vector, symbols);
|
||||
if (reloc_count < 0)
|
||||
goto error_return;
|
||||
if (reloc_count == 0)
|
||||
goto successful_return;
|
||||
|
||||
/* Get the GP value for the output BFD. */
|
||||
|
@ -2376,7 +2376,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
|
||||
|
||||
|
||||
/* This is stupid. This function should be a boolean predicate. */
|
||||
static unsigned int
|
||||
static long
|
||||
coff_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd * abfd;
|
||||
sec_ptr section;
|
||||
@ -2402,12 +2402,12 @@ coff_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
}
|
||||
else
|
||||
{
|
||||
coff_slurp_reloc_table (abfd, section, symbols);
|
||||
|
||||
if (! coff_slurp_reloc_table (abfd, section, symbols))
|
||||
return -1;
|
||||
|
||||
tblptr = section->relocation;
|
||||
if (!tblptr)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
for (; count++ < section->reloc_count;)
|
||||
*relptr++ = tblptr++;
|
||||
|
@ -274,12 +274,12 @@ coff_section_from_bfd_index (abfd, index)
|
||||
|
||||
/* Get the upper bound of a COFF symbol table. */
|
||||
|
||||
unsigned int
|
||||
long
|
||||
coff_get_symtab_upper_bound(abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (!bfd_coff_slurp_symbol_table(abfd))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
return (bfd_get_symcount(abfd) + 1) * (sizeof(coff_symbol_type *));
|
||||
}
|
||||
@ -287,7 +287,7 @@ bfd *abfd;
|
||||
|
||||
/* Canonicalize a COFF symbol table. */
|
||||
|
||||
unsigned int
|
||||
long
|
||||
coff_get_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
@ -296,7 +296,7 @@ coff_get_symtab (abfd, alocation)
|
||||
coff_symbol_type *symbase;
|
||||
coff_symbol_type **location = (coff_symbol_type **) (alocation);
|
||||
if (!bfd_coff_slurp_symbol_table(abfd))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
symbase = obj_symbols(abfd);
|
||||
while (counter < bfd_get_symcount(abfd))
|
||||
@ -1337,14 +1337,14 @@ coff_get_normalized_symtab (abfd)
|
||||
return (internal);
|
||||
} /* coff_get_normalized_symtab() */
|
||||
|
||||
unsigned int
|
||||
long
|
||||
coff_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
{
|
||||
if (bfd_get_format(abfd) != bfd_object) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
return (asect->reloc_count + 1) * sizeof(arelent *);
|
||||
}
|
||||
|
21
bfd/ecoff.c
21
bfd/ecoff.c
@ -1212,12 +1212,14 @@ ecoff_slurp_symbol_table (abfd)
|
||||
|
||||
/* Return the amount of space needed for the canonical symbols. */
|
||||
|
||||
unsigned int
|
||||
long
|
||||
ecoff_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (ecoff_slurp_symbolic_info (abfd) == false
|
||||
|| bfd_get_symcount (abfd) == 0)
|
||||
if (! ecoff_slurp_symbolic_info (abfd))
|
||||
return -1;
|
||||
|
||||
if (bfd_get_symcount (abfd) == 0)
|
||||
return 0;
|
||||
|
||||
return (bfd_get_symcount (abfd) + 1) * (sizeof (ecoff_symbol_type *));
|
||||
@ -1225,7 +1227,7 @@ ecoff_get_symtab_upper_bound (abfd)
|
||||
|
||||
/* Get the canonical symbols. */
|
||||
|
||||
unsigned int
|
||||
long
|
||||
ecoff_get_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
@ -1234,8 +1236,9 @@ ecoff_get_symtab (abfd, alocation)
|
||||
ecoff_symbol_type *symbase;
|
||||
ecoff_symbol_type **location = (ecoff_symbol_type **) alocation;
|
||||
|
||||
if (ecoff_slurp_symbol_table (abfd) == false
|
||||
|| bfd_get_symcount (abfd) == 0)
|
||||
if (ecoff_slurp_symbol_table (abfd) == false)
|
||||
return -1;
|
||||
if (bfd_get_symcount (abfd) == 0)
|
||||
return 0;
|
||||
|
||||
symbase = ecoff_data (abfd)->canonical_symbols;
|
||||
@ -1901,7 +1904,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
|
||||
|
||||
/* Get a canonical list of relocs. */
|
||||
|
||||
unsigned int
|
||||
long
|
||||
ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
@ -1927,11 +1930,11 @@ ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
arelent *tblptr;
|
||||
|
||||
if (ecoff_slurp_reloc_table (abfd, section, symbols) == false)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
tblptr = section->relocation;
|
||||
if (tblptr == (arelent *) NULL)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
for (count = 0; count < section->reloc_count; count++)
|
||||
*relptr++ = tblptr++;
|
||||
|
@ -966,6 +966,8 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
|
||||
asymbol **symbols;
|
||||
asymbol **sym_ptr;
|
||||
asymbol **sym_end;
|
||||
long symsize;
|
||||
long symcount;
|
||||
PTR external_fdr;
|
||||
|
||||
memset ((PTR) &fdr, 0, sizeof fdr);
|
||||
@ -988,14 +990,19 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
|
||||
fdr.isymBase = output_symhdr->isymMax;
|
||||
|
||||
/* Get the local symbols from the input BFD. */
|
||||
symbols = (asymbol **) bfd_alloc (output_bfd,
|
||||
get_symtab_upper_bound (input_bfd));
|
||||
symsize = bfd_get_symtab_upper_bound (input_bfd);
|
||||
if (symsize < 0)
|
||||
return false;
|
||||
symbols = (asymbol **) bfd_alloc (output_bfd, symsize);
|
||||
if (symbols == (asymbol **) NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
sym_end = symbols + bfd_canonicalize_symtab (input_bfd, symbols);
|
||||
symcount = bfd_canonicalize_symtab (input_bfd, symbols);
|
||||
if (symcount < 0)
|
||||
return false;
|
||||
sym_end = symbols + symcount;
|
||||
|
||||
/* Handle the local symbols. Any external symbols are handled
|
||||
separately. */
|
||||
|
@ -1930,8 +1930,9 @@ hppa_elf_stub_finish (output_bfd)
|
||||
bfd *stub_bfd = stub_list->this_bfd;
|
||||
asection *stub_sec = bfd_get_section_by_name (stub_bfd,
|
||||
".hppa_linker_stubs");
|
||||
bfd_size_type reloc_size;
|
||||
long reloc_size;
|
||||
arelent **reloc_vector;
|
||||
long reloc_count;
|
||||
|
||||
/* Some sanity checking. */
|
||||
BFD_ASSERT (stub_sec == stub_list->stub_sec);
|
||||
@ -1944,6 +1945,11 @@ hppa_elf_stub_finish (output_bfd)
|
||||
|
||||
/* Make space to hold the relocations for the stub section. */
|
||||
reloc_size = bfd_get_reloc_upper_bound (stub_bfd, stub_sec);
|
||||
if (reloc_size < 0)
|
||||
{
|
||||
/* FIXME: Should return an error. */
|
||||
abort ();
|
||||
}
|
||||
reloc_vector = (arelent **) malloc (reloc_size);
|
||||
if (reloc_vector == NULL && reloc_size != 0)
|
||||
{
|
||||
@ -1953,8 +1959,15 @@ hppa_elf_stub_finish (output_bfd)
|
||||
}
|
||||
|
||||
/* If we have relocations, do them. */
|
||||
if (bfd_canonicalize_reloc (stub_bfd, stub_sec, reloc_vector,
|
||||
output_bfd->outsymbols))
|
||||
reloc_count = bfd_canonicalize_reloc (stub_bfd, stub_sec,
|
||||
reloc_vector,
|
||||
output_bfd->outsymbols);
|
||||
if (reloc_count < 0)
|
||||
{
|
||||
/* FIXME: Should return an error. */
|
||||
abort ();
|
||||
}
|
||||
if (reloc_count > 0)
|
||||
{
|
||||
arelent **parent;
|
||||
for (parent = reloc_vector; *parent != NULL; parent++)
|
||||
@ -2742,21 +2755,28 @@ hppa_look_for_stubs_in_section (stub_bfd, abfd, output_bfd, asec,
|
||||
location. */
|
||||
if (bfd_get_outsymbols (abfd) == NULL)
|
||||
{
|
||||
size_t symsize;
|
||||
long symsize;
|
||||
long symcount;
|
||||
|
||||
symsize = get_symtab_upper_bound (abfd);
|
||||
symsize = bfd_get_symtab_upper_bound (abfd);
|
||||
if (symsize < 0)
|
||||
goto error_return;
|
||||
abfd->outsymbols = (asymbol **) bfd_alloc (abfd, symsize);
|
||||
if (!abfd->outsymbols)
|
||||
if (!abfd->outsymbols && symsize != 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
goto error_return;
|
||||
}
|
||||
abfd->symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
|
||||
symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
|
||||
if (symcount < 0)
|
||||
goto error_return;
|
||||
abfd->symcount = symcount;
|
||||
}
|
||||
|
||||
/* Now get the relocations. */
|
||||
bfd_canonicalize_reloc (abfd, asec, reloc_vector,
|
||||
bfd_get_outsymbols (abfd));
|
||||
if (bfd_canonicalize_reloc (abfd, asec, reloc_vector,
|
||||
bfd_get_outsymbols (abfd)) < 0)
|
||||
goto error_return;
|
||||
|
||||
/* Examine each relocation entry in this section. */
|
||||
for (i = 0; i < asec->reloc_count; i++)
|
||||
|
@ -1469,14 +1469,16 @@ mips_elf_final_link (abfd, info)
|
||||
{
|
||||
asection *input_section;
|
||||
bfd *input_bfd;
|
||||
bfd_size_type relsize;
|
||||
long relsize;
|
||||
arelent **relocs;
|
||||
bfd_size_type reloc_count;
|
||||
long reloc_count;
|
||||
|
||||
input_section = p->u.indirect.section;
|
||||
input_bfd = input_section->owner;
|
||||
relsize = bfd_get_reloc_upper_bound (input_bfd,
|
||||
input_section);
|
||||
if (relsize < 0)
|
||||
return false;
|
||||
relocs = (arelent **) malloc (relsize);
|
||||
if (!relocs && relsize != 0)
|
||||
{
|
||||
@ -1487,6 +1489,8 @@ mips_elf_final_link (abfd, info)
|
||||
bfd_canonicalize_reloc (input_bfd, input_section,
|
||||
relocs,
|
||||
bfd_get_outsymbols (input_bfd));
|
||||
if (reloc_count < 0)
|
||||
return false;
|
||||
BFD_ASSERT (reloc_count == input_section->reloc_count);
|
||||
o->reloc_count += reloc_count;
|
||||
free (relocs);
|
||||
|
@ -2740,14 +2740,14 @@ error_return:
|
||||
the vector allocated based on this size. However, the ELF symbol table
|
||||
always has a dummy entry as symbol #0, so it ends up even. */
|
||||
|
||||
unsigned int
|
||||
long
|
||||
elf_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned int symcount;
|
||||
unsigned int symtab_size = 0;
|
||||
|
||||
long symcount;
|
||||
long symtab_size;
|
||||
Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
||||
symcount = hdr->sh_size / sizeof (Elf_External_Sym);
|
||||
symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
|
||||
|
||||
@ -2760,7 +2760,7 @@ elf_get_symtab_upper_bound (abfd)
|
||||
attached to bfd <<abfd>>
|
||||
|
||||
*/
|
||||
unsigned int
|
||||
long
|
||||
elf_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
@ -3038,7 +3038,7 @@ elf_slurp_reloc_table (abfd, asect, symbols)
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
elf_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
@ -3051,13 +3051,19 @@ elf_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
|
||||
/* snarfed from coffcode.h */
|
||||
if (use_rela_p)
|
||||
elf_slurp_reloca_table (abfd, section, symbols);
|
||||
{
|
||||
if (! elf_slurp_reloca_table (abfd, section, symbols))
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
elf_slurp_reloc_table (abfd, section, symbols);
|
||||
{
|
||||
if (! elf_slurp_reloc_table (abfd, section, symbols))
|
||||
return -1;
|
||||
}
|
||||
|
||||
tblptr = section->relocation;
|
||||
if (!tblptr)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
for (; count++ < section->reloc_count;)
|
||||
*relptr++ = tblptr++;
|
||||
@ -3066,16 +3072,15 @@ elf_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
return section->reloc_count;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
elf_get_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
{
|
||||
|
||||
if (!elf_slurp_symbol_table (abfd, alocation))
|
||||
return 0;
|
||||
else
|
||||
return bfd_get_symcount (abfd);
|
||||
return -1;
|
||||
|
||||
return bfd_get_symcount (abfd);
|
||||
}
|
||||
|
||||
asymbol *
|
||||
|
@ -786,14 +786,14 @@ doit:
|
||||
/* call aout_32 versions if the input file was generated by gcc */
|
||||
/************************************************************************/
|
||||
|
||||
unsigned int aout_32_get_symtab PARAMS ((bfd * abfd, asymbol ** location));
|
||||
unsigned int aout_32_get_symtab_upper_bound PARAMS ((bfd * abfd));
|
||||
long aout_32_get_symtab PARAMS ((bfd * abfd, asymbol ** location));
|
||||
long aout_32_get_symtab_upper_bound PARAMS ((bfd * abfd));
|
||||
|
||||
unsigned int aout_32_canonicalize_reloc PARAMS ((bfd * abfd, sec_ptr section,
|
||||
arelent ** relptr,
|
||||
asymbol ** symbols));
|
||||
long aout_32_canonicalize_reloc PARAMS ((bfd * abfd, sec_ptr section,
|
||||
arelent ** relptr,
|
||||
asymbol ** symbols));
|
||||
|
||||
unsigned int
|
||||
long
|
||||
MY (get_symtab) (abfd, location)
|
||||
bfd *abfd;
|
||||
asymbol **location;
|
||||
@ -805,7 +805,7 @@ MY (get_symtab) (abfd, location)
|
||||
return aout_32_get_symtab (abfd, location);
|
||||
|
||||
if (!MY (slurp_symbol_table) (abfd))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
for (symbase = obj_aout_symbols (abfd); counter++ < bfd_get_symcount (abfd);)
|
||||
*(location++) = (asymbol *) (symbase++);
|
||||
@ -813,14 +813,14 @@ MY (get_symtab) (abfd, location)
|
||||
return bfd_get_symcount (abfd);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
MY (get_symtab_upper_bound) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (obj_aout_subformat (abfd) == gnu_encap_format)
|
||||
return aout_32_get_symtab_upper_bound (abfd);
|
||||
if (!MY (slurp_symbol_table) (abfd))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *));
|
||||
}
|
||||
@ -828,7 +828,7 @@ MY (get_symtab_upper_bound) (abfd)
|
||||
|
||||
|
||||
|
||||
unsigned int
|
||||
long
|
||||
MY (canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
@ -841,7 +841,7 @@ MY (canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
return aout_32_canonicalize_reloc (abfd, section, relptr, symbols);
|
||||
|
||||
if (!(tblptr || MY (slurp_reloc_table) (abfd, section, symbols)))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
if (section->flags & SEC_CONSTRUCTOR)
|
||||
{
|
||||
@ -856,7 +856,7 @@ MY (canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
{
|
||||
tblptr = section->relocation;
|
||||
if (!tblptr)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
for (count = 0; count++ < section->reloc_count;)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ hppabsd_core_core_file_p (abfd)
|
||||
val = bfd_read ((void *) &u, 1, sizeof u, abfd);
|
||||
if (val != sizeof u)
|
||||
{
|
||||
bfd_error = wrong_format;
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -145,19 +145,19 @@ hppabsd_core_core_file_p (abfd)
|
||||
struct stat statbuf;
|
||||
if (stream == NULL || fstat (fileno (stream), &statbuf) < 0)
|
||||
{
|
||||
bfd_error = system_call_error;
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return NULL;
|
||||
}
|
||||
if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) > statbuf.st_size)
|
||||
{
|
||||
bfd_error = file_truncated;
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
return NULL;
|
||||
}
|
||||
if (clicksz * (UPAGES + u.u_dsize + u.u_ssize) < statbuf.st_size)
|
||||
{
|
||||
/* The file is too big. Maybe it's not a core file
|
||||
or we otherwise have bad values for u_dsize and u_ssize). */
|
||||
bfd_error = wrong_format;
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -168,7 +168,7 @@ hppabsd_core_core_file_p (abfd)
|
||||
bfd_zalloc (abfd, sizeof (struct hppabsd_core_struct));
|
||||
if (!coredata)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -245,13 +245,13 @@ hppabsd_core_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd_generic_get_section_contents
|
||||
#define hppabsd_core_new_section_hook (boolean (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_true
|
||||
#define hppabsd_core_get_symtab_upper_bound bfd_0u
|
||||
#define hppabsd_core_get_symtab (unsigned int (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define hppabsd_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0u
|
||||
#define hppabsd_core_canonicalize_reloc (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define hppabsd_core_get_symtab_upper_bound bfd_0l
|
||||
#define hppabsd_core_get_symtab (long (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define hppabsd_core_get_reloc_upper_bound (long (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0l
|
||||
#define hppabsd_core_canonicalize_reloc (long (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define hppabsd_core_print_symbol (void (*) PARAMS \
|
||||
((bfd *, PTR, struct symbol_cache_entry *, \
|
||||
bfd_print_symbol_type))) bfd_false
|
||||
@ -285,6 +285,12 @@ hppabsd_core_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define hppabsd_core_bfd_final_link \
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define hppabsd_core_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
|
||||
#define hppabsd_core_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
|
||||
#define hppabsd_core_bfd_is_local_label \
|
||||
((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
static void
|
||||
|
@ -105,7 +105,8 @@ hpux_core_make_empty_symbol (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
|
||||
new->the_bfd = abfd;
|
||||
if (new)
|
||||
new->the_bfd = abfd;
|
||||
return new;
|
||||
}
|
||||
|
||||
@ -222,17 +223,17 @@ hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
#define hpux_core_close_and_cleanup bfd_generic_close_and_cleanup
|
||||
#define hpux_core_set_section_contents (boolean (*) PARAMS \
|
||||
((bfd *abfd, asection *section, PTR data, file_ptr offset, \
|
||||
bfd_size_type count))) bfd_false
|
||||
bfd_size_type count))) bfd_generic_set_section_contents
|
||||
#define hpux_core_get_section_contents bfd_generic_get_section_contents
|
||||
#define hpux_core_new_section_hook (boolean (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_true
|
||||
#define hpux_core_get_symtab_upper_bound bfd_0u
|
||||
#define hpux_core_get_symtab (unsigned int (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define hpux_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0u
|
||||
#define hpux_core_canonicalize_reloc (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define hpux_core_get_symtab_upper_bound bfd_0l
|
||||
#define hpux_core_get_symtab (long (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define hpux_core_get_reloc_upper_bound (long (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0l
|
||||
#define hpux_core_canonicalize_reloc (long (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define hpux_core_print_symbol (void (*) PARAMS \
|
||||
((bfd *, PTR, struct symbol_cache_entry *, \
|
||||
bfd_print_symbol_type))) bfd_false
|
||||
@ -266,6 +267,12 @@ hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define hpux_core_bfd_final_link \
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define hpux_core_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
|
||||
#define hpux_core_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
|
||||
#define hpux_core_bfd_is_local_label \
|
||||
((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
void
|
||||
@ -273,9 +280,10 @@ swap_abort()
|
||||
{
|
||||
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
|
||||
}
|
||||
#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
|
||||
#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
|
||||
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
|
||||
#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
|
||||
#define NO_SIGNED_GET \
|
||||
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
||||
|
||||
bfd_target hpux_core_vec =
|
||||
{
|
||||
|
@ -515,8 +515,8 @@ NAME (lynx, squirt_out_relocs) (abfd, section)
|
||||
}
|
||||
|
||||
/* This is stupid. This function should be a boolean predicate */
|
||||
unsigned int
|
||||
NAME (lynx, canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
long
|
||||
NAME(lynx,canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
arelent **relptr;
|
||||
@ -526,7 +526,7 @@ NAME (lynx, canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
unsigned int count;
|
||||
|
||||
if (!(tblptr || NAME (lynx, slurp_reloc_table) (abfd, section, symbols)))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
if (section->flags & SEC_CONSTRUCTOR)
|
||||
{
|
||||
@ -541,7 +541,7 @@ NAME (lynx, canonicalize_reloc) (abfd, section, relptr, symbols)
|
||||
{
|
||||
tblptr = section->relocation;
|
||||
if (!tblptr)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
for (count = 0; count++ < section->reloc_count;)
|
||||
{
|
||||
|
41
bfd/ieee.c
41
bfd/ieee.c
@ -586,7 +586,7 @@ get_symbol (abfd,
|
||||
return last_symbol;
|
||||
}
|
||||
|
||||
static void
|
||||
static boolean
|
||||
ieee_slurp_external_symbols (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
@ -613,7 +613,8 @@ ieee_slurp_external_symbols (abfd)
|
||||
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
|
||||
&prev_symbols_ptr,
|
||||
&ieee->external_symbol_max_index, 'D');
|
||||
|
||||
if (symbol == NULL)
|
||||
return false;
|
||||
|
||||
symbol->symbol.the_bfd = abfd;
|
||||
symbol->symbol.name = read_id (&(ieee->h));
|
||||
@ -626,7 +627,8 @@ ieee_slurp_external_symbols (abfd)
|
||||
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
|
||||
&prev_symbols_ptr,
|
||||
&ieee->external_symbol_max_index, 'D');
|
||||
|
||||
if (symbol == NULL)
|
||||
return false;
|
||||
|
||||
BFD_ASSERT (symbol->index >= ieee->external_symbol_min_index);
|
||||
|
||||
@ -710,7 +712,8 @@ ieee_slurp_external_symbols (abfd)
|
||||
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
|
||||
&prev_reference_ptr,
|
||||
&ieee->external_reference_max_index, 'X');
|
||||
|
||||
if (symbol == NULL)
|
||||
return false;
|
||||
|
||||
symbol->symbol.the_bfd = abfd;
|
||||
symbol->symbol.name = read_id (&(ieee->h));
|
||||
@ -760,24 +763,29 @@ ieee_slurp_external_symbols (abfd)
|
||||
|
||||
*prev_symbols_ptr = (ieee_symbol_type *) NULL;
|
||||
*prev_reference_ptr = (ieee_symbol_type *) NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
static boolean
|
||||
ieee_slurp_symbol_table (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (IEEE_DATA (abfd)->read_symbols == false)
|
||||
{
|
||||
ieee_slurp_external_symbols (abfd);
|
||||
if (! ieee_slurp_external_symbols (abfd))
|
||||
return false;
|
||||
IEEE_DATA (abfd)->read_symbols = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
ieee_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
ieee_slurp_symbol_table (abfd);
|
||||
if (! ieee_slurp_symbol_table (abfd))
|
||||
return -1;
|
||||
|
||||
return (abfd->symcount != 0) ?
|
||||
(abfd->symcount + 1) * (sizeof (ieee_symbol_type *)) : 0;
|
||||
@ -790,7 +798,7 @@ symbol index order
|
||||
|
||||
extern bfd_target ieee_vec;
|
||||
|
||||
unsigned int
|
||||
long
|
||||
ieee_get_symtab (abfd, location)
|
||||
bfd *abfd;
|
||||
asymbol **location;
|
||||
@ -805,7 +813,8 @@ ieee_get_symtab (abfd, location)
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
dummy_bfd.xvec = &ieee_vec;
|
||||
ieee_slurp_symbol_table (abfd);
|
||||
if (! ieee_slurp_symbol_table (abfd))
|
||||
return -1;
|
||||
|
||||
if (ieee->symbol_table_full == false)
|
||||
{
|
||||
@ -1684,12 +1693,13 @@ ieee_new_section_hook (abfd, newsect)
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
ieee_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
{
|
||||
ieee_slurp_section_data (abfd);
|
||||
if (! ieee_slurp_section_data (abfd))
|
||||
return -1;
|
||||
return (asect->reloc_count + 1) * sizeof (arelent *);
|
||||
}
|
||||
|
||||
@ -1707,7 +1717,7 @@ ieee_get_section_contents (abfd, section, location, offset, count)
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
ieee_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
@ -3310,6 +3320,11 @@ ieee_bfd_debug_info_accumulate (abfd, section)
|
||||
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define ieee_bfd_final_link _bfd_generic_final_link
|
||||
#define ieee_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
|
||||
#define ieee_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
|
||||
#define ieee_bfd_is_local_label bfd_generic_is_local_label
|
||||
|
||||
/*SUPPRESS 460 */
|
||||
bfd_target ieee_vec =
|
||||
|
@ -178,7 +178,8 @@ irix_core_make_empty_symbol (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
|
||||
new->the_bfd = abfd;
|
||||
if (new)
|
||||
new->the_bfd = abfd;
|
||||
return new;
|
||||
}
|
||||
|
||||
@ -194,17 +195,17 @@ irix_core_make_empty_symbol (abfd)
|
||||
#define irix_core_close_and_cleanup bfd_generic_close_and_cleanup
|
||||
#define irix_core_set_section_contents (boolean (*) PARAMS \
|
||||
((bfd *abfd, asection *section, PTR data, file_ptr offset, \
|
||||
bfd_size_type count))) bfd_false
|
||||
bfd_size_type count))) bfd_generic_set_section_contents
|
||||
#define irix_core_get_section_contents bfd_generic_get_section_contents
|
||||
#define irix_core_new_section_hook (boolean (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_true
|
||||
#define irix_core_get_symtab_upper_bound bfd_0u
|
||||
#define irix_core_get_symtab (unsigned int (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define irix_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0u
|
||||
#define irix_core_canonicalize_reloc (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define irix_core_get_symtab_upper_bound bfd_0l
|
||||
#define irix_core_get_symtab (long (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define irix_core_get_reloc_upper_bound (long (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0l
|
||||
#define irix_core_canonicalize_reloc (long (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define irix_core_print_symbol (void (*) PARAMS \
|
||||
((bfd *, PTR, struct symbol_cache_entry *, \
|
||||
bfd_print_symbol_type))) bfd_false
|
||||
@ -239,15 +240,23 @@ irix_core_make_empty_symbol (abfd)
|
||||
#define irix_core_bfd_final_link \
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
|
||||
#define irix_core_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
|
||||
#define irix_core_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
|
||||
#define irix_core_bfd_is_local_label \
|
||||
((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
void
|
||||
swap_abort()
|
||||
{
|
||||
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
|
||||
}
|
||||
#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
|
||||
#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
|
||||
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
|
||||
#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
|
||||
#define NO_SIGNED_GET \
|
||||
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
||||
|
||||
bfd_target irix_core_vec =
|
||||
{
|
||||
|
@ -44,9 +44,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define BYTES_IN_WORD 4
|
||||
#endif /* ARCH_SIZE==32 */
|
||||
|
||||
/* Declare at file level, since it isused in parameter lists, which
|
||||
have weird scope. */
|
||||
/* Declare at file level, since used in parameter lists, which have
|
||||
weird scope. */
|
||||
struct external_exec;
|
||||
struct external_nlist;
|
||||
|
||||
/* Back-end information for various a.out targets. */
|
||||
struct aout_backend_data
|
||||
@ -76,6 +77,25 @@ struct aout_backend_data
|
||||
to the size of the text section in the file for alignment purposes but
|
||||
does *not* get counted in the length of the text section. */
|
||||
unsigned char exec_header_not_counted;
|
||||
|
||||
/* A callback function to read in the dynamic symbols of an object
|
||||
which is dynamically linked. This returns the number of symbols
|
||||
read (or -1 on error) and sets *SYMS to a buffer holding an array
|
||||
of external_nlist structures and *STRS and *STRSIZE to the
|
||||
associated string table. (This interface works for SunOS, but
|
||||
can be changed if some other interface is better for some other
|
||||
shared library implementation). */
|
||||
bfd_size_type (*read_dynamic_symbols) PARAMS ((bfd *,
|
||||
struct external_nlist **syms,
|
||||
char **strs,
|
||||
bfd_size_type *strsize));
|
||||
|
||||
/* A callback function to read in the dynamic relocs of an object
|
||||
which is dynamically linked. This returns the number of relocs
|
||||
read (or -1 on error) and sets *RELOCS to a buffer holding an
|
||||
array of external reloc structures (the type depends upon the
|
||||
type of object file). */
|
||||
bfd_size_type (*read_dynamic_relocs) PARAMS ((bfd *, PTR *relocs));
|
||||
};
|
||||
#define aout_backend_info(abfd) \
|
||||
((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
|
||||
@ -133,7 +153,7 @@ enum machine_type {
|
||||
M_HPUX = (0x20c % 256)/* HP 200/300 HPUX binary */
|
||||
};
|
||||
|
||||
#define N_DYNAMIC(exec) ((exec).a_info & 0x8000000)
|
||||
#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
|
||||
|
||||
#ifndef N_MAGIC
|
||||
# define N_MAGIC(exec) ((exec).a_info & 0xffff)
|
||||
@ -154,6 +174,12 @@ enum machine_type {
|
||||
| (((flags) & 0xff) << 24))
|
||||
#endif
|
||||
|
||||
#ifndef N_SET_DYNAMIC
|
||||
# define N_SET_DYNAMIC(exec, dynamic) \
|
||||
((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
|
||||
((exec).a_info & 0x7fffffff))
|
||||
#endif
|
||||
|
||||
#ifndef N_SET_MAGIC
|
||||
# define N_SET_MAGIC(exec, magic) \
|
||||
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
|
||||
@ -227,6 +253,9 @@ struct aoutdata {
|
||||
bfd_size_type external_sym_count;
|
||||
char *external_strings;
|
||||
struct aout_link_hash_entry **sym_hashes;
|
||||
|
||||
/* A pointer for shared library information. */
|
||||
PTR dynamic_info;
|
||||
};
|
||||
|
||||
struct aout_data_struct {
|
||||
@ -249,6 +278,7 @@ struct aout_data_struct {
|
||||
#define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count)
|
||||
#define obj_aout_external_strings(bfd) (adata(bfd).external_strings)
|
||||
#define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes)
|
||||
#define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info)
|
||||
|
||||
/* We take the address of the first element of an asymbol to ensure that the
|
||||
macro is only ever applied to an asymbol */
|
||||
@ -294,21 +324,21 @@ NAME(aout,write_syms) PARAMS ((bfd *abfd));
|
||||
void
|
||||
NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
|
||||
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
|
||||
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
|
||||
|
||||
boolean
|
||||
NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
|
||||
asymbol **symbols));
|
||||
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
|
||||
arelent **relptr, asymbol **symbols));
|
||||
|
||||
unsigned int
|
||||
long
|
||||
NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
|
||||
|
||||
void
|
||||
@ -375,6 +405,18 @@ aout_stab_name PARAMS ((int code));
|
||||
#define NO_WRITE_HEADER_KLUDGE 0
|
||||
#endif
|
||||
|
||||
#ifndef aout_32_bfd_copy_private_section_data
|
||||
#define aout_32_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
|
||||
#endif
|
||||
#ifndef aout_32_bfd_copy_private_bfd_data
|
||||
#define aout_32_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
|
||||
#endif
|
||||
#ifndef aout_32_bfd_is_local_label
|
||||
#define aout_32_bfd_is_local_label bfd_generic_is_local_label
|
||||
#endif
|
||||
|
||||
#ifndef WRITE_HEADERS
|
||||
#define WRITE_HEADERS(abfd, execp) \
|
||||
{ \
|
||||
|
@ -117,6 +117,7 @@ boolean bfd_true PARAMS ((bfd *ignore));
|
||||
PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
|
||||
int bfd_0 PARAMS ((bfd *ignore));
|
||||
unsigned int bfd_0u PARAMS ((bfd *ignore));
|
||||
long bfd_0l PARAMS ((bfd *ignore));
|
||||
void bfd_void PARAMS ((bfd *ignore));
|
||||
|
||||
bfd * _bfd_new_bfd_contained_in PARAMS ((bfd *));
|
||||
@ -178,6 +179,12 @@ extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
|
||||
extern boolean _bfd_generic_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* Generic add symbol routine. This version is used by targets for
|
||||
which the linker must collect constructors and destructors by name,
|
||||
as the collect2 program does. */
|
||||
extern boolean _bfd_generic_link_add_symbols_collect
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* Generic archive add symbol routine. */
|
||||
extern boolean _bfd_generic_link_add_archive_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *,
|
||||
|
@ -81,6 +81,14 @@ bfd_0u (ignore)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*ARGUSED*/
|
||||
long
|
||||
bfd_0l (ignore)
|
||||
bfd *ignore;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
bfd_void (ignore)
|
||||
|
@ -117,6 +117,7 @@ boolean bfd_true PARAMS ((bfd *ignore));
|
||||
PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
|
||||
int bfd_0 PARAMS ((bfd *ignore));
|
||||
unsigned int bfd_0u PARAMS ((bfd *ignore));
|
||||
long bfd_0l PARAMS ((bfd *ignore));
|
||||
void bfd_void PARAMS ((bfd *ignore));
|
||||
|
||||
bfd * _bfd_new_bfd_contained_in PARAMS ((bfd *));
|
||||
@ -307,7 +308,7 @@ bfd_generic_relax_section
|
||||
PARAMS ((bfd *abfd,
|
||||
asection *section,
|
||||
struct bfd_link_info *,
|
||||
asymbol **symbols));
|
||||
boolean *));
|
||||
|
||||
bfd_byte *
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD COFF object file private structure.
|
||||
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
|
||||
#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
|
||||
#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
|
||||
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
|
||||
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
|
||||
#if CFILE_STUFF
|
||||
@ -76,22 +77,25 @@ typedef struct coff_tdata
|
||||
/* Functions in coffgen.c. */
|
||||
extern bfd_target *coff_object_p PARAMS ((bfd *));
|
||||
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
|
||||
extern unsigned int coff_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern unsigned int coff_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern void coff_count_linenumbers PARAMS ((bfd *));
|
||||
extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern int coff_count_linenumbers PARAMS ((bfd *));
|
||||
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
|
||||
extern void coff_renumber_symbols PARAMS ((bfd *));
|
||||
extern boolean coff_renumber_symbols PARAMS ((bfd *));
|
||||
extern void coff_mangle_symbols PARAMS ((bfd *));
|
||||
extern void coff_write_symbols PARAMS ((bfd *));
|
||||
extern void coff_write_linenumbers PARAMS ((bfd *));
|
||||
extern boolean coff_write_linenumbers PARAMS ((bfd *));
|
||||
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
|
||||
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
|
||||
extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
|
||||
extern unsigned int coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
|
||||
extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
|
||||
bfd_print_symbol_type how));
|
||||
extern asymbol *coff_make_debug_symbol PARAMS ((bfd *, PTR, unsigned long));
|
||||
extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *,
|
||||
symbol_info *ret));
|
||||
extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR,
|
||||
unsigned long));
|
||||
extern boolean coff_find_nearest_line PARAMS ((bfd *,
|
||||
asection *,
|
||||
asymbol **,
|
||||
@ -100,13 +104,17 @@ extern boolean coff_find_nearest_line PARAMS ((bfd *,
|
||||
CONST char **functionname_ptr,
|
||||
unsigned int *line_ptr));
|
||||
extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
|
||||
extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *,
|
||||
asection *,
|
||||
asymbol **));
|
||||
extern boolean bfd_coff_reloc16_relax_section
|
||||
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
|
||||
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
|
||||
PARAMS ((bfd *, struct bfd_seclet *, bfd_byte *, boolean relocateable));
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
|
||||
bfd_byte *, boolean relocateable, asymbol **));
|
||||
extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
|
||||
struct bfd_seclet *));
|
||||
struct bfd_link_info *,
|
||||
asection *));
|
||||
extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
|
||||
asection *input_section,
|
||||
bfd_vma val));
|
||||
|
||||
/* And more taken from the source .. */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD COFF object file private structure.
|
||||
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -77,18 +77,18 @@ typedef struct coff_tdata
|
||||
/* Functions in coffgen.c. */
|
||||
extern bfd_target *coff_object_p PARAMS ((bfd *));
|
||||
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
|
||||
extern unsigned int coff_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern unsigned int coff_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern int coff_count_linenumbers PARAMS ((bfd *));
|
||||
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
|
||||
extern void coff_renumber_symbols PARAMS ((bfd *));
|
||||
extern boolean coff_renumber_symbols PARAMS ((bfd *));
|
||||
extern void coff_mangle_symbols PARAMS ((bfd *));
|
||||
extern void coff_write_symbols PARAMS ((bfd *));
|
||||
extern void coff_write_linenumbers PARAMS ((bfd *));
|
||||
extern boolean coff_write_linenumbers PARAMS ((bfd *));
|
||||
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
|
||||
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
|
||||
extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
|
||||
extern unsigned int coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
|
||||
extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
|
||||
bfd_print_symbol_type how));
|
||||
@ -104,23 +104,21 @@ extern boolean coff_find_nearest_line PARAMS ((bfd *,
|
||||
CONST char **functionname_ptr,
|
||||
unsigned int *line_ptr));
|
||||
extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
|
||||
extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *,
|
||||
asection *,
|
||||
struct bfd_link_info *,
|
||||
asymbol **));
|
||||
extern boolean bfd_coff_reloc16_relax_section
|
||||
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
|
||||
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
|
||||
bfd_byte *, boolean relocateable, asymbol **));
|
||||
extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
|
||||
struct bfd_link_info *,
|
||||
asection *));
|
||||
extern void bfd_perform_slip PARAMS ((asymbol **s, unsigned int slip,
|
||||
extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
|
||||
asection *input_section,
|
||||
bfd_vma value));
|
||||
bfd_vma val));
|
||||
|
||||
/* And more taken from the source .. */
|
||||
|
||||
typedef struct coff_ptr_struct
|
||||
typedef struct coff_ptr_struct
|
||||
{
|
||||
|
||||
/* Remembers the offset from the first symbol in the file for
|
||||
@ -169,7 +167,7 @@ struct lineno_cache_entry *lineno;
|
||||
/* Have the line numbers been relocated yet ? */
|
||||
boolean done_lineno;
|
||||
} coff_symbol_type;
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
void (*_bfd_coff_swap_aux_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
@ -282,8 +280,8 @@ typedef struct
|
||||
unsigned int *src_ptr,
|
||||
unsigned int *dst_ptr));
|
||||
int (*_bfd_coff_reloc16_estimate) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *input_section,
|
||||
asymbol **symbols,
|
||||
arelent *r,
|
||||
unsigned int shrink,
|
||||
struct bfd_link_info *link_info));
|
||||
@ -365,7 +363,7 @@ typedef struct
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
|
||||
(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
|
||||
|
||||
#define bfd_coff_reloc16_estimate(abfd, section, symbols, reloc, shrink, link_info)\
|
||||
#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
||||
(section, symbols, reloc, shrink, link_info))
|
||||
|
||||
(abfd, section, reloc, shrink, link_info))
|
||||
|
||||
|
@ -217,19 +217,18 @@ extern boolean ecoff_slurp_symbolic_info PARAMS ((bfd *));
|
||||
|
||||
/* Generic ECOFF BFD backend vectors. */
|
||||
extern asymbol *ecoff_make_empty_symbol PARAMS ((bfd *abfd));
|
||||
extern unsigned int ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
|
||||
extern unsigned int ecoff_get_symtab PARAMS ((bfd *abfd,
|
||||
asymbol **alocation));
|
||||
extern long ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
|
||||
extern long ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation));
|
||||
extern void ecoff_get_symbol_info PARAMS ((bfd *abfd,
|
||||
asymbol *symbol,
|
||||
symbol_info *ret));
|
||||
extern void ecoff_print_symbol PARAMS ((bfd *abfd, PTR filep,
|
||||
asymbol *symbol,
|
||||
bfd_print_symbol_type how));
|
||||
extern unsigned int ecoff_canonicalize_reloc PARAMS ((bfd *abfd,
|
||||
asection *section,
|
||||
arelent **relptr,
|
||||
asymbol **symbols));
|
||||
extern long ecoff_canonicalize_reloc PARAMS ((bfd *abfd,
|
||||
asection *section,
|
||||
arelent **relptr,
|
||||
asymbol **symbols));
|
||||
extern boolean ecoff_find_nearest_line PARAMS ((bfd *abfd,
|
||||
asection *section,
|
||||
asymbol **symbols,
|
||||
|
22
bfd/libelf.h
22
bfd/libelf.h
@ -259,12 +259,11 @@ extern boolean bfd_elf32_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
|
||||
file_ptr,
|
||||
bfd_size_type));
|
||||
|
||||
extern unsigned int bfd_elf32_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern unsigned int bfd_elf32_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern unsigned int bfd_elf32_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern unsigned int bfd_elf32_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
|
||||
arelent **,
|
||||
asymbol **));
|
||||
extern long bfd_elf32_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long bfd_elf32_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern long bfd_elf32_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern long bfd_elf32_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
|
||||
arelent **, asymbol **));
|
||||
extern asymbol *bfd_elf32_make_empty_symbol PARAMS ((bfd *));
|
||||
extern void bfd_elf32_print_symbol PARAMS ((bfd *, PTR, asymbol *,
|
||||
bfd_print_symbol_type));
|
||||
@ -296,12 +295,11 @@ extern boolean bfd_elf64_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
|
||||
file_ptr,
|
||||
bfd_size_type));
|
||||
|
||||
extern unsigned int bfd_elf64_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern unsigned int bfd_elf64_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern unsigned int bfd_elf64_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern unsigned int bfd_elf64_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
|
||||
arelent **,
|
||||
asymbol **));
|
||||
extern long bfd_elf64_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long bfd_elf64_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern long bfd_elf64_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern long bfd_elf64_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
|
||||
arelent **, asymbol **));
|
||||
extern asymbol *bfd_elf64_make_empty_symbol PARAMS ((bfd *));
|
||||
extern void bfd_elf64_print_symbol PARAMS ((bfd *, PTR, asymbol *,
|
||||
bfd_print_symbol_type));
|
||||
|
66
bfd/libnlm.h
66
bfd/libnlm.h
@ -58,17 +58,17 @@ extern boolean nlm_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
|
||||
|
||||
extern void nlmNAME(get_symbol_info)
|
||||
PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
extern unsigned int nlmNAME(get_symtab_upper_bound)
|
||||
extern long nlmNAME(get_symtab_upper_bound)
|
||||
PARAMS ((bfd *));
|
||||
extern unsigned int nlmNAME(get_symtab)
|
||||
extern long nlmNAME(get_symtab)
|
||||
PARAMS ((bfd *, asymbol **));
|
||||
extern asymbol *nlmNAME(make_empty_symbol)
|
||||
PARAMS ((bfd *));
|
||||
extern void nlmNAME(print_symbol)
|
||||
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
|
||||
extern unsigned int nlmNAME(get_reloc_upper_bound)
|
||||
extern long nlmNAME(get_reloc_upper_bound)
|
||||
PARAMS ((bfd *, asection *));
|
||||
extern unsigned int nlmNAME(canonicalize_reloc)
|
||||
extern long nlmNAME(canonicalize_reloc)
|
||||
PARAMS ((bfd *, asection *, arelent **, asymbol **));
|
||||
extern bfd_target *nlmNAME(object_p)
|
||||
PARAMS ((bfd *));
|
||||
@ -99,6 +99,20 @@ struct nlm_obj_tdata
|
||||
/* Caches for data read from object file. */
|
||||
arelent * nlm_reloc_fixups;
|
||||
asection ** nlm_reloc_fixup_secs;
|
||||
/* Backend specific information. This should probably be a pointer,
|
||||
but that would require yet another entry point to initialize the
|
||||
structure. */
|
||||
union
|
||||
{
|
||||
struct /* Alpha backend information. */
|
||||
{
|
||||
bfd_vma gp; /* GP value. */
|
||||
bfd_vma lita_address; /* .lita section address. */
|
||||
bfd_size_type lita_size; /* .lita section size. */
|
||||
}
|
||||
alpha_backend_data;
|
||||
}
|
||||
backend_data;
|
||||
};
|
||||
|
||||
#define nlm_tdata(bfd) ((bfd) -> tdata.nlm_obj_data)
|
||||
@ -117,6 +131,9 @@ struct nlm_obj_tdata
|
||||
#define nlm_relocation_fixups(bfd) (nlm_tdata(bfd) -> nlm_reloc_fixups)
|
||||
#define nlm_relocation_fixup_secs(bfd) (nlm_tdata(bfd)->nlm_reloc_fixup_secs)
|
||||
|
||||
#define nlm_alpha_backend_data(bfd) \
|
||||
(&nlm_tdata (bfd)->backend_data.alpha_backend_data)
|
||||
|
||||
/* This is used when writing out the external relocs. */
|
||||
|
||||
struct reloc_and_sec
|
||||
@ -143,6 +160,10 @@ struct nlm_backend_data
|
||||
enum bfd_architecture arch;
|
||||
/* Machine. */
|
||||
long mach;
|
||||
/* Some NLM formats do not use the uninitialized data section, so
|
||||
all uninitialized data must be put into the regular data section
|
||||
instead. */
|
||||
boolean no_uninitialized_data;
|
||||
/* Some NLM formats have a prefix on the file. If this function is
|
||||
not NULL, it will be called by nlm_object_p. It should return
|
||||
true if this file could match this format, and it should leave
|
||||
@ -188,42 +209,47 @@ struct nlm_backend_data
|
||||
boolean (*nlm_write_external) PARAMS ((bfd *, bfd_size_type,
|
||||
asymbol *,
|
||||
struct reloc_and_sec *));
|
||||
boolean (*nlm_write_export) PARAMS ((bfd *, asymbol *, bfd_vma));
|
||||
};
|
||||
|
||||
#define nlm_backend(bfd) \
|
||||
((struct nlm_backend_data *)((bfd) -> xvec -> backend_data))
|
||||
#define nlm_signature(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> signature : "")
|
||||
(nlm_backend(bfd) -> signature)
|
||||
#define nlm_fixed_header_size(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> fixed_header_size : 0)
|
||||
(nlm_backend(bfd) -> fixed_header_size)
|
||||
#define nlm_optional_prefix_size(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> optional_prefix_size : 0)
|
||||
(nlm_backend(bfd) -> optional_prefix_size)
|
||||
#define nlm_architecture(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> arch : bfd_arch_unknown)
|
||||
(nlm_backend(bfd) -> arch)
|
||||
#define nlm_machine(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> mach : 0)
|
||||
(nlm_backend(bfd) -> mach)
|
||||
#define nlm_no_uninitialized_data(bfd) \
|
||||
(nlm_backend(bfd) -> no_uninitialized_data)
|
||||
#define nlm_backend_object_p_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_backend_object_p : 0)
|
||||
(nlm_backend(bfd) -> nlm_backend_object_p)
|
||||
#define nlm_write_prefix_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_write_prefix : 0)
|
||||
(nlm_backend(bfd) -> nlm_write_prefix)
|
||||
#define nlm_read_reloc_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_read_reloc : 0)
|
||||
(nlm_backend(bfd) -> nlm_read_reloc)
|
||||
#define nlm_mangle_relocs_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_mangle_relocs : 0)
|
||||
(nlm_backend(bfd) -> nlm_mangle_relocs)
|
||||
#define nlm_read_import_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_read_import : 0)
|
||||
(nlm_backend(bfd) -> nlm_read_import)
|
||||
#define nlm_write_import_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_write_import : 0)
|
||||
(nlm_backend(bfd) -> nlm_write_import)
|
||||
#define nlm_set_public_section_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_set_public_section : 0)
|
||||
(nlm_backend(bfd) -> nlm_set_public_section)
|
||||
#define nlm_get_public_offset_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_get_public_offset : 0)
|
||||
(nlm_backend(bfd) -> nlm_get_public_offset)
|
||||
#define nlm_swap_fixed_header_in_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_swap_fhdr_in : 0)
|
||||
(nlm_backend(bfd) -> nlm_swap_fhdr_in)
|
||||
#define nlm_swap_fixed_header_out_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_swap_fhdr_out : 0)
|
||||
(nlm_backend(bfd) -> nlm_swap_fhdr_out)
|
||||
#define nlm_write_external_func(bfd) \
|
||||
(nlm_backend(bfd) ? nlm_backend(bfd) -> nlm_write_external : 0)
|
||||
(nlm_backend(bfd) -> nlm_write_external)
|
||||
#define nlm_write_export_func(bfd) \
|
||||
(nlm_backend(bfd) -> nlm_write_export)
|
||||
|
||||
/* The NLM code, data, and uninitialized sections have no names defined
|
||||
in the NLM, but bfd wants to give them names, so use the traditional
|
||||
|
135
bfd/mipsbsd.c
135
bfd/mipsbsd.c
@ -52,8 +52,14 @@ static void MY(choose_reloc_size) PARAMS ((bfd *abfd));
|
||||
#define MY_write_object_contents MY(write_object_contents)
|
||||
static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
|
||||
|
||||
#define MY_reloc_howto_type_lookup MY(reloc_howto_type_lookup)
|
||||
#define MY_canonicalize_reloc MY(canonicalize_reloc)
|
||||
/* We can't use MY(x) here because it leads to a recursive call to CAT
|
||||
when expanded inside JUMP_TABLE. */
|
||||
#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup
|
||||
#define MY_canonicalize_reloc mipsbsd_canonicalize_reloc
|
||||
|
||||
#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define MY_bfd_final_link _bfd_generic_final_link
|
||||
|
||||
#define MY_backend_data &MY(backend_data)
|
||||
#define MY_BFD_TARGET
|
||||
@ -177,14 +183,20 @@ MY(write_object_contents) (abfd)
|
||||
* 0x10000 and continue normally. This will compensate for the sign extension
|
||||
* when the low bits are added at run time.
|
||||
*/
|
||||
bfd_reloc_status_type
|
||||
mips_fix_hi16_s (abfd,reloc_entry,symbol,data,input_section,output_bfd)
|
||||
static bfd_reloc_status_type
|
||||
mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
static bfd_reloc_status_type
|
||||
mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
struct symbol_cache_entry *symbol;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
|
||||
@ -212,21 +224,22 @@ mips_fix_hi16_s (abfd,reloc_entry,symbol,data,input_section,output_bfd)
|
||||
}
|
||||
|
||||
static reloc_howto_type mips_howto_table_ext[] = {
|
||||
{MIPS_RELOC_32, 0, 2, 32, false, 0, true, true, 0,
|
||||
{MIPS_RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield, 0,
|
||||
"32", false, 0, 0xffffffff, false},
|
||||
{MIPS_RELOC_JMP, 2, 2, 26, false, 0, false, true, 0,
|
||||
{MIPS_RELOC_JMP, 2, 2, 26, false, 0, complain_overflow_bitfield, 0,
|
||||
"MIPS_JMP", false, 0, 0x03ffffff, false},
|
||||
{MIPS_RELOC_WDISP16, 2, 1, 16, true, 0, false, true, 0,
|
||||
{MIPS_RELOC_WDISP16, 2, 1, 16, true, 0, complain_overflow_signed, 0,
|
||||
"WDISP16", false, 0, 0x0000ffff, false},
|
||||
{MIPS_RELOC_HI16, 16, 1, 16, false, 0, false, true, 0,
|
||||
{MIPS_RELOC_HI16, 16, 1, 16, false, 0, complain_overflow_bitfield, 0,
|
||||
"HI16", false, 0, 0x0000ffff, false},
|
||||
{MIPS_RELOC_HI16_S, 16, 1, 16, false, 0, false, true, mips_fix_hi16_s,
|
||||
"HI16_S", false, 0, 0x0000ffff, false},
|
||||
{MIPS_RELOC_LO16, 0, 1, 16, false, 0, false, true, 0,
|
||||
{MIPS_RELOC_HI16_S, 16, 1, 16, false, 0, complain_overflow_bitfield,
|
||||
mips_fix_hi16_s,
|
||||
"HI16_S", false, 0, 0x0000ffff, false},
|
||||
{MIPS_RELOC_LO16, 0, 1, 16, false, 0, complain_overflow_dont, 0,
|
||||
"LO16", false, 0, 0x0000ffff, false},
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
static const reloc_howto_type *
|
||||
MY(reloc_howto_type_lookup) (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
@ -258,7 +271,7 @@ MY(reloc_howto_type_lookup) (abfd, code)
|
||||
* This is just like the standard aoutx.h version but we need to do our
|
||||
* own mapping of external reloc type values to howto entries.
|
||||
*/
|
||||
unsigned int
|
||||
long
|
||||
MY(canonicalize_reloc)(abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
@ -288,10 +301,10 @@ MY(canonicalize_reloc)(abfd, section, relptr, symbols)
|
||||
}
|
||||
|
||||
if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols))
|
||||
return 0;
|
||||
return -1;
|
||||
tblptr = section->relocation;
|
||||
if (!tblptr)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
/* fix up howto entries */
|
||||
for (count = 0; count++ < section->reloc_count;)
|
||||
@ -315,114 +328,60 @@ static CONST struct aout_backend_data MY(backend_data) = {
|
||||
|
||||
bfd_target aout_mips_little_vec =
|
||||
{
|
||||
"aout-mips-little", /* name */
|
||||
"a.out-mips-little", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
false, /* target byte order (little) */
|
||||
false, /* target headers byte order (little) */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
MY_symbol_leading_char,
|
||||
' ', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
1, /* minimum alignment */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
|
||||
_do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
||||
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, MY_core_file_p},
|
||||
{bfd_false, MY_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
MY_core_file_failing_command,
|
||||
MY_core_file_failing_signal,
|
||||
MY_core_file_matches_executable_p,
|
||||
MY_slurp_armap,
|
||||
MY_slurp_extended_name_table,
|
||||
MY_truncate_arname,
|
||||
MY_write_armap,
|
||||
MY_close_and_cleanup,
|
||||
MY_set_section_contents,
|
||||
MY_get_section_contents,
|
||||
MY_new_section_hook,
|
||||
MY_get_symtab_upper_bound,
|
||||
MY_get_symtab,
|
||||
MY_get_reloc_upper_bound,
|
||||
MY_canonicalize_reloc,
|
||||
MY_make_empty_symbol,
|
||||
MY_print_symbol,
|
||||
MY_get_lineno,
|
||||
MY_set_arch_mach,
|
||||
MY_openr_next_archived_file,
|
||||
MY_find_nearest_line,
|
||||
MY_generic_stat_arch_elt,
|
||||
MY_sizeof_headers,
|
||||
MY_bfd_debug_info_start,
|
||||
MY_bfd_debug_info_end,
|
||||
MY_bfd_debug_info_accumulate,
|
||||
bfd_generic_get_relocated_section_contents,
|
||||
bfd_generic_relax_section,
|
||||
bfd_generic_seclet_link,
|
||||
MY_reloc_howto_type_lookup,
|
||||
MY_make_debug_symbol,
|
||||
JUMP_TABLE (MY),
|
||||
(PTR) MY_backend_data,
|
||||
};
|
||||
|
||||
bfd_target aout_mips_big_vec =
|
||||
{
|
||||
"aout-mips-big", /* name */
|
||||
"a.out-mips-big", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
true, /* target byte order (big) */
|
||||
true, /* target headers byte order (big) */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
MY_symbol_leading_char,
|
||||
' ', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
1, /* minimum alignment */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, MY_core_file_p},
|
||||
{bfd_false, MY_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
MY_core_file_failing_command,
|
||||
MY_core_file_failing_signal,
|
||||
MY_core_file_matches_executable_p,
|
||||
MY_slurp_armap,
|
||||
MY_slurp_extended_name_table,
|
||||
MY_truncate_arname,
|
||||
MY_write_armap,
|
||||
MY_close_and_cleanup,
|
||||
MY_set_section_contents,
|
||||
MY_get_section_contents,
|
||||
MY_new_section_hook,
|
||||
MY_get_symtab_upper_bound,
|
||||
MY_get_symtab,
|
||||
MY_get_reloc_upper_bound,
|
||||
MY_canonicalize_reloc,
|
||||
MY_make_empty_symbol,
|
||||
MY_print_symbol,
|
||||
MY_get_lineno,
|
||||
MY_set_arch_mach,
|
||||
MY_openr_next_archived_file,
|
||||
MY_find_nearest_line,
|
||||
MY_generic_stat_arch_elt,
|
||||
MY_sizeof_headers,
|
||||
MY_bfd_debug_info_start,
|
||||
MY_bfd_debug_info_end,
|
||||
MY_bfd_debug_info_accumulate,
|
||||
bfd_generic_get_relocated_section_contents,
|
||||
bfd_generic_relax_section,
|
||||
bfd_generic_seclet_link,
|
||||
MY_reloc_howto_type_lookup,
|
||||
MY_make_debug_symbol,
|
||||
JUMP_TABLE (MY),
|
||||
(PTR) MY_backend_data,
|
||||
};
|
||||
|
@ -122,9 +122,7 @@ nlm_sparc_read_reloc (abfd, sym, secp, rel)
|
||||
asection **secp;
|
||||
arelent *rel;
|
||||
{
|
||||
bfd_byte temp[4];
|
||||
bfd_vma val, addend;
|
||||
const char *name;
|
||||
int index;
|
||||
unsigned int type;
|
||||
struct nlm32_sparc_reloc_ext tmp_reloc;
|
||||
|
572
bfd/nlmcode.h
572
bfd/nlmcode.h
File diff suppressed because it is too large
Load Diff
21
bfd/oasys.c
21
bfd/oasys.c
@ -201,11 +201,12 @@ oasys_slurp_symbol_table (abfd)
|
||||
return true;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
oasys_get_symtab_upper_bound (abfd)
|
||||
bfd *CONST abfd;
|
||||
{
|
||||
oasys_slurp_symbol_table (abfd);
|
||||
if (! oasys_slurp_symbol_table (abfd))
|
||||
return -1;
|
||||
|
||||
return (abfd->symcount + 1) * (sizeof (oasys_symbol_type *));
|
||||
}
|
||||
@ -215,7 +216,7 @@ oasys_get_symtab_upper_bound (abfd)
|
||||
|
||||
extern bfd_target oasys_vec;
|
||||
|
||||
unsigned int
|
||||
long
|
||||
oasys_get_symtab (abfd, location)
|
||||
bfd *abfd;
|
||||
asymbol **location;
|
||||
@ -224,7 +225,7 @@ oasys_get_symtab (abfd, location)
|
||||
unsigned int counter;
|
||||
if (oasys_slurp_symbol_table (abfd) == false)
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
symbase = OASYS_DATA (abfd)->symbols;
|
||||
for (counter = 0; counter < abfd->symcount; counter++)
|
||||
@ -800,12 +801,13 @@ oasys_new_section_hook (abfd, newsect)
|
||||
}
|
||||
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
oasys_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
{
|
||||
oasys_slurp_section_data (abfd);
|
||||
if (! oasys_slurp_section_data (abfd))
|
||||
return -1;
|
||||
return (asect->reloc_count + 1) * sizeof (arelent *);
|
||||
}
|
||||
|
||||
@ -831,7 +833,7 @@ oasys_get_section_contents (abfd, section, location, offset, count)
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
long
|
||||
oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols)
|
||||
bfd *ignore_abfd;
|
||||
sec_ptr section;
|
||||
@ -1435,6 +1437,11 @@ oasys_sizeof_headers (abfd, exec)
|
||||
#define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define oasys_bfd_final_link _bfd_generic_final_link
|
||||
#define oasys_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
|
||||
#define oasys_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
|
||||
#define oasys_bfd_is_local_label bfd_generic_is_local_label
|
||||
|
||||
/*SUPPRESS 460 */
|
||||
bfd_target oasys_vec =
|
||||
|
@ -142,7 +142,7 @@ osf_core_core_file_p (abfd)
|
||||
secname = bfd_alloc (abfd, 40);
|
||||
if (!secname)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
sprintf (secname, ".data%d", dseccnt++);
|
||||
@ -212,13 +212,13 @@ osf_core_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
#define osf_core_get_section_contents bfd_generic_get_section_contents
|
||||
#define osf_core_new_section_hook (boolean (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_true
|
||||
#define osf_core_get_symtab_upper_bound bfd_0u
|
||||
#define osf_core_get_symtab (unsigned int (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define osf_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0u
|
||||
#define osf_core_canonicalize_reloc (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define osf_core_get_symtab_upper_bound bfd_0l
|
||||
#define osf_core_get_symtab (long (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define osf_core_get_reloc_upper_bound (long (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0l
|
||||
#define osf_core_canonicalize_reloc (long (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define osf_core_print_symbol (void (*) PARAMS \
|
||||
((bfd *, PTR, struct symbol_cache_entry *, \
|
||||
bfd_print_symbol_type))) bfd_false
|
||||
@ -252,6 +252,12 @@ osf_core_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define osf_core_bfd_final_link \
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define osf_core_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
|
||||
#define osf_core_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
|
||||
#define osf_core_bfd_is_local_label \
|
||||
((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
static void
|
||||
|
@ -80,7 +80,7 @@ ptrace_unix_core_file_p (abfd)
|
||||
|| u.pt_rev != _BCS_PTRACE_REV)
|
||||
{
|
||||
/* Too small to be a core file */
|
||||
bfd_error = wrong_format;
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ ptrace_unix_core_file_p (abfd)
|
||||
bfd_zalloc (abfd, sizeof (struct trad_core_struct));
|
||||
|
||||
if (rawptr == NULL) {
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -103,10 +103,10 @@ ptrace_unix_core_file_p (abfd)
|
||||
/* Create the sections. This is raunchy, but bfd_close wants to free
|
||||
them separately. */
|
||||
|
||||
core_stacksec(abfd) = (asection *) zalloc (sizeof (asection));
|
||||
core_stacksec(abfd) = (asection *) bfd_zmalloc (sizeof (asection));
|
||||
if (core_stacksec (abfd) == NULL) {
|
||||
loser:
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
free ((void *)rawptr);
|
||||
return 0;
|
||||
}
|
||||
@ -203,17 +203,17 @@ ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
#define ptrace_unix_close_and_cleanup bfd_generic_close_and_cleanup
|
||||
#define ptrace_unix_set_section_contents (boolean (*) PARAMS \
|
||||
((bfd *abfd, asection *section, PTR data, file_ptr offset, \
|
||||
bfd_size_type count))) bfd_false
|
||||
bfd_size_type count))) bfd_generic_set_section_contents
|
||||
#define ptrace_unix_get_section_contents bfd_generic_get_section_contents
|
||||
#define ptrace_unix_new_section_hook (boolean (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_true
|
||||
#define ptrace_unix_get_symtab_upper_bound bfd_0u
|
||||
#define ptrace_unix_get_symtab (unsigned int (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define ptrace_unix_get_reloc_upper_bound (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0u
|
||||
#define ptrace_unix_canonicalize_reloc (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define ptrace_unix_get_symtab_upper_bound bfd_0l
|
||||
#define ptrace_unix_get_symtab (long (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define ptrace_unix_get_reloc_upper_bound (long (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0l
|
||||
#define ptrace_unix_canonicalize_reloc (long (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define ptrace_unix_make_empty_symbol (struct symbol_cache_entry * \
|
||||
(*) PARAMS ((bfd *))) bfd_false
|
||||
#define ptrace_unix_print_symbol (void (*) PARAMS \
|
||||
@ -249,6 +249,12 @@ ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define ptrace_unix_bfd_final_link \
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define ptrace_unix_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
|
||||
#define ptrace_unix_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
|
||||
#define ptrace_unix_bfd_is_local_label \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
void
|
||||
@ -256,9 +262,10 @@ swap_abort()
|
||||
{
|
||||
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
|
||||
}
|
||||
#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
|
||||
#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
|
||||
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
|
||||
#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
|
||||
#define NO_SIGNED_GET \
|
||||
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
||||
|
||||
bfd_target ptrace_core_vec =
|
||||
{
|
||||
|
432
bfd/reloc.c
432
bfd/reloc.c
@ -57,7 +57,7 @@ SUBSECTION
|
||||
|
||||
CODE_FRAGMENT
|
||||
.
|
||||
.typedef enum bfd_reloc_status
|
||||
.typedef enum bfd_reloc_status
|
||||
.{
|
||||
. {* No errors detected *}
|
||||
. bfd_reloc_ok,
|
||||
@ -89,7 +89,7 @@ CODE_FRAGMENT
|
||||
. bfd_reloc_status_type;
|
||||
.
|
||||
.
|
||||
.typedef struct reloc_cache_entry
|
||||
.typedef struct reloc_cache_entry
|
||||
.{
|
||||
. {* A pointer into the canonical table of pointers *}
|
||||
. struct symbol_cache_entry **sym_ptr_ptr;
|
||||
@ -98,7 +98,7 @@ CODE_FRAGMENT
|
||||
. bfd_size_type address;
|
||||
.
|
||||
. {* addend for relocation value *}
|
||||
. bfd_vma addend;
|
||||
. bfd_vma addend;
|
||||
.
|
||||
. {* Pointer to how to perform the required relocation *}
|
||||
. const struct reloc_howto_struct *howto;
|
||||
@ -162,7 +162,7 @@ DESCRIPTION
|
||||
|
||||
|
||||
|RELOCATION RECORDS FOR [.text]:
|
||||
|offset type value
|
||||
|offset type value
|
||||
|00000006 32 _foo
|
||||
|
|
||||
|00000000 4e56 fffc ; linkw fp,#-4
|
||||
@ -187,7 +187,7 @@ DESCRIPTION
|
||||
|
||||
|
||||
|RELOCATION RECORDS FOR [.text]:
|
||||
|offset type value
|
||||
|offset type value
|
||||
|00000002 HVRT16 _foo+0x12340000
|
||||
|00000006 LVRT16 _foo+0x12340000
|
||||
|
|
||||
@ -207,7 +207,7 @@ DESCRIPTION
|
||||
sparc the parts are created in odd sized lumps. The designers of
|
||||
the a.out format chose to not use the data within the section
|
||||
for storing part of the offset; all the offset is kept within
|
||||
the reloc. Anything in the data should be ignored.
|
||||
the reloc. Anything in the data should be ignored.
|
||||
|
||||
| save %sp,-112,%sp
|
||||
| sethi %hi(_foo+0x12345678),%g2
|
||||
@ -220,7 +220,7 @@ DESCRIPTION
|
||||
|
||||
|
||||
|RELOCATION RECORDS FOR [.text]:
|
||||
|offset type value
|
||||
|offset type value
|
||||
|00000004 HI22 _foo+0x12345678
|
||||
|00000008 LO10 _foo+0x12345678
|
||||
|
|
||||
@ -240,7 +240,7 @@ DESCRIPTION
|
||||
would normally have a relocation instruction set and turn
|
||||
relocations into pointers to the correct structure on input -
|
||||
but it would be possible to create each howto field on demand.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -273,7 +273,7 @@ CODE_FRAGMENT
|
||||
*/
|
||||
|
||||
/*
|
||||
SUBSUBSECTION
|
||||
SUBSUBSECTION
|
||||
<<reloc_howto_type>>
|
||||
|
||||
The <<reloc_howto_type>> is a structure which contains all the
|
||||
@ -282,8 +282,8 @@ SUBSUBSECTION
|
||||
CODE_FRAGMENT
|
||||
.struct symbol_cache_entry; {* Forward declaration *}
|
||||
.
|
||||
.typedef struct reloc_howto_struct
|
||||
.{
|
||||
.typedef struct reloc_howto_struct
|
||||
.{
|
||||
. {* The type field has mainly a documetary use - the back end can
|
||||
. do what it wants with it, though normally the back end's
|
||||
. external idea of what a reloc number is stored
|
||||
@ -323,12 +323,12 @@ CODE_FRAGMENT
|
||||
. called rather than the normal function. This allows really
|
||||
. strange relocation methods to be accomodated (e.g., i960 callj
|
||||
. instructions). *}
|
||||
. bfd_reloc_status_type (*special_function)
|
||||
. bfd_reloc_status_type (*special_function)
|
||||
. PARAMS ((bfd *abfd,
|
||||
. arelent *reloc_entry,
|
||||
. struct symbol_cache_entry *symbol,
|
||||
. PTR data,
|
||||
. asection *input_section,
|
||||
. asection *input_section,
|
||||
. bfd *output_bfd,
|
||||
. char **error_message));
|
||||
.
|
||||
@ -352,7 +352,7 @@ CODE_FRAGMENT
|
||||
. into the instruction. In most cases src_mask == dst_mask,
|
||||
. except in the above special case, where dst_mask would be
|
||||
. 0x000000ff, and src_mask would be 0x00000000. *}
|
||||
. bfd_vma dst_mask;
|
||||
. bfd_vma dst_mask;
|
||||
.
|
||||
. {* When some formats create PC relative instructions, they leave
|
||||
. the value of the pc of the place being relocated in the offset
|
||||
@ -397,7 +397,7 @@ DESCRIPTION
|
||||
. relocation = symbol->value; \
|
||||
. } \
|
||||
. } \
|
||||
.}
|
||||
.}
|
||||
|
||||
*/
|
||||
|
||||
@ -417,15 +417,16 @@ int
|
||||
bfd_get_reloc_size (howto)
|
||||
const reloc_howto_type *howto;
|
||||
{
|
||||
switch (howto->size) {
|
||||
case 0: return 1;
|
||||
case 1: return 2;
|
||||
case 2: return 4;
|
||||
case 3: return 0;
|
||||
case 4: return 8;
|
||||
case -2: return 4;
|
||||
default: abort ();
|
||||
}
|
||||
switch (howto->size)
|
||||
{
|
||||
case 0: return 1;
|
||||
case 1: return 2;
|
||||
case 2: return 4;
|
||||
case 3: return 0;
|
||||
case 4: return 8;
|
||||
case -2: return 4;
|
||||
default: abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -448,7 +449,7 @@ DESCRIPTION
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
FUNCTION
|
||||
bfd_perform_relocation
|
||||
|
||||
SYNOPSIS
|
||||
@ -492,15 +493,15 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
|
||||
{
|
||||
bfd_vma relocation;
|
||||
bfd_reloc_status_type flag = bfd_reloc_ok;
|
||||
bfd_size_type addr = reloc_entry->address ;
|
||||
bfd_size_type addr = reloc_entry->address;
|
||||
bfd_vma output_base = 0;
|
||||
const reloc_howto_type *howto = reloc_entry->howto;
|
||||
asection *reloc_target_output_section;
|
||||
asymbol *symbol;
|
||||
|
||||
symbol = *(reloc_entry->sym_ptr_ptr);
|
||||
if ((symbol->section == &bfd_abs_section)
|
||||
&& output_bfd != (bfd *)NULL)
|
||||
if ((symbol->section == &bfd_abs_section)
|
||||
&& output_bfd != (bfd *) NULL)
|
||||
{
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
@ -544,7 +545,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
|
||||
reloc_target_output_section = symbol->section->output_section;
|
||||
|
||||
/* Convert input-section-relative symbol value to absolute. */
|
||||
if (output_bfd && howto->partial_inplace==false)
|
||||
if (output_bfd && howto->partial_inplace == false)
|
||||
output_base = 0;
|
||||
else
|
||||
output_base = reloc_target_output_section->vma;
|
||||
@ -587,28 +588,28 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
|
||||
actually does. I don't want to change it, because it seems
|
||||
far too likely that something will break. */
|
||||
|
||||
relocation -=
|
||||
relocation -=
|
||||
input_section->output_section->vma + input_section->output_offset;
|
||||
|
||||
if (howto->pcrel_offset == true)
|
||||
relocation -= reloc_entry->address;
|
||||
}
|
||||
|
||||
if (output_bfd!= (bfd *)NULL)
|
||||
if (output_bfd != (bfd *) NULL)
|
||||
{
|
||||
if ( howto->partial_inplace == false)
|
||||
if (howto->partial_inplace == false)
|
||||
{
|
||||
/* This is a partial relocation, and we want to apply the relocation
|
||||
to the reloc entry rather than the raw data. Modify the reloc
|
||||
inplace to reflect what we now know. */
|
||||
reloc_entry->addend = relocation;
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a partial relocation, but inplace, so modify the
|
||||
reloc record a bit.
|
||||
reloc record a bit.
|
||||
|
||||
If we've relocated with a symbol with a section, change
|
||||
into a ref to the section belonging to the symbol. */
|
||||
@ -699,7 +700,7 @@ space consuming. For each target:
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
reloc_entry->addend = 0;
|
||||
}
|
||||
@ -727,14 +728,14 @@ space consuming. For each target:
|
||||
{
|
||||
/* Assumes two's complement. */
|
||||
bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
|
||||
bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
|
||||
bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
|
||||
|
||||
/* The above right shift is incorrect for a signed value.
|
||||
Fix it up by forcing on the upper bits. */
|
||||
if (howto->rightshift > howto->bitpos
|
||||
&& (bfd_signed_vma) relocation < 0)
|
||||
check |= ((bfd_vma) -1
|
||||
&~ ((bfd_vma) -1
|
||||
check |= ((bfd_vma) - 1
|
||||
& ~((bfd_vma) - 1
|
||||
>> (howto->rightshift - howto->bitpos)));
|
||||
if ((bfd_signed_vma) check > reloc_signed_max
|
||||
|| (bfd_signed_vma) check < reloc_signed_min)
|
||||
@ -747,7 +748,7 @@ space consuming. For each target:
|
||||
overflow if howto->bitsize is the number of bits in
|
||||
bfd_vma. */
|
||||
bfd_vma reloc_unsigned_max =
|
||||
(((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
|
||||
(((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
|
||||
|
||||
if ((bfd_vma) check > reloc_unsigned_max)
|
||||
flag = bfd_reloc_overflow;
|
||||
@ -760,8 +761,8 @@ space consuming. For each target:
|
||||
bfd_vma. */
|
||||
bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
|
||||
|
||||
if (((bfd_vma) check &~ reloc_bits) != 0
|
||||
&& ((bfd_vma) check &~ reloc_bits) != (-1 &~ reloc_bits))
|
||||
if (((bfd_vma) check & ~reloc_bits) != 0
|
||||
&& ((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits))
|
||||
{
|
||||
/* The above right shift is incorrect for a signed
|
||||
value. See if turning on the upper bits fixes the
|
||||
@ -769,10 +770,10 @@ space consuming. For each target:
|
||||
if (howto->rightshift > howto->bitpos
|
||||
&& (bfd_signed_vma) relocation < 0)
|
||||
{
|
||||
check |= ((bfd_vma) -1
|
||||
&~ ((bfd_vma) -1
|
||||
check |= ((bfd_vma) - 1
|
||||
& ~((bfd_vma) - 1
|
||||
>> (howto->rightshift - howto->bitpos)));
|
||||
if (((bfd_vma) check &~ reloc_bits) != (-1 &~ reloc_bits))
|
||||
if (((bfd_vma) check & ~reloc_bits) != (-1 & ~reloc_bits))
|
||||
flag = bfd_reloc_overflow;
|
||||
}
|
||||
else
|
||||
@ -784,8 +785,8 @@ space consuming. For each target:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
Either we are relocating all the way, or we don't want to apply
|
||||
the relocation to the reloc entry (probably because there isn't
|
||||
any room in the output format to describe addends to relocs)
|
||||
@ -817,7 +818,7 @@ space consuming. For each target:
|
||||
relocation >>= (bfd_vma) howto->rightshift;
|
||||
|
||||
/* Shift everything up to where it's going to be used */
|
||||
|
||||
|
||||
relocation <<= (bfd_vma) howto->bitpos;
|
||||
|
||||
/* Wait for the day when all have the mask in them */
|
||||
@ -832,23 +833,23 @@ space consuming. For each target:
|
||||
A part 1
|
||||
B part 2
|
||||
R result
|
||||
|
||||
|
||||
Do this:
|
||||
i i i i i o o o o o from bfd_get<size>
|
||||
and S S S S S to get the size offset we want
|
||||
+ r r r r r r r r r r to get the final value to place
|
||||
and D D D D D to chop to right size
|
||||
-----------------------
|
||||
A A A A A
|
||||
A A A A A
|
||||
And this:
|
||||
... i i i i i o o o o o from bfd_get<size>
|
||||
and N N N N N get instruction
|
||||
-----------------------
|
||||
... B B B B B
|
||||
|
||||
And then:
|
||||
B B B B B
|
||||
or A A A A A
|
||||
|
||||
And then:
|
||||
B B B B B
|
||||
or A A A A A
|
||||
-----------------------
|
||||
R R R R R R R R R R put into bfd_put<size>
|
||||
*/
|
||||
@ -856,60 +857,60 @@ space consuming. For each target:
|
||||
#define DOIT(x) \
|
||||
x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask))
|
||||
|
||||
switch (howto->size)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
char x = bfd_get_8(abfd, (char *)data + addr);
|
||||
DOIT(x);
|
||||
bfd_put_8(abfd,x, (unsigned char *) data + addr);
|
||||
}
|
||||
break;
|
||||
switch (howto->size)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
char x = bfd_get_8 (abfd, (char *) data + addr);
|
||||
DOIT (x);
|
||||
bfd_put_8 (abfd, x, (unsigned char *) data + addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (relocation)
|
||||
{
|
||||
short x = bfd_get_16(abfd, (bfd_byte *)data + addr);
|
||||
DOIT(x);
|
||||
bfd_put_16(abfd, x, (unsigned char *)data + addr);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (relocation)
|
||||
{
|
||||
long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
|
||||
DOIT (x);
|
||||
bfd_put_32 (abfd, x, (bfd_byte *)data + addr);
|
||||
}
|
||||
break;
|
||||
case -2:
|
||||
{
|
||||
long x = bfd_get_32(abfd, (bfd_byte *) data + addr);
|
||||
relocation = -relocation;
|
||||
DOIT(x);
|
||||
bfd_put_32(abfd,x, (bfd_byte *)data + addr);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (relocation)
|
||||
{
|
||||
short x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
|
||||
DOIT (x);
|
||||
bfd_put_16 (abfd, x, (unsigned char *) data + addr);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (relocation)
|
||||
{
|
||||
long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
|
||||
DOIT (x);
|
||||
bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
|
||||
}
|
||||
break;
|
||||
case -2:
|
||||
{
|
||||
long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
|
||||
relocation = -relocation;
|
||||
DOIT (x);
|
||||
bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* Do nothing */
|
||||
break;
|
||||
case 3:
|
||||
/* Do nothing */
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 4:
|
||||
#ifdef BFD64
|
||||
if (relocation)
|
||||
{
|
||||
bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr);
|
||||
DOIT (x);
|
||||
bfd_put_64 (abfd, x, (bfd_byte *) data + addr);
|
||||
}
|
||||
if (relocation)
|
||||
{
|
||||
bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr);
|
||||
DOIT (x);
|
||||
bfd_put_64 (abfd, x, (bfd_byte *) data + addr);
|
||||
}
|
||||
#else
|
||||
abort ();
|
||||
abort ();
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return bfd_reloc_other;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return bfd_reloc_other;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
@ -937,7 +938,7 @@ space consuming. For each target:
|
||||
|
||||
bfd_reloc_status_type
|
||||
_bfd_final_link_relocate (howto, input_bfd, input_section, contents, address,
|
||||
value, addend)
|
||||
value, addend)
|
||||
const reloc_howto_type *howto;
|
||||
bfd *input_bfd;
|
||||
asection *input_section;
|
||||
@ -975,7 +976,7 @@ _bfd_final_link_relocate (howto, input_bfd, input_section, contents, address,
|
||||
if (howto->pcrel_offset)
|
||||
relocation -= address;
|
||||
}
|
||||
|
||||
|
||||
return _bfd_relocate_contents (howto, input_bfd, relocation,
|
||||
contents + address);
|
||||
}
|
||||
@ -996,7 +997,7 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
/* If the size is negative, negate RELOCATION. This isn't very
|
||||
general. */
|
||||
if (howto->size < 0)
|
||||
relocation = - relocation;
|
||||
relocation = -relocation;
|
||||
|
||||
/* Get the value we are going to relocate. */
|
||||
size = bfd_get_reloc_size (howto);
|
||||
@ -1051,8 +1052,8 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
signed_check = check;
|
||||
else
|
||||
signed_check = (check
|
||||
| ((bfd_vma) -1
|
||||
&~ ((bfd_vma) -1 >> howto->rightshift)));
|
||||
| ((bfd_vma) - 1
|
||||
& ~((bfd_vma) - 1 >> howto->rightshift)));
|
||||
}
|
||||
|
||||
/* Get the value from the object file. */
|
||||
@ -1067,8 +1068,8 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
signed_add needs no adjustment to become negative in that
|
||||
case. */
|
||||
signed_add = add;
|
||||
if ((add & (((~ howto->src_mask) >> 1) & howto->src_mask)) != 0)
|
||||
signed_add -= (((~ howto->src_mask) >> 1) & howto->src_mask) << 1;
|
||||
if ((add & (((~howto->src_mask) >> 1) & howto->src_mask)) != 0)
|
||||
signed_add -= (((~howto->src_mask) >> 1) & howto->src_mask) << 1;
|
||||
|
||||
/* Add the value from the object file, shifted so that it is a
|
||||
straight number. */
|
||||
@ -1088,8 +1089,8 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
signed_check += add >> howto->bitpos;
|
||||
else
|
||||
signed_check += ((add >> howto->bitpos)
|
||||
| ((bfd_vma) -1
|
||||
&~ ((bfd_vma) -1 >> howto->bitpos)));
|
||||
| ((bfd_vma) - 1
|
||||
& ~((bfd_vma) - 1 >> howto->bitpos)));
|
||||
}
|
||||
|
||||
switch (howto->complain_on_overflow)
|
||||
@ -1098,7 +1099,7 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
{
|
||||
/* Assumes two's complement. */
|
||||
bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
|
||||
bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
|
||||
bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
|
||||
|
||||
if (signed_check > reloc_signed_max
|
||||
|| signed_check < reloc_signed_min)
|
||||
@ -1111,7 +1112,7 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
overflow if howto->bitsize is the number of bits in
|
||||
bfd_vma. */
|
||||
bfd_vma reloc_unsigned_max =
|
||||
(((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
|
||||
(((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
|
||||
|
||||
if (check > reloc_unsigned_max)
|
||||
overflow = true;
|
||||
@ -1124,9 +1125,9 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
bfd_vma. */
|
||||
bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
|
||||
|
||||
if ((check &~ reloc_bits) != 0
|
||||
&& (((bfd_vma) signed_check &~ reloc_bits)
|
||||
!= (-1 &~ reloc_bits)))
|
||||
if ((check & ~reloc_bits) != 0
|
||||
&& (((bfd_vma) signed_check & ~reloc_bits)
|
||||
!= (-1 & ~reloc_bits)))
|
||||
overflow = true;
|
||||
}
|
||||
break;
|
||||
@ -1140,7 +1141,7 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
|
||||
relocation <<= (bfd_vma) howto->bitpos;
|
||||
|
||||
/* Add RELOCATION to the right bits of X. */
|
||||
x = ((x &~ howto->dst_mask)
|
||||
x = ((x & ~howto->dst_mask)
|
||||
| (((x & howto->src_mask) + relocation) & howto->dst_mask));
|
||||
|
||||
/* Put the relocated value back in the object file. */
|
||||
@ -1176,7 +1177,7 @@ INODE
|
||||
howto manager, , typedef arelent, Relocations
|
||||
|
||||
SECTION
|
||||
The howto manager
|
||||
The howto manager
|
||||
|
||||
When an application wants to create a relocation, but doesn't
|
||||
know what the target machine might call it, it can find out by
|
||||
@ -1200,12 +1201,12 @@ DESCRIPTION
|
||||
|
||||
CODE_FRAGMENT
|
||||
.
|
||||
.typedef enum bfd_reloc_code_real
|
||||
.typedef enum bfd_reloc_code_real
|
||||
.{
|
||||
. {* Basic absolute relocations *}
|
||||
. BFD_RELOC_64,
|
||||
. BFD_RELOC_32,
|
||||
. BFD_RELOC_16,
|
||||
. BFD_RELOC_16,
|
||||
. BFD_RELOC_14,
|
||||
. BFD_RELOC_8,
|
||||
.
|
||||
@ -1494,15 +1495,15 @@ DESCRIPTION
|
||||
|
||||
|
||||
const struct reloc_howto_struct *
|
||||
DEFUN(bfd_reloc_type_lookup,(abfd, code),
|
||||
bfd *abfd AND
|
||||
bfd_reloc_code_real_type code)
|
||||
bfd_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
|
||||
}
|
||||
|
||||
static reloc_howto_type bfd_howto_32 =
|
||||
HOWTO(0, 00,2,32,false,0,complain_overflow_bitfield,0,"VRT32", false,0xffffffff,0xffffffff,true);
|
||||
HOWTO (0, 00, 2, 32, false, 0, complain_overflow_bitfield, 0, "VRT32", false, 0xffffffff, 0xffffffff, true);
|
||||
|
||||
|
||||
/*
|
||||
@ -1511,8 +1512,7 @@ INTERNAL_FUNCTION
|
||||
|
||||
SYNOPSIS
|
||||
const struct reloc_howto_struct *bfd_default_reloc_type_lookup
|
||||
(bfd *abfd AND
|
||||
bfd_reloc_code_real_type code);
|
||||
(bfd *abfd, bfd_reloc_code_real_type code);
|
||||
|
||||
DESCRIPTION
|
||||
Provides a default relocation lookup routine for any architecture.
|
||||
@ -1521,29 +1521,30 @@ DESCRIPTION
|
||||
*/
|
||||
|
||||
const struct reloc_howto_struct *
|
||||
DEFUN(bfd_default_reloc_type_lookup, (abfd, code),
|
||||
bfd *abfd AND
|
||||
bfd_reloc_code_real_type code)
|
||||
bfd_default_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_CTOR:
|
||||
/* The type of reloc used in a ctor, which will be as wide as the
|
||||
address - so either a 64, 32, or 16 bitter. */
|
||||
switch (bfd_get_arch_info (abfd)->bits_per_address) {
|
||||
case 64:
|
||||
BFD_FAIL();
|
||||
case 32:
|
||||
return &bfd_howto_32;
|
||||
case 16:
|
||||
BFD_FAIL();
|
||||
default:
|
||||
BFD_FAIL();
|
||||
}
|
||||
switch (bfd_get_arch_info (abfd)->bits_per_address)
|
||||
{
|
||||
case 64:
|
||||
BFD_FAIL ();
|
||||
case 32:
|
||||
return &bfd_howto_32;
|
||||
case 16:
|
||||
BFD_FAIL ();
|
||||
default:
|
||||
BFD_FAIL ();
|
||||
}
|
||||
default:
|
||||
BFD_FAIL();
|
||||
BFD_FAIL ();
|
||||
}
|
||||
return (const struct reloc_howto_struct *)NULL;
|
||||
return (const struct reloc_howto_struct *) NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -1556,7 +1557,7 @@ SYNOPSIS
|
||||
(bfd *abfd,
|
||||
asection *section,
|
||||
struct bfd_link_info *,
|
||||
asymbol **symbols);
|
||||
boolean *);
|
||||
|
||||
DESCRIPTION
|
||||
Provides default handling for relaxing for back ends which
|
||||
@ -1565,15 +1566,16 @@ DESCRIPTION
|
||||
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
bfd_generic_relax_section (abfd, section, link_info, symbols)
|
||||
bfd_generic_relax_section (abfd, section, link_info, again)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
struct bfd_link_info *link_info;
|
||||
asymbol **symbols;
|
||||
boolean *again;
|
||||
{
|
||||
return false;
|
||||
*again = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_generic_get_relocated_section_contents
|
||||
@ -1607,95 +1609,101 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data,
|
||||
bfd *input_bfd = link_order->u.indirect.section->owner;
|
||||
asection *input_section = link_order->u.indirect.section;
|
||||
|
||||
size_t reloc_size = bfd_get_reloc_upper_bound(input_bfd, input_section);
|
||||
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
|
||||
arelent **reloc_vector = NULL;
|
||||
long reloc_count;
|
||||
|
||||
if (reloc_size < 0)
|
||||
goto error_return;
|
||||
|
||||
reloc_vector = (arelent **) malloc (reloc_size);
|
||||
if (reloc_vector == NULL)
|
||||
if (reloc_vector == NULL && reloc_size != 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
|
||||
/* read in the section */
|
||||
if (!bfd_get_section_contents(input_bfd,
|
||||
input_section,
|
||||
(PTR) data,
|
||||
0,
|
||||
input_section->_raw_size))
|
||||
if (!bfd_get_section_contents (input_bfd,
|
||||
input_section,
|
||||
(PTR) data,
|
||||
0,
|
||||
input_section->_raw_size))
|
||||
goto error_return;
|
||||
|
||||
/* We're not relaxing the section, so just copy the size info */
|
||||
input_section->_cooked_size = input_section->_raw_size;
|
||||
input_section->reloc_done = true;
|
||||
|
||||
if (!bfd_canonicalize_reloc (input_bfd,
|
||||
input_section,
|
||||
reloc_vector,
|
||||
symbols))
|
||||
reloc_count = bfd_canonicalize_reloc (input_bfd,
|
||||
input_section,
|
||||
reloc_vector,
|
||||
symbols);
|
||||
if (reloc_count < 0)
|
||||
goto error_return;
|
||||
|
||||
{
|
||||
arelent **parent;
|
||||
for (parent = reloc_vector; * parent != (arelent *)NULL;
|
||||
parent++)
|
||||
{
|
||||
char *error_message = (char *) NULL;
|
||||
bfd_reloc_status_type r=
|
||||
bfd_perform_relocation(input_bfd,
|
||||
*parent,
|
||||
(PTR) data,
|
||||
input_section,
|
||||
relocateable ? abfd : (bfd *) NULL,
|
||||
&error_message);
|
||||
|
||||
if (relocateable)
|
||||
if (reloc_count > 0)
|
||||
{
|
||||
arelent **parent;
|
||||
for (parent = reloc_vector; *parent != (arelent *) NULL;
|
||||
parent++)
|
||||
{
|
||||
asection *os = input_section->output_section;
|
||||
char *error_message = (char *) NULL;
|
||||
bfd_reloc_status_type r =
|
||||
bfd_perform_relocation (input_bfd,
|
||||
*parent,
|
||||
(PTR) data,
|
||||
input_section,
|
||||
relocateable ? abfd : (bfd *) NULL,
|
||||
&error_message);
|
||||
|
||||
/* A partial link, so keep the relocs */
|
||||
os->orelocation[os->reloc_count] = *parent;
|
||||
os->reloc_count++;
|
||||
if (relocateable)
|
||||
{
|
||||
asection *os = input_section->output_section;
|
||||
|
||||
/* A partial link, so keep the relocs */
|
||||
os->orelocation[os->reloc_count] = *parent;
|
||||
os->reloc_count++;
|
||||
}
|
||||
|
||||
if (r != bfd_reloc_ok)
|
||||
{
|
||||
switch (r)
|
||||
{
|
||||
case bfd_reloc_undefined:
|
||||
if (!((*link_info->callbacks->undefined_symbol)
|
||||
(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
|
||||
input_bfd, input_section, (*parent)->address)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_dangerous:
|
||||
BFD_ASSERT (error_message != (char *) NULL);
|
||||
if (!((*link_info->callbacks->reloc_dangerous)
|
||||
(link_info, error_message, input_bfd, input_section,
|
||||
(*parent)->address)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_overflow:
|
||||
if (!((*link_info->callbacks->reloc_overflow)
|
||||
(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
|
||||
(*parent)->howto->name, (*parent)->addend,
|
||||
input_bfd, input_section, (*parent)->address)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_outofrange:
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (r != bfd_reloc_ok)
|
||||
{
|
||||
switch (r)
|
||||
{
|
||||
case bfd_reloc_undefined:
|
||||
if (! ((*link_info->callbacks->undefined_symbol)
|
||||
(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
|
||||
input_bfd, input_section, (*parent)->address)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_dangerous:
|
||||
BFD_ASSERT (error_message != (char *) NULL);
|
||||
if (! ((*link_info->callbacks->reloc_dangerous)
|
||||
(link_info, error_message, input_bfd, input_section,
|
||||
(*parent)->address)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_overflow:
|
||||
if (! ((*link_info->callbacks->reloc_overflow)
|
||||
(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
|
||||
(*parent)->howto->name, (*parent)->addend,
|
||||
input_bfd, input_section, (*parent)->address)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_outofrange:
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reloc_vector != NULL)
|
||||
free (reloc_vector);
|
||||
return data;
|
||||
|
||||
error_return:
|
||||
error_return:
|
||||
if (reloc_vector != NULL)
|
||||
free (reloc_vector);
|
||||
return NULL;
|
||||
|
34
bfd/som.c
34
bfd/som.c
@ -138,16 +138,16 @@ static bfd_target * som_object_p PARAMS ((bfd *));
|
||||
static boolean som_write_object_contents PARAMS ((bfd *));
|
||||
static boolean som_slurp_string_table PARAMS ((bfd *));
|
||||
static unsigned int som_slurp_symbol_table PARAMS ((bfd *));
|
||||
static unsigned int som_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
static unsigned int som_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
|
||||
arelent **, asymbol **));
|
||||
static unsigned int som_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
static long som_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
static long som_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
|
||||
arelent **, asymbol **));
|
||||
static long som_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
static unsigned int som_set_reloc_info PARAMS ((unsigned char *, unsigned int,
|
||||
arelent *, asection *,
|
||||
asymbol **, boolean));
|
||||
static boolean som_slurp_reloc_table PARAMS ((bfd *, asection *,
|
||||
asymbol **, boolean));
|
||||
static unsigned int som_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
static long som_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
static asymbol * som_make_empty_symbol PARAMS ((bfd *));
|
||||
static void som_print_symbol PARAMS ((bfd *, PTR,
|
||||
asymbol *, bfd_print_symbol_type));
|
||||
@ -3544,12 +3544,12 @@ som_slurp_string_table (abfd)
|
||||
/* Return the amount of data (in bytes) required to hold the symbol
|
||||
table for this object. */
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
som_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (!som_slurp_symbol_table (abfd))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *));
|
||||
}
|
||||
@ -3774,7 +3774,7 @@ som_slurp_symbol_table (abfd)
|
||||
/* Canonicalize a SOM symbol table. Return the number of entries
|
||||
in the symbol table. */
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
som_get_symtab (abfd, location)
|
||||
bfd *abfd;
|
||||
asymbol **location;
|
||||
@ -3783,7 +3783,7 @@ som_get_symtab (abfd, location)
|
||||
som_symbol_type *symbase;
|
||||
|
||||
if (!som_slurp_symbol_table (abfd))
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
i = bfd_get_symcount (abfd);
|
||||
symbase = obj_som_symtab (abfd);
|
||||
@ -4169,7 +4169,7 @@ som_slurp_reloc_table (abfd, section, symbols, just_count)
|
||||
/* Return the number of bytes required to store the relocation
|
||||
information associated with the given section. */
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
som_get_reloc_upper_bound (abfd, asect)
|
||||
bfd *abfd;
|
||||
sec_ptr asect;
|
||||
@ -4178,18 +4178,18 @@ som_get_reloc_upper_bound (abfd, asect)
|
||||
and parse it to determine how many relocations exist. */
|
||||
if (asect->flags & SEC_RELOC)
|
||||
{
|
||||
if (som_slurp_reloc_table (abfd, asect, NULL, true))
|
||||
return (asect->reloc_count + 1) * sizeof (arelent);
|
||||
if (! som_slurp_reloc_table (abfd, asect, NULL, true))
|
||||
return false;
|
||||
return (asect->reloc_count + 1) * sizeof (arelent);
|
||||
}
|
||||
/* Either there are no relocations or an error occurred while
|
||||
reading and parsing the relocation stream. */
|
||||
/* There are no relocations. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Convert relocations from SOM (external) form into BFD internal
|
||||
form. Return the number of relocations. */
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
som_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
@ -4200,12 +4200,12 @@ som_canonicalize_reloc (abfd, section, relptr, symbols)
|
||||
int count;
|
||||
|
||||
if (som_slurp_reloc_table (abfd, section, symbols, false) == false)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
count = section->reloc_count;
|
||||
tblptr = section->relocation;
|
||||
if (tblptr == (arelent *) NULL)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
while (count--)
|
||||
*relptr++ = tblptr++;
|
||||
|
17
bfd/srec.c
17
bfd/srec.c
@ -859,16 +859,17 @@ srec_make_empty_symbol (abfd)
|
||||
return new;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
srec_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
/* Read in all the info */
|
||||
srec_get_section_contents (abfd, abfd->sections, 0, 0, 0);
|
||||
if (! srec_get_section_contents (abfd, abfd->sections, 0, 0, 0))
|
||||
return -1;
|
||||
return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
srec_get_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
@ -919,8 +920,8 @@ srec_print_symbol (ignore_abfd, afile, symbol, how)
|
||||
#define FOO PROTO
|
||||
#define srec_new_section_hook (FOO(boolean, (*), (bfd *, asection *)))bfd_true
|
||||
|
||||
#define srec_get_reloc_upper_bound (FOO(unsigned int, (*),(bfd*, asection *)))bfd_false
|
||||
#define srec_canonicalize_reloc (FOO(unsigned int, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0
|
||||
#define srec_get_reloc_upper_bound (FOO(long, (*),(bfd*, asection *)))bfd_0l
|
||||
#define srec_canonicalize_reloc (FOO(long, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0l
|
||||
|
||||
|
||||
|
||||
@ -951,6 +952,12 @@ srec_print_symbol (ignore_abfd, afile, symbol, how)
|
||||
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define srec_bfd_final_link _bfd_generic_final_link
|
||||
|
||||
#define srec_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
|
||||
#define srec_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
|
||||
#define srec_bfd_is_local_label bfd_generic_is_local_label
|
||||
|
||||
bfd_target srec_vec =
|
||||
{
|
||||
"srec", /* name */
|
||||
|
@ -275,12 +275,12 @@ Standard stuff.
|
||||
|
||||
Symbols and relocations.
|
||||
|
||||
. unsigned int (*_get_symtab_upper_bound) PARAMS ((bfd *));
|
||||
. unsigned int (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
||||
. struct symbol_cache_entry **));
|
||||
. unsigned int (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
||||
. unsigned int (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
|
||||
. struct symbol_cache_entry **));
|
||||
. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
|
||||
. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
||||
. struct symbol_cache_entry **));
|
||||
. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
||||
. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
|
||||
. struct symbol_cache_entry **));
|
||||
. struct symbol_cache_entry *
|
||||
. (*_bfd_make_empty_symbol) PARAMS ((bfd *));
|
||||
. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
|
||||
|
27
bfd/tekhex.c
27
bfd/tekhex.c
@ -358,7 +358,7 @@ find_chunk (abfd, vma)
|
||||
|
||||
if (!sname || !d)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ first_phase (abfd, type, src)
|
||||
|
||||
if (!n)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
abort(); /* FIXME */
|
||||
}
|
||||
memcpy (n, sym, len + 1);
|
||||
@ -456,7 +456,7 @@ first_phase (abfd, type, src)
|
||||
|
||||
if (!new)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
abort(); /* FIXME */
|
||||
}
|
||||
new->symbol.the_bfd = abfd;
|
||||
@ -469,7 +469,7 @@ first_phase (abfd, type, src)
|
||||
new->symbol.name = bfd_alloc (abfd, len + 1);
|
||||
if (!new->symbol.name)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
abort(); /* FIXME */
|
||||
}
|
||||
memcpy ((char *) (new->symbol.name), sym, len + 1);
|
||||
@ -533,7 +533,7 @@ static void
|
||||
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
tekhex_get_symtab (abfd, table)
|
||||
bfd *abfd;
|
||||
asymbol **table;
|
||||
@ -552,7 +552,7 @@ tekhex_get_symtab (abfd, table)
|
||||
return bfd_get_symcount (abfd);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
long
|
||||
tekhex_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
@ -568,7 +568,7 @@ tekhex_mkobject (abfd)
|
||||
|
||||
if (!tdata)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
abfd->tdata.tekhex_data = tdata;
|
||||
@ -913,7 +913,7 @@ tekhex_write_object_contents (abfd)
|
||||
break;
|
||||
case 'C':
|
||||
case 'U':
|
||||
bfd_error = wrong_format;
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ tekhex_make_empty_symbol (abfd)
|
||||
|
||||
if (!new)
|
||||
{
|
||||
bfd_error = no_memory;
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return NULL;
|
||||
}
|
||||
new->symbol.the_bfd = abfd;
|
||||
@ -995,8 +995,8 @@ tekhex_print_symbol (ignore_abfd, filep, symbol, how)
|
||||
|
||||
#define FOO PROTO
|
||||
#define tekhex_new_section_hook (FOO(boolean, (*), (bfd *, asection *)))bfd_true
|
||||
#define tekhex_get_reloc_upper_bound (FOO(unsigned int, (*),(bfd*, asection *)))bfd_false
|
||||
#define tekhex_canonicalize_reloc (FOO(unsigned int, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0
|
||||
#define tekhex_get_reloc_upper_bound (FOO(long, (*),(bfd*, asection *)))bfd_0l
|
||||
#define tekhex_canonicalize_reloc (FOO(long, (*),(bfd*,asection *, arelent **, asymbol **))) bfd_0l
|
||||
|
||||
#define tekhex_openr_next_archived_file (FOO(bfd *, (*), (bfd*,bfd*))) bfd_nullvoidptr
|
||||
#define tekhex_find_nearest_line (FOO(boolean, (*),(bfd*,asection*,asymbol**,bfd_vma, CONST char**, CONST char**, unsigned int *))) bfd_false
|
||||
@ -1023,6 +1023,11 @@ tekhex_print_symbol (ignore_abfd, filep, symbol, how)
|
||||
#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define tekhex_bfd_final_link _bfd_generic_final_link
|
||||
#define tekhex_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
|
||||
#define tekhex_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
|
||||
#define tekhex_bfd_is_local_label bfd_generic_is_local_label
|
||||
|
||||
bfd_target tekhex_vec =
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ trad_unix_core_file_p (abfd)
|
||||
/* Allocate both the upage and the struct core_data at once, so
|
||||
a single free() will free them both. */
|
||||
rawptr = (struct trad_core_struct *)
|
||||
bfd_zmalloc (abfd, sizeof (struct trad_core_struct));
|
||||
bfd_zmalloc (sizeof (struct trad_core_struct));
|
||||
if (rawptr == NULL) {
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return 0;
|
||||
@ -297,13 +297,13 @@ trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
#define trad_unix_get_section_contents bfd_generic_get_section_contents
|
||||
#define trad_unix_new_section_hook (boolean (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_true
|
||||
#define trad_unix_get_symtab_upper_bound bfd_0u
|
||||
#define trad_unix_get_symtab (unsigned int (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0u
|
||||
#define trad_unix_get_reloc_upper_bound (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0u
|
||||
#define trad_unix_canonicalize_reloc (unsigned int (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
|
||||
#define trad_unix_get_symtab_upper_bound bfd_0l
|
||||
#define trad_unix_get_symtab (long (*) PARAMS \
|
||||
((bfd *, struct symbol_cache_entry **))) bfd_0l
|
||||
#define trad_unix_get_reloc_upper_bound (long (*) PARAMS \
|
||||
((bfd *, sec_ptr))) bfd_0l
|
||||
#define trad_unix_canonicalize_reloc (long (*) PARAMS \
|
||||
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
|
||||
#define trad_unix_make_empty_symbol (struct symbol_cache_entry * \
|
||||
(*) PARAMS ((bfd *))) bfd_false
|
||||
#define trad_unix_print_symbol (void (*) PARAMS \
|
||||
|
Loading…
Reference in New Issue
Block a user