From caed9e8251b3f6b2f7f86168755535632e755aa7 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 11 Apr 1994 16:11:12 +0000 Subject: [PATCH] * config/tc-hppa.c (pa_procend): Handle case where label was defined after the .proc directive. --- gas/ChangeLog | 3 +++ gas/config/tc-hppa.c | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 59374d33396..bc5ba80faf1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,8 @@ Mon Apr 11 09:00:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu) + * config/tc-hppa.c (pa_procend): Handle case where label was + defined after the .proc directive. + * config/tc-hppa.c (pa_procend): Give an error if we encounter a procend for a procedure without a name. diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index e6b17e2d2b4..60e9b7bbbd3 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -5008,8 +5008,43 @@ pa_procend (unused) int unused; { - if (last_call_info->start_symbol == NULL) - as_bad ("Missing function name for .PROC"); + /* If we are within a procedure definition, make sure we've + defined a label for the procedure; handle case where the + label was defined after the .PROC directive. + + Note there's not need to diddle with the segment or fragment + for the label symbol in this case. We have already switched + into the new $CODE$ subspace at this point. */ + if (within_procedure && last_call_info->start_symbol == NULL) + { + label_symbol_struct *label_symbol = pa_get_label (); + + if (label_symbol) + { + if (label_symbol->lss_label) + { + last_call_info->start_symbol = label_symbol->lss_label; + label_symbol->lss_label->bsym->flags |= BSF_FUNCTION; +#ifdef OBJ_SOM + /* Also handle allocation of a fixup to hold the unwind + information when the label appears after the proc/procend. */ + if (within_entry_exit) + { + 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, + (char *) &last_call_info->ci_unwind.descriptor); + } +#endif + } + else + as_bad ("Missing function name for .PROC (corrupted label chain)"); + } + else + as_bad ("Missing function name for .PROC"); + } if (!within_procedure) as_bad ("misplaced .procend"); -- 2.30.2