* config/tc-hppa.c (tc_gen_reloc): Preliminary stab at handling

SOM relocations.
This commit is contained in:
Jeff Law
1993-10-30 22:35:49 +00:00
parent d56f45f5bc
commit 62f0841b9d
2 changed files with 49 additions and 17 deletions

View File

@ -1,5 +1,8 @@
Sat Oct 30 14:26:20 1993 Jeffrey A. Law (law@snake.cs.utah.edu) Sat Oct 30 14:26:20 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
* config/tc-hppa.c (tc_gen_reloc): Preliminary stab at handling
SOM relocations.
* config/tc-hppa.c (pa_comm): Delete incorrect check for symbol * config/tc-hppa.c (pa_comm): Delete incorrect check for symbol
redefinition. redefinition.

View File

@ -2691,9 +2691,8 @@ md_number_to_chars (buf, val, n)
} }
/* Translate internal representation of relocation info to BFD target /* Translate internal representation of relocation info to BFD target
format. FIXME: This code is not appropriate for SOM. */ format. */
#ifdef OBJ_ELF
arelent ** arelent **
tc_gen_reloc (section, fixp) tc_gen_reloc (section, fixp)
asection *section; asection *section;
@ -2715,7 +2714,13 @@ tc_gen_reloc (section, fixp)
assert (hppa_fixp != 0); assert (hppa_fixp != 0);
assert (section != 0); assert (section != 0);
/* Unwind section relocations are handled in a special way. #ifdef OBJ_ELF
/* Yuk. I would really like to push all this ELF specific unwind
crud into BFD and the linker. That's how SOM does it -- and
if we could make ELF emulate that then we could share more code
in GAS (and potentially a gnu-linker later).
Unwind section relocations are handled in a special way.
The relocations for the .unwind section are originally The relocations for the .unwind section are originally
built in the usual way. That is, for each unwind table built in the usual way. That is, for each unwind table
entry there are two relocations: one for the beginning of entry there are two relocations: one for the beginning of
@ -2759,6 +2764,7 @@ tc_gen_reloc (section, fixp)
return &no_relocs; return &no_relocs;
} }
#endif
reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent));
assert (reloc != 0); assert (reloc != 0);
@ -2786,6 +2792,7 @@ tc_gen_reloc (section, fixp)
relocs[n_relocs] = NULL; relocs[n_relocs] = NULL;
#ifdef OBJ_ELF
switch (fixp->fx_r_type) switch (fixp->fx_r_type)
{ {
case R_HPPA_COMPLEX: case R_HPPA_COMPLEX:
@ -2890,24 +2897,46 @@ tc_gen_reloc (section, fixp)
} }
break; break;
} }
#else /* OBJ_SOM */
/* Preliminary relocation handling for SOM. Needs to handle
COMPLEX relocations (yes, I've seen them occur) and it will
need to handle R_ENTRY/R_EXIT relocations in the very near future
(for generating unwinds). */
switch (fixp->fx_r_type)
{
case R_HPPA_COMPLEX:
case R_HPPA_COMPLEX_PCREL_CALL:
case R_HPPA_COMPLEX_ABS_CALL:
abort();
break;
default:
assert (n_relocs == 1);
code = *codes[0];
reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where ;
reloc->addend = 0;
switch (code)
{
case R_PCREL_CALL:
case R_ABS_CALL:
reloc->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc, 0);
break;
default:
reloc->addend = fixp->fx_addnumber;
break;
}
break;
}
#endif
return relocs; return relocs;
} }
#else
/* Translate internal representation of relocation info to BFD target
format. FIXME: This code is not appropriate for SOM. */
arelent **
tc_gen_reloc (section, fixp)
asection *section;
fixS *fixp;
{
static arelent *no_relocs = NULL;
abort ();
return &no_relocs;
}
#endif
/* Process any machine dependent frag types. */ /* Process any machine dependent frag types. */
void void