aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1993-12-01 18:43:53 +0000
committerJeff Law <law@redhat.com>1993-12-01 18:43:53 +0000
commit44c0de5363793711b81587e5865d47c437c92387 (patch)
tree934d0b92c2c7626f31703470cfc73c74b89355cf /gas
parentf651733a12b1e147ba33a32fdbe5e9ad299a38a0 (diff)
downloadgdb-44c0de5363793711b81587e5865d47c437c92387.zip
gdb-44c0de5363793711b81587e5865d47c437c92387.tar.gz
gdb-44c0de5363793711b81587e5865d47c437c92387.tar.bz2
* config/tc-hppa.c (hppa_elf_mark_end_of_function): New function.
(pa_process_exit, pa_procend): Call it for ELF objects.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-hppa.c114
2 files changed, 76 insertions, 43 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index da4e80b..33a1b96 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+Wed Dec 1 10:41:56 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
+
+ * config/tc-hppa.c (hppa_elf_mark_end_of_function): New function.
+ (pa_process_exit, pa_procend): Call it for ELF objects.
+
Wed Dec 1 12:10:41 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* config/tc-mips.c (macro): Subtract 8 from offset in non PIC l.d
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index 6ee3ac2..095fec9 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -622,7 +622,7 @@ static int log2 PARAMS ((int));
static int pa_next_subseg PARAMS ((sd_chain_struct *));
static unsigned int pa_stringer_aux PARAMS ((char *));
static void pa_spaces_begin PARAMS ((void));
-
+static void hppa_elf_mark_end_of_function PARAMS ((void));
/* File and gloally scoped variable declarations. */
@@ -4624,48 +4624,10 @@ process_exit ()
where = frag_more (0);
#ifdef OBJ_ELF
- /* ELF does not have EXIT relocations. All we do is create a
- temporary symbol marking the end of the function. */
- {
- char *name = (char *) xmalloc (strlen ("L$\001end_") +
- strlen (S_GET_NAME (last_call_info->start_symbol)) + 1);
-
- if (name)
- {
- symbolS *symbolP;
-
- strcpy (name, "L$\001end_");
- strcat (name, S_GET_NAME (last_call_info->start_symbol));
-
- symbolP = symbol_find (name);
- if (symbolP)
- as_warn ("Symbol '%s' already defined.", name);
- else
- {
- /* symbol value should be the offset of the
- last instruction of the function */
- symbolP = symbol_new (name, now_seg,
- (valueT) (obstack_next_free (&frags)
- - frag_now->fr_literal - 4),
- frag_now);
-
- assert (symbolP);
- symbolP->bsym->flags = BSF_LOCAL;
- symbol_table_insert (symbolP);
- }
- if (symbolP)
- last_call_info->end_symbol = symbolP;
- else
- as_bad ("Symbol '%s' could not be created.", name);
-
- }
- else
- as_bad ("No memory for symbol name.");
- }
-
- /* Stuff away the location of the frag for the end of the function,
- and call pa_build_unwind_subspace to add an entry in the unwind
- table. */
+ /* Mark the end of the function, stuff away the location of the frag
+ for the end of the function, and finally call pa_build_unwind_subspace
+ to add an entry in the unwind table. */
+ hppa_elf_mark_end_of_function ();
last_call_info->end_frag = frag_now;
pa_build_unwind_subspace (last_call_info);
#else
@@ -5107,6 +5069,12 @@ pa_procend (unused)
if (within_entry_exit)
as_bad ("Missing .EXIT for a .ENTRY");
+#ifdef OBJ_ELF
+ /* ELF needs to mark the end of each function so that it can compute
+ the size of the function (apparently its needed in the symbol table. */
+ hppa_elf_mark_end_of_function ();
+#endif
+
within_procedure = FALSE;
demand_empty_rest_of_line ();
return;
@@ -6382,6 +6350,66 @@ hppa_force_relocation (fixp)
static symext_chainS *symext_rootP;
static symext_chainS *symext_lastP;
+/* Mark the end of a function so that it's possible to compute
+ the size of the function in hppa_elf_final_processing. */
+
+static void
+hppa_elf_mark_end_of_function ()
+{
+ /* ELF does not have EXIT relocations. All we do is create a
+ temporary symbol marking the end of the function. */
+ char *name = (char *)
+ xmalloc (strlen ("L$\001end_") +
+ strlen (S_GET_NAME (last_call_info->start_symbol)) + 1);
+
+ if (name)
+ {
+ symbolS *symbolP;
+
+ strcpy (name, "L$\001end_");
+ strcat (name, S_GET_NAME (last_call_info->start_symbol));
+
+ /* If we have a .exit followed by a .procend, then the
+ symbol will have already been defined. */
+ symbolP = symbol_find (name);
+ if (symbolP)
+ {
+ /* The symbol has already been defined! This can
+ happen if we have a .exit followed by a .procend.
+
+ This is *not* an error. All we want to do is free
+ the memory we just allocated for the name and continue. */
+ xfree (name);
+ }
+ else
+ {
+ /* symbol value should be the offset of the
+ last instruction of the function */
+ symbolP = symbol_new (name, now_seg,
+ (valueT) (obstack_next_free (&frags)
+ - frag_now->fr_literal - 4),
+ frag_now);
+
+ assert (symbolP);
+ symbolP->bsym->flags = BSF_LOCAL;
+ symbol_table_insert (symbolP);
+ }
+
+ if (symbolP)
+ last_call_info->end_symbol = symbolP;
+ else
+ as_bad ("Symbol '%s' could not be created.", name);
+
+ }
+ else
+ as_bad ("No memory for symbol name.");
+
+ /* Stuff away the location of the frag for the end of the function,
+ and call pa_build_unwind_subspace to add an entry in the unwind
+ table. */
+ last_call_info->end_frag = frag_now;
+}
+
/* Do any symbol processing requested by the target-cpu or target-format. */
void