aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-08-31 15:10:34 +0000
committerSteve Chamberlain <sac@cygnus>1992-08-31 15:10:34 +0000
commit2768b3f76344dafefbe26628465d7282ce11b3e1 (patch)
treeff835e7b8f1c5717483045e24424ac43699873dd /bfd
parent3877a2192c25d88f8c4d2df0e9baf7b67b284b49 (diff)
downloadgdb-2768b3f76344dafefbe26628465d7282ce11b3e1.zip
gdb-2768b3f76344dafefbe26628465d7282ce11b3e1.tar.gz
gdb-2768b3f76344dafefbe26628465d7282ce11b3e1.tar.bz2
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/aoutx.h94
2 files changed, 67 insertions, 33 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7a69815..a9fa6e7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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)
* archive.c (bfd_slurp_bsd_armap): if the symdef_count is too
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 71b56e8..2f8d02c 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1,4 +1,3 @@
-#define BFD_AOUT_DEBUG
/* BFD semi-generic back-end for a.out binaries
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -591,20 +590,12 @@ DEFUN(NAME(aout,set_arch_mach),(abfd, arch, machine),
enum bfd_architecture arch AND
unsigned long machine)
{
- bfd_arch_info_type *ainfo;
-
bfd_default_set_arch_mach(abfd, arch, machine);
if (arch != bfd_arch_unknown &&
NAME(aout,machine_type) (arch, machine) == M_UNKNOWN)
return false; /* We can't represent this type */
- BFD_ASSERT (&adata(abfd) != 0);
- 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 ... */
+ return (*aout_backend_info(abfd)->set_sizes) (abfd);
}
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 */
+ /* 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
|| output_section == &bfd_abs_section
|| output_section == &bfd_und_section)
{
- /* Fill in symbol */
- r_extern = 1;
- r_index = stoi((*(g->sym_ptr_ptr))->KEEPIT);
+ if (bfd_abs_section.symbol == sym)
+ {
+ /* 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
{
@@ -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;
- if (output_section == &bfd_com_section
- || output_section == &bfd_abs_section
- || output_section == &bfd_und_section)
+ /* 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
+ || output_section == &bfd_abs_section
+ || output_section == &bfd_und_section)
{
- /* Fill in symbol */
- r_extern = 1;
- r_index = stoi((*(g->sym_ptr_ptr))->KEEPIT);
+ if (bfd_abs_section.symbol == sym)
+ {
+ /* 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
{
@@ -1503,20 +1531,20 @@ DEFUN(NAME(aout,swap_ext_reloc_out),(abfd, g, natptr),
/* now the fun stuff */
if (abfd->xvec->header_byteorder_big_p != false) {
- natptr->r_index[0] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[2] = r_index;
- natptr->r_type[0] =
- (r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0)
- | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG);
- } else {
- natptr->r_index[2] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[0] = r_index;
- natptr->r_type[0] =
- (r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0)
- | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
- }
+ natptr->r_index[0] = r_index >> 16;
+ natptr->r_index[1] = r_index >> 8;
+ natptr->r_index[2] = r_index;
+ natptr->r_type[0] =
+ (r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0)
+ | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG);
+ } else {
+ natptr->r_index[2] = r_index >> 16;
+ natptr->r_index[1] = r_index >> 8;
+ natptr->r_index[0] = r_index;
+ natptr->r_type[0] =
+ (r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0)
+ | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
+ }
PUT_WORD (abfd, r_addend, natptr->r_addend);
}