* config/obj-som.h (obj_attach_unwind_info): Define as a hook

so GAS can attach unwind descriptor information to a BFD symbol.
	* config/tc-hppa.c (fix_new_hppa): If necessary attach unwind
	descriptor information to the BFD symbol.
	(md_apply_fix): R_HPPA_ENTRY and R_HPPA_EXIT can never be "applied",
	they are simply markers.  Make R_HPPA_UNWIND_* handling OBJ_ELF
	dependent.
	(pa_build_unwind_subspace): Whole function is OBJ_ELF dependent.
	(pa_entry): Build a R_HPPA_ENTRY relocation when configured for SOM.
	(pa_exit): Likewise, but built a R_HPPA_EXIT relocation.  Do not
	build "end-of-function" symbols for SOM, they are not needed.
This commit is contained in:
Jeff Law
1993-11-02 08:06:23 +00:00
parent 97335255fb
commit ff852e1177
2 changed files with 73 additions and 6 deletions

View File

@ -1,5 +1,17 @@
Mon Nov 1 21:37:04 1993 Jeffrey A. Law (law@snake.cs.utah.edu) Mon Nov 1 21:37:04 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
* config/obj-som.h (obj_attach_unwind_info): Define as a hook
so GAS can attach unwind descriptor information to a BFD symbol.
* config/tc-hppa.c (fix_new_hppa): If necessary attach unwind
descriptor information to the BFD symbol.
(md_apply_fix): R_HPPA_ENTRY and R_HPPA_EXIT can never be "applied",
they are simply markers. Make R_HPPA_UNWIND_* handling OBJ_ELF
dependent.
(pa_build_unwind_subspace): Whole function is OBJ_ELF dependent.
(pa_entry): Build a R_HPPA_ENTRY relocation when configured for SOM.
(pa_exit): Likewise, but built a R_HPPA_EXIT relocation. Do not
build "end-of-function" symbols for SOM, they are not needed.
* config/tc-hppa.c (process_exit): Create temporary symbols with * config/tc-hppa.c (process_exit): Create temporary symbols with
correct prefixes so they can be eliminated later. correct prefixes so they can be eliminated later.

View File

@ -1312,8 +1312,16 @@ fix_new_hppa (frag, where, size, add_symbol, offset, exp, pcrel,
hppa_fix->fx_r_format = r_format; hppa_fix->fx_r_format = r_format;
hppa_fix->fx_arg_reloc = arg_reloc; hppa_fix->fx_arg_reloc = arg_reloc;
if (unwind_desc) if (unwind_desc)
{
bcopy (unwind_desc, hppa_fix->fx_unwind, 8); bcopy (unwind_desc, hppa_fix->fx_unwind, 8);
/* If necessary call BFD backend function to attach the
unwind bits to the target dependent parts of a BFD symbol.
Yuk. */
#ifdef obj_attach_unwind_info
obj_attach_unwind_info (add_symbol->bsym, unwind_desc);
#endif
}
} }
/* Parse a .byte, .word, .long expression for the HPPA. Called by /* Parse a .byte, .word, .long expression for the HPPA. Called by
@ -3097,6 +3105,14 @@ md_apply_fix_1 (fixP, val)
long new_val, result; long new_val, result;
unsigned int w1, w2, w; unsigned int w1, w2, w;
/* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can
never be "applied". They must always be emitted. */
#ifdef OBJ_SOM
if (fixP->fx_r_type == R_HPPA_ENTRY
|| fixP->fx_r_type == R_HPPA_EXIT)
return;
#endif
/* There should have been an HPPA specific fixup associated /* There should have been an HPPA specific fixup associated
with the GAS fixup. */ with the GAS fixup. */
if (hppa_fixP) if (hppa_fixP)
@ -3205,6 +3221,8 @@ md_apply_fix_1 (fixP, val)
case 32: case 32:
#ifdef OBJ_ELF #ifdef OBJ_ELF
/* These are ELF specific relocations. ELF unfortunately
handles unwinds in a completely different manner. */
if (hppa_fixP->fx_r_type == R_HPPA_UNWIND_ENTRY if (hppa_fixP->fx_r_type == R_HPPA_UNWIND_ENTRY
|| hppa_fixP->fx_r_type == R_HPPA_UNWIND_ENTRIES) || hppa_fixP->fx_r_type == R_HPPA_UNWIND_ENTRIES)
result = fixP->fx_addnumber; result = fixP->fx_addnumber;
@ -4248,8 +4266,11 @@ is_same_frag (frag1, frag2)
return (FALSE); return (FALSE);
} }
/* Build an entry in the UNWIND subspace from the given #ifdef OBJ_ELF
function attributes in CALL_INFO. */ /* Build an entry in the UNWIND subspace from the given function
attributes in CALL_INFO. This is not needed for SOM as using
R_ENTRY and R_EXIT relocations allow the linker to handle building
of the unwind spaces. */
static void static void
pa_build_unwind_subspace (call_info) pa_build_unwind_subspace (call_info)
@ -4348,6 +4369,7 @@ pa_build_unwind_subspace (call_info)
/* Return back to the original segment/subsegment. */ /* Return back to the original segment/subsegment. */
subseg_set (save_seg, save_subseg); subseg_set (save_seg, save_subseg);
} }
#endif
/* Process a .CALLINFO pseudo-op. This information is used later /* Process a .CALLINFO pseudo-op. This information is used later
to build unwind descriptors and maybe one day to support to build unwind descriptors and maybe one day to support
@ -4618,8 +4640,6 @@ static void
pa_entry (unused) pa_entry (unused)
int unused; int unused;
{ {
char *where;
if (!within_procedure) if (!within_procedure)
as_bad ("Misplaced .entry. Ignored."); as_bad ("Misplaced .entry. Ignored.");
else else
@ -4631,12 +4651,31 @@ pa_entry (unused)
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
within_entry_exit = TRUE; within_entry_exit = TRUE;
where = frag_more (0);
/* Go back to the last symbol and turn on the BSF_FUNCTION flag. /* Go back to the last symbol and turn on the BSF_FUNCTION flag.
It will not be on if no .EXPORT pseudo-op exists (static function). */ It will not be on if no .EXPORT pseudo-op exists (static function). */
last_call_info->start_symbol->bsym->flags |= BSF_FUNCTION; last_call_info->start_symbol->bsym->flags |= BSF_FUNCTION;
#ifdef OBJ_SOM
/* SOM defers building of unwind descriptors until the link phase.
The assembler is responsible for creating an R_ENTRY relocation
to mark the beginning of a region and hold the unwind bits, and
for creating an R_EXIT relocation to mark the end of the region.
FIXME. ELF should be using the same conventions! The problem
is an unwind requires too much relocation space. Hmmm. Maybe
if we split the unwind bits up between the relocations which
denote the entry and exit points. */
{
char *where = frag_more (0);
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
last_call_info->start_symbol, (offsetT) 0, NULL,
0, R_HPPA_ENTRY, e_fsel, 0, 0,
&last_call_info->ci_unwind.descriptor);
}
#endif
return; return;
} }
@ -4679,6 +4718,7 @@ process_exit ()
where = frag_more (0); where = frag_more (0);
#ifdef OBJ_ELF
/* ELF does not have EXIT relocations. All we do is create a /* ELF does not have EXIT relocations. All we do is create a
temporary symbol marking the end of the function. */ temporary symbol marking the end of the function. */
{ {
@ -4723,6 +4763,21 @@ process_exit ()
table. */ table. */
last_call_info->end_frag = frag_now; last_call_info->end_frag = frag_now;
pa_build_unwind_subspace (last_call_info); pa_build_unwind_subspace (last_call_info);
#else
/* SOM defers building of unwind descriptors until the link phase.
The assembler is responsible for creating an R_ENTRY relocation
to mark the beginning of a region and hold the unwind bits, and
for creating an R_EXIT relocation to mark the end of the region.
FIXME. ELF should be using the same conventions! The problem
is an unwind requires too much relocation space. Hmmm. Maybe
if we split the unwind bits up between the relocations which
denote the entry and exit points. */
fix_new_hppa (frag_now, where - frag_now->fr_literal, 0,
last_call_info->start_symbol, (offsetT) 0,
NULL, 0, R_HPPA_EXIT, e_fsel, 0, 0, NULL);
#endif
exit_processing_complete = TRUE; exit_processing_complete = TRUE;
} }