* aoutx.h (aout_swap_ext_reloc_out, aout_swap_std_reloc_out)

bout.c (b_out_squirt_out_relocs): treat abs sumbols the right way.
	* reloc.c (bfd_perform-relocation): don't relocate refs to
	absolute symbols if doing a partial link.
This commit is contained in:
Steve Chamberlain
1992-04-29 19:40:35 +00:00
parent 836e9ea06f
commit 5022aea5df
3 changed files with 102 additions and 98 deletions

View File

@ -1,3 +1,10 @@
Wed Apr 29 12:37:07 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* aoutx.h (aout_swap_ext_reloc_out, aout_swap_std_reloc_out)
bout.c (b_out_squirt_out_relocs): treat abs sumbols the right way.
* reloc.c (bfd_perform-relocation): don't relocate refs to
absolute symbols if doing a partial link.
Fri Apr 24 07:35:26 1992 Stu Grossman (grossman at cygnus.com) Fri Apr 24 07:35:26 1992 Stu Grossman (grossman at cygnus.com)
* configure.in: Add a29k-amd-udi. * configure.in: Add a29k-amd-udi.

View File

@ -269,16 +269,14 @@ asymbol *symbol_in;
PTR data; PTR data;
asection *input_section; asection *input_section;
{ {
int word = bfd_get_32(abfd, data+reloc_entry->address); int word = bfd_get_32(abfd, (bfd_byte *)data + reloc_entry->address);
aout_symbol_type *symbol = aout_symbol(symbol_in); aout_symbol_type *symbol = aout_symbol(symbol_in);
if (IS_OTHER(symbol->other)) { if (IS_OTHER(symbol->other)) {
/* Call to a system procedure - replace code with system /* Call to a system procedure - replace code with system
procedure number procedure number */
*/
word = CALLS | (symbol->other - 1); word = CALLS | (symbol->other - 1);
bfd_put_32(abfd, word, data+reloc_entry->address); /* replace */ bfd_put_32(abfd, word, (bfd_byte *)data + reloc_entry->address); /* rplc */
return bfd_reloc_ok; return bfd_reloc_ok;
} }
@ -298,7 +296,7 @@ asection *input_section;
( input_section->output_section->vma + input_section->output_offset)) ( input_section->output_section->vma + input_section->output_offset))
& BAL_MASK); & BAL_MASK);
bfd_put_32(abfd, word, data+reloc_entry->address); /* replace */ bfd_put_32(abfd, word, (bfd_byte *) data + reloc_entry->address); /* rplc */
return bfd_reloc_ok; return bfd_reloc_ok;
} }
return bfd_reloc_continue; return bfd_reloc_continue;
@ -438,10 +436,10 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
break; break;
case N_ABS: case N_ABS:
case N_ABS | N_EXT: case N_ABS | N_EXT:
bfd_assert(0); BFD_ASSERT(0);
break; break;
default: default:
bfd_assert(0); BFD_ASSERT(0);
break; break;
} }
@ -511,7 +509,6 @@ else
{ {
arelent *g = *generic; arelent *g = *generic;
unsigned char *raw = (unsigned char *)natptr; unsigned char *raw = (unsigned char *)natptr;
unsigned int symnum;
asymbol *sym = *(g->sym_ptr_ptr); asymbol *sym = *(g->sym_ptr_ptr);
asection *output_section = sym->section->output_section; asection *output_section = sym->section->output_section;
@ -532,13 +529,8 @@ else
else { else {
raw[7] = len_2; raw[7] = len_2;
} }
if (output_section == &bfd_abs_section) if (output_section == &bfd_com_section
{ output_section == &bfd_abs_section
r_extern = 0;
r_idx = N_ABS;
r_addend += sym->value;
}
else if (output_section == &bfd_com_section
|| output_section == &bfd_und_section) || output_section == &bfd_und_section)
{ {
/* Fill in symbol */ /* Fill in symbol */

View File

@ -247,6 +247,7 @@ SUBSUBSECTION
information that BFD needs to know to tie up a back end's data. information that BFD needs to know to tie up a back end's data.
CODE_FRAGMENT CODE_FRAGMENT
.struct symbol_cache_entry; {* Forward declaration *}
. .
.typedef CONST struct reloc_howto_struct .typedef CONST struct reloc_howto_struct
.{ .{
@ -289,7 +290,12 @@ CODE_FRAGMENT
. called rather than the normal function. This allows really . called rather than the normal function. This allows really
. strange relocation methods to be accomodated (eg, i960 callj . strange relocation methods to be accomodated (eg, i960 callj
. instructions). *} . instructions). *}
. bfd_reloc_status_type (*special_function)(); . bfd_reloc_status_type EXFUN ((*special_function),
. (bfd *abfd,
. arelent *reloc_entry,
. struct symbol_cache_entry *symbol,
. PTR data,
. asection *input_section));
. .
. {* The textual name of the relocation type. *} . {* The textual name of the relocation type. *}
. char *name; . char *name;
@ -431,6 +437,15 @@ DEFUN(bfd_perform_relocation,(abfd,
asymbol *symbol; asymbol *symbol;
symbol = *( reloc_entry->sym_ptr_ptr); symbol = *( reloc_entry->sym_ptr_ptr);
if ((symbol->section == &bfd_abs_section)
&& output_bfd != (bfd *)NULL)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
if ((symbol->section == &bfd_und_section) && output_bfd == (bfd *)NULL) { if ((symbol->section == &bfd_und_section) && output_bfd == (bfd *)NULL) {
flag = bfd_reloc_undefined; flag = bfd_reloc_undefined;
} }
@ -745,8 +760,7 @@ SYNOPSIS
boolean bfd_generic_relax_section boolean bfd_generic_relax_section
(bfd *abfd, (bfd *abfd,
asection *section, asection *section,
asymbol **symbols, asymbol **symbols);
struct bfd_seclet_struct *seclet);
DESCRIPTION DESCRIPTION
Provides default handling for relaxing for back ends which Provides default handling for relaxing for back ends which
@ -754,11 +768,10 @@ DESCRIPTION
*/ */
boolean boolean
DEFUN(bfd_generic_relax_section,(abfd, section, symbols, seclet), DEFUN(bfd_generic_relax_section,(abfd, section, symbols),
bfd *abfd AND bfd *abfd AND
asection *section AND asection *section AND
asymbol **symbols AND asymbol **symbols)
struct bfd_seclet_struct *seclet)
{ {
return false; return false;
@ -788,21 +801,15 @@ DEFUN(bfd_generic_get_relocated_section_contents,(abfd, seclet),
{ {
extern bfd_error_vector_type bfd_error_vector; extern bfd_error_vector_type bfd_error_vector;
asymbol **symbols = 0;
/* Get enough memory to hold the stuff */ /* Get enough memory to hold the stuff */
bfd *input_bfd = seclet->u.indirect.section->owner; bfd *input_bfd = seclet->u.indirect.section->owner;
asection *input_section = seclet->u.indirect.section; asection *input_section = seclet->u.indirect.section;
bfd_byte *data = (bfd_byte *)malloc(input_section->_raw_size); bfd_byte *data = (bfd_byte *) bfd_xmalloc(input_section->_raw_size);
bfd_byte *dst = data;
bfd_byte *prev_dst = data;
unsigned int gap = 0;
bfd_size_type reloc_size = bfd_get_reloc_upper_bound(input_bfd, bfd_size_type reloc_size = bfd_get_reloc_upper_bound(input_bfd,
input_section); input_section);
arelent **reloc_vector = (arelent **)malloc(reloc_size); arelent **reloc_vector = (arelent **) bfd_xmalloc(reloc_size);
/* read in the section */ /* read in the section */
bfd_get_section_contents(input_bfd, bfd_get_section_contents(input_bfd,
@ -834,8 +841,6 @@ DEFUN(bfd_generic_get_relocated_section_contents,(abfd, seclet),
if (r != bfd_reloc_ok) if (r != bfd_reloc_ok)
{ {
asymbol *s;
switch (r) switch (r)
{ {
case bfd_reloc_undefined: case bfd_reloc_undefined: