* aoutx.h (aout<n>swap_ext_reloc_out), bout.c
(b_out_squirt_out_relocs): fix bug 1506 where abs symbols attached to the built-in abs_section were not written out correctly.
This commit is contained in:
parent
3877a2192c
commit
2768b3f763
2 changed files with 67 additions and 33 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Mon Aug 31 08:07:58 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||||
|
|
||||||
|
* aoutx.h (aout<n>swap_ext_reloc_out), bout.c
|
||||||
|
(b_out_squirt_out_relocs): fix bug 1506 where abs symbols attached
|
||||||
|
to the built-in abs_section were not written out correctly.
|
||||||
|
|
||||||
Fri Aug 28 16:29:15 1992 Ian Lance Taylor (ian@cygnus.com)
|
Fri Aug 28 16:29:15 1992 Ian Lance Taylor (ian@cygnus.com)
|
||||||
|
|
||||||
* archive.c (bfd_slurp_bsd_armap): if the symdef_count is too
|
* archive.c (bfd_slurp_bsd_armap): if the symdef_count is too
|
||||||
|
|
94
bfd/aoutx.h
94
bfd/aoutx.h
|
@ -1,4 +1,3 @@
|
||||||
#define BFD_AOUT_DEBUG
|
|
||||||
/* BFD semi-generic back-end for a.out binaries
|
/* BFD semi-generic back-end for a.out binaries
|
||||||
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||||
Written by Cygnus Support.
|
Written by Cygnus Support.
|
||||||
|
@ -591,20 +590,12 @@ DEFUN(NAME(aout,set_arch_mach),(abfd, arch, machine),
|
||||||
enum bfd_architecture arch AND
|
enum bfd_architecture arch AND
|
||||||
unsigned long machine)
|
unsigned long machine)
|
||||||
{
|
{
|
||||||
bfd_arch_info_type *ainfo;
|
|
||||||
|
|
||||||
bfd_default_set_arch_mach(abfd, arch, machine);
|
bfd_default_set_arch_mach(abfd, arch, machine);
|
||||||
if (arch != bfd_arch_unknown &&
|
if (arch != bfd_arch_unknown &&
|
||||||
NAME(aout,machine_type) (arch, machine) == M_UNKNOWN)
|
NAME(aout,machine_type) (arch, machine) == M_UNKNOWN)
|
||||||
return false; /* We can't represent this type */
|
return false; /* We can't represent this type */
|
||||||
|
|
||||||
BFD_ASSERT (&adata(abfd) != 0);
|
return (*aout_backend_info(abfd)->set_sizes) (abfd);
|
||||||
ainfo = bfd_get_arch_info (abfd);
|
|
||||||
if (ainfo->segment_size)
|
|
||||||
adata(abfd).segment_size = ainfo->segment_size;
|
|
||||||
if (ainfo->page_size)
|
|
||||||
adata(abfd).page_size = ainfo->page_size;
|
|
||||||
return true; /* We're easy ... */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
@ -1420,13 +1411,33 @@ DEFUN(NAME(aout,swap_std_reloc_out),(abfd, g, natptr),
|
||||||
|
|
||||||
/* name was clobbered by aout_write_syms to be symbol index */
|
/* name was clobbered by aout_write_syms to be symbol index */
|
||||||
|
|
||||||
|
/* If this relocation is relative to a symbol then set the
|
||||||
|
r_index to the symbols index, and the r_extern bit.
|
||||||
|
|
||||||
|
Absolute symbols can come in in two ways, either as an offset
|
||||||
|
from the abs section, or as a symbol which has an abs value.
|
||||||
|
check for that here
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (output_section == &bfd_com_section
|
if (output_section == &bfd_com_section
|
||||||
|| output_section == &bfd_abs_section
|
|| output_section == &bfd_abs_section
|
||||||
|| output_section == &bfd_und_section)
|
|| output_section == &bfd_und_section)
|
||||||
{
|
{
|
||||||
/* Fill in symbol */
|
if (bfd_abs_section.symbol == sym)
|
||||||
r_extern = 1;
|
{
|
||||||
r_index = stoi((*(g->sym_ptr_ptr))->KEEPIT);
|
/* Whoops, looked like an abs symbol, but is really an offset
|
||||||
|
from the abs section */
|
||||||
|
r_index = 0;
|
||||||
|
r_extern = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Fill in symbol */
|
||||||
|
r_extern = 1;
|
||||||
|
r_index = stoi((*(g->sym_ptr_ptr))->KEEPIT);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1485,13 +1496,30 @@ DEFUN(NAME(aout,swap_ext_reloc_out),(abfd, g, natptr),
|
||||||
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
|
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
|
||||||
|
|
||||||
|
|
||||||
if (output_section == &bfd_com_section
|
/* If this relocation is relative to a symbol then set the
|
||||||
|| output_section == &bfd_abs_section
|
r_index to the symbols index, and the r_extern bit.
|
||||||
|| output_section == &bfd_und_section)
|
|
||||||
|
Absolute symbols can come in in two ways, either as an offset
|
||||||
|
from the abs section, or as a symbol which has an abs value.
|
||||||
|
check for that here
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (output_section == &bfd_com_section
|
||||||
|
|| output_section == &bfd_abs_section
|
||||||
|
|| output_section == &bfd_und_section)
|
||||||
{
|
{
|
||||||
/* Fill in symbol */
|
if (bfd_abs_section.symbol == sym)
|
||||||
r_extern = 1;
|
{
|
||||||
r_index = stoi((*(g->sym_ptr_ptr))->KEEPIT);
|
/* Whoops, looked like an abs symbol, but is really an offset
|
||||||
|
from the abs section */
|
||||||
|
r_index = 0;
|
||||||
|
r_extern = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r_extern = 1;
|
||||||
|
r_index = stoi((*(g->sym_ptr_ptr))->KEEPIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1503,20 +1531,20 @@ DEFUN(NAME(aout,swap_ext_reloc_out),(abfd, g, natptr),
|
||||||
|
|
||||||
/* now the fun stuff */
|
/* now the fun stuff */
|
||||||
if (abfd->xvec->header_byteorder_big_p != false) {
|
if (abfd->xvec->header_byteorder_big_p != false) {
|
||||||
natptr->r_index[0] = r_index >> 16;
|
natptr->r_index[0] = r_index >> 16;
|
||||||
natptr->r_index[1] = r_index >> 8;
|
natptr->r_index[1] = r_index >> 8;
|
||||||
natptr->r_index[2] = r_index;
|
natptr->r_index[2] = r_index;
|
||||||
natptr->r_type[0] =
|
natptr->r_type[0] =
|
||||||
(r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0)
|
(r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0)
|
||||||
| (r_type << RELOC_EXT_BITS_TYPE_SH_BIG);
|
| (r_type << RELOC_EXT_BITS_TYPE_SH_BIG);
|
||||||
} else {
|
} else {
|
||||||
natptr->r_index[2] = r_index >> 16;
|
natptr->r_index[2] = r_index >> 16;
|
||||||
natptr->r_index[1] = r_index >> 8;
|
natptr->r_index[1] = r_index >> 8;
|
||||||
natptr->r_index[0] = r_index;
|
natptr->r_index[0] = r_index;
|
||||||
natptr->r_type[0] =
|
natptr->r_type[0] =
|
||||||
(r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0)
|
(r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0)
|
||||||
| (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
|
| (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PUT_WORD (abfd, r_addend, natptr->r_addend);
|
PUT_WORD (abfd, r_addend, natptr->r_addend);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue