Fri Oct 23 10:32:36 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* seclet.c (rel): don't load sections without the SEC_LOAD bit. Thu Oct 15 10:16:35 1992 Steve Chamberlain (sac@thepub.cygnus.com) * coff-m68k.c (m68k_howto2type, SELECT_RELOC): new function to work out a coff relocation type from a howto's attributes rather than using the input r_type field. This fixes PR1677 and allows conversion of a.out relocs to coff relocs. * coffcode.h (coff_write_relocs): if supplied a relocation relative to an absolute symbol, use the right symbol index. * reloc.c (bfd_perform_relocation): do a partial link for coff relocs right.
This commit is contained in:
parent
b26059aa44
commit
c26d7d179c
4 changed files with 75 additions and 20 deletions
|
@ -1,3 +1,20 @@
|
||||||
|
Fri Oct 23 10:32:36 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||||
|
|
||||||
|
* seclet.c (rel): don't load sections without the SEC_LOAD bit.
|
||||||
|
|
||||||
|
Thu Oct 15 10:16:35 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||||
|
|
||||||
|
* coff-m68k.c (m68k_howto2type, SELECT_RELOC): new function to
|
||||||
|
work out a coff relocation type from a howto's attributes rather
|
||||||
|
than using the input r_type field. This fixes PR1677 and allows
|
||||||
|
conversion of a.out relocs to coff relocs.
|
||||||
|
|
||||||
|
* coffcode.h (coff_write_relocs): if supplied a relocation
|
||||||
|
relative to an absolute symbol, use the right symbol index.
|
||||||
|
|
||||||
|
* reloc.c (bfd_perform_relocation): do a partial link for coff
|
||||||
|
relocs right.
|
||||||
|
|
||||||
Fri Oct 23 08:15:56 1992 Ian Lance Taylor (ian@cygnus.com)
|
Fri Oct 23 08:15:56 1992 Ian Lance Taylor (ian@cygnus.com)
|
||||||
|
|
||||||
* changes to support i386-sysv with shared libraries:
|
* changes to support i386-sysv with shared libraries:
|
||||||
|
|
|
@ -1852,13 +1852,26 @@ DEFUN(coff_write_relocs,(abfd),
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (q->sym_ptr_ptr) {
|
|
||||||
n.r_symndx = get_index((*(q->sym_ptr_ptr)));
|
if (q->sym_ptr_ptr)
|
||||||
/* Take notice if the symbol reloc points to a symbol we don't have
|
{
|
||||||
in our symbol table. What should we do for this?? */
|
if (q->sym_ptr_ptr == bfd_abs_section.symbol_ptr_ptr)
|
||||||
if (n.r_symndx > obj_conv_table_size (abfd))
|
{
|
||||||
abort ();
|
/* This is a relocation relative to the absolute symbol */
|
||||||
|
n.r_symndx = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n.r_symndx = get_index((*(q->sym_ptr_ptr)));
|
||||||
|
/* Take notice if the symbol reloc points to a symbol we don't have
|
||||||
|
in our symbol table. What should we do for this?? */
|
||||||
|
if (n.r_symndx > obj_conv_table_size (abfd))
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SELECT_RELOC
|
#ifdef SELECT_RELOC
|
||||||
/* Work out reloc type from what is required */
|
/* Work out reloc type from what is required */
|
||||||
SELECT_RELOC(n.r_type, q->howto);
|
SELECT_RELOC(n.r_type, q->howto);
|
||||||
|
|
52
bfd/reloc.c
52
bfd/reloc.c
|
@ -45,7 +45,8 @@ SECTION
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
#include "libbfd.h"
|
#include "libbfd.h"
|
||||||
#include "seclet.h"
|
#include "seclet.h"
|
||||||
/*doc*
|
/*
|
||||||
|
DOCDD
|
||||||
INODE
|
INODE
|
||||||
typedef arelent, howto manager, Relocations, Relocations
|
typedef arelent, howto manager, Relocations, Relocations
|
||||||
|
|
||||||
|
@ -131,10 +132,13 @@ DESCRIPTION
|
||||||
will be relative to this point - for example, a relocation
|
will be relative to this point - for example, a relocation
|
||||||
type which modifies the bottom two bytes of a four byte word
|
type which modifies the bottom two bytes of a four byte word
|
||||||
would not touch the first byte pointed to in a big endian
|
would not touch the first byte pointed to in a big endian
|
||||||
world. @item addend The addend is a value provided by the back
|
world.
|
||||||
end to be added (!) to the relocation offset. Its
|
|
||||||
interpretation is dependent upon the howto. For example, on
|
o addend
|
||||||
the 68k the code:
|
|
||||||
|
The addend is a value provided by the back end to be added (!)
|
||||||
|
to the relocation offset. Its interpretation is dependent upon
|
||||||
|
the howto. For example, on the 68k the code:
|
||||||
|
|
||||||
|
|
||||||
| char foo[];
|
| char foo[];
|
||||||
|
@ -264,8 +268,9 @@ CODE_FRAGMENT
|
||||||
. unsigned int rightshift;
|
. unsigned int rightshift;
|
||||||
.
|
.
|
||||||
. {* The size of the item to be relocated - 0, is one byte, 1 is 2
|
. {* The size of the item to be relocated - 0, is one byte, 1 is 2
|
||||||
. bytes, 3 is four bytes. *}
|
. bytes, 3 is four bytes. A -ve value indicates that the
|
||||||
. unsigned int size;
|
. result is to be subtracted from the data*}
|
||||||
|
. int size;
|
||||||
.
|
.
|
||||||
. {* Now obsolete *}
|
. {* Now obsolete *}
|
||||||
. unsigned int bitsize;
|
. unsigned int bitsize;
|
||||||
|
@ -521,8 +526,10 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
This is a partial relocation, and we want to apply the relocation
|
||||||
to the reloc entry rather than the raw data. Modify the reloc
|
to the reloc entry rather than the raw data. Modify the reloc
|
||||||
|
@ -540,20 +547,26 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
If we've relocated with a symbol with a section, change
|
If we've relocated with a symbol with a section, change
|
||||||
into a ref to the section belonging to the symbol
|
into a ref to the section belonging to the symbol
|
||||||
*/
|
*/
|
||||||
reloc_entry->addend = relocation ;
|
|
||||||
reloc_entry->address += input_section->output_offset;
|
|
||||||
|
|
||||||
|
reloc_entry->address += input_section->output_offset;
|
||||||
|
|
||||||
|
if (abfd->xvec->flavour == bfd_target_coff_flavour)
|
||||||
|
{
|
||||||
|
relocation -= reloc_entry->addend;
|
||||||
|
reloc_entry->addend = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reloc_entry->addend = relocation ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
reloc_entry->addend = 0;
|
reloc_entry->addend = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Either we are relocating all the way, or we don't want to apply
|
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
|
the relocation to the reloc entry (probably because there isn't
|
||||||
|
@ -625,6 +638,15 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
bfd_put_32(abfd,x, (bfd_byte *)data + addr);
|
bfd_put_32(abfd,x, (bfd_byte *)data + addr);
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case 3:
|
||||||
|
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
|
@ -639,6 +661,7 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
DOCDD
|
||||||
INODE
|
INODE
|
||||||
howto manager, , typedef arelent, Relocations
|
howto manager, , typedef arelent, Relocations
|
||||||
|
|
||||||
|
@ -661,6 +684,7 @@ DESCRIPTION
|
||||||
CODE_FRAGMENT
|
CODE_FRAGMENT
|
||||||
.
|
.
|
||||||
.typedef enum bfd_reloc_code_real
|
.typedef enum bfd_reloc_code_real
|
||||||
|
.
|
||||||
.{
|
.{
|
||||||
. {* 16 bits wide, simple reloc *}
|
. {* 16 bits wide, simple reloc *}
|
||||||
. BFD_RELOC_16,
|
. BFD_RELOC_16,
|
||||||
|
@ -792,7 +816,7 @@ DEFUN(bfd_default_reloc_type_lookup,(arch, code),
|
||||||
default:
|
default:
|
||||||
BFD_FAIL();
|
BFD_FAIL();
|
||||||
}
|
}
|
||||||
return (struct reloc_howto_struct *)NULL;
|
return (CONST struct reloc_howto_struct *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ DEFUN(rel,(abfd, seclet, output_section, data),
|
||||||
|
|
||||||
if (output_section->flags & SEC_HAS_CONTENTS
|
if (output_section->flags & SEC_HAS_CONTENTS
|
||||||
&& !(output_section->flags & SEC_NEVER_LOAD)
|
&& !(output_section->flags & SEC_NEVER_LOAD)
|
||||||
|
&& (output_section->flags & SEC_LOAD)
|
||||||
&& seclet->size)
|
&& seclet->size)
|
||||||
{
|
{
|
||||||
data = (PTR) bfd_get_relocated_section_contents(abfd, seclet, data);
|
data = (PTR) bfd_get_relocated_section_contents(abfd, seclet, data);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue