diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-03-09 20:14:04 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-03-09 20:14:04 +0000 |
commit | 2f6754271fb72b83ce24ea3c66e4236dee7abb2c (patch) | |
tree | 7bcceac365c785c5b3b66d66cf951b402c348627 /bfd/aoutx.h | |
parent | d5fb1e2a71f0f86929e7bfb1959cafd9f3c4575a (diff) | |
download | gdb-2f6754271fb72b83ce24ea3c66e4236dee7abb2c.zip gdb-2f6754271fb72b83ce24ea3c66e4236dee7abb2c.tar.gz gdb-2f6754271fb72b83ce24ea3c66e4236dee7abb2c.tar.bz2 |
* aoutx.h (NAME(aout,swap_ext_reloc_in)): Add symcount parameter,
and use it instead of bfd_get_symcount. Check r_index after
setting r_extern based on whether this is a base relative reloc.
(NAME(aout,swap_std_reloc_IN)): Add symcount parameter, and use it
instead of bfd_get_symcount.
(NAME(aout,slurp_reloc_table)): Pass bfd_get_symcount to reloc
swap routines.
* libaout.h (NAME(aout,swap_ext_reloc_in)): Add symcount parameter
to declaration.
(NAME(aout,swap_std_reloc_in)): Likewise.
* sunos.c (sunos_canonicalize_dynamic_reloc): Pass
info->dynsym_count to reloc swap routines.
* aout-ns32k.c (MY_swap_std_reloc_in): Add symcount parameter.
* hp300hpux.c (MY(swap_std_reloc_in)): Likewise.
(MY(slurp_reloc_table)): Pass bfd_get_symcount to reloc swap
routine.
* i386lynx.c (NAME(lynx,swap_ext_reloc_in)): Add symcount
parameter.
(NAME(lynx,swap_std_reloc_in)): Likewise.
(NAME(lynx,slurp_reloc_table)): Pass bfd_get_symcount to reloc
swap routines.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r-- | bfd/aoutx.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 5c33fd3e..b3c660e 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -2116,11 +2116,12 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr) } \ void -NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols) +NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) bfd *abfd; struct reloc_ext_external *bytes; arelent *cache_ptr; asymbol **symbols; + bfd_size_type symcount; { int r_index; int r_extern; @@ -2146,7 +2147,17 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols) >> RELOC_EXT_BITS_TYPE_SH_LITTLE; } - if (r_extern && r_index > bfd_get_symcount (abfd)) + cache_ptr->howto = howto_table_ext + r_type; + + /* Base relative relocs are always against the symbol table, + regardless of the setting of r_extern. r_extern just reflects + whether the symbol the reloc is against is local or global. */ + if (r_type == RELOC_BASE10 + || r_type == RELOC_BASE13 + || r_type == RELOC_BASE22) + r_extern = 1; + + if (r_extern && r_index > symcount) { /* We could arrange to return an error, but it might be useful to see the file even if it is bad. */ @@ -2154,16 +2165,16 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols) r_index = N_ABS; } - cache_ptr->howto = howto_table_ext + r_type; MOVE_ADDRESS(GET_SWORD(abfd, bytes->r_addend)); } void -NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols) +NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) bfd *abfd; struct reloc_std_external *bytes; arelent *cache_ptr; asymbol **symbols; + bfd_size_type symcount; { int r_index; int r_extern; @@ -2206,7 +2217,13 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols) cache_ptr->howto = howto_table_std + howto_idx; BFD_ASSERT (cache_ptr->howto->type != -1); - if (r_extern && r_index > bfd_get_symcount (abfd)) + /* Base relative relocs are always against the symbol table, + regardless of the setting of r_extern. r_extern just reflects + whether the symbol the reloc is against is local or global. */ + if (r_baserel) + r_extern = 1; + + if (r_extern && r_index > symcount) { /* We could arrange to return an error, but it might be useful to see the file even if it is bad. */ @@ -2288,7 +2305,8 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) (struct reloc_ext_external *) relocs; for (; counter < count; counter++, rptr++, cache_ptr++) - NAME(aout,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols); + NAME(aout,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols, + bfd_get_symcount (abfd)); } else { @@ -2296,7 +2314,8 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) (struct reloc_std_external *) relocs; for (; counter < count; counter++, rptr++, cache_ptr++) - MY_swap_std_reloc_in(abfd, rptr, cache_ptr, symbols); + MY_swap_std_reloc_in (abfd, rptr, cache_ptr, symbols, + bfd_get_symcount (abfd)); } free (relocs); |