aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2003-12-11 20:47:10 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2003-12-11 20:47:10 +0000
commit7ac88634ad7825b671a22dfd9bbbadc8264b8175 (patch)
tree0fb40284d492ea6eeaafe3d4b63d24947d0c5941 /gcc
parent1ec7a83137275efef6050bb652ac57af2ce05f8e (diff)
downloadgcc-7ac88634ad7825b671a22dfd9bbbadc8264b8175.zip
gcc-7ac88634ad7825b671a22dfd9bbbadc8264b8175.tar.gz
gcc-7ac88634ad7825b671a22dfd9bbbadc8264b8175.tar.bz2
mips.c (mips_global_pointer): Force functions with a nonlocal goto to set up $gp.
* config/mips/mips.c (mips_global_pointer): Force functions with a nonlocal goto to set up $gp. From-SVN: r74547
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/mips/mips.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e05d2af..746a76c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-11 Richard Sandiford <rsandifo@redhat.com>
+
+ * config/mips/mips.c (mips_global_pointer): Force functions with
+ a nonlocal goto to set up $gp.
+
2003-12-11 James E Wilson <wilson@specifixinc.com>
PR target/13132
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 3a05443..d5d230c 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -6052,6 +6052,11 @@ mips_global_pointer (void)
if (current_function_profile)
return GLOBAL_POINTER_REGNUM;
+ /* If the function has a nonlocal goto, $gp must hold the correct
+ global pointer for the target function. */
+ if (current_function_has_nonlocal_goto)
+ return GLOBAL_POINTER_REGNUM;
+
/* If the gp is never referenced, there's no need to initialize it.
Note that reload can sometimes introduce constant pool references
into a function that otherwise didn't need them. For example,