From fff9ecff94a0142ddb4b888d4a85d757c0c2eab4 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 4 Apr 1993 11:44:08 -0400 Subject: [PATCH] (output_prolog): Need LDGP even for static procedure. From-SVN: r4004 --- gcc/config/alpha/alpha.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 8753126d4d1..f36a60406e6 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -1124,21 +1124,21 @@ output_prolog (file, size) unsigned reg_mask = 0; int i; - /* If we need a GP (we have a LDSYM insn or a CALL_INSN) and we are not - a static function), load it first. */ + /* If we need a GP (we have a LDSYM insn or a CALL_INSN), load it first. + Even if we are a static function, we still need to do this in case + our address is taken and passed to something like qsort. */ alpha_function_needs_gp = 0; - if (TREE_PUBLIC (current_function_decl)) - for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - if ((GET_CODE (insn) == CALL_INSN) - || (GET_RTX_CLASS (GET_CODE (insn)) == 'i' - && GET_CODE (PATTERN (insn)) != USE - && GET_CODE (PATTERN (insn)) != CLOBBER - && get_attr_type (insn) == TYPE_LDSYM)) - { - alpha_function_needs_gp = 1; - break; - } + for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) + if ((GET_CODE (insn) == CALL_INSN) + || (GET_RTX_CLASS (GET_CODE (insn)) == 'i' + && GET_CODE (PATTERN (insn)) != USE + && GET_CODE (PATTERN (insn)) != CLOBBER + && get_attr_type (insn) == TYPE_LDSYM)) + { + alpha_function_needs_gp = 1; + break; + } if (alpha_function_needs_gp) fprintf (file, "\tldgp $29,0($27)\n"); -- 2.30.2