diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a34758c0ffeeb375b88273124411830c10c2f45b..4fbf790c01675ccc8e74a7b0283fd7205809f544 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+	PR target/16459
+	* pa.c (output_indirect_call): Use %r2 as the link register when
+	calling $$dyncall with a pc-relative branch.
+
 2004-07-08  Gerald Pfeifer  <gerald@pfeifer.com>
 
 	* doc/install.texi (Binaries): Mention OpenPKG.
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index cf7da9c1faa0d84d692829a650314b780834b5e5..da065ce6dec07b0c8d5bbae57e1670ff8e5eb588 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -7545,7 +7545,7 @@ output_indirect_call (rtx insn, rtx call_dest)
      No need to check target flags as the length uniquely identifies
      the remaining cases.  */
   if (attr_length_indirect_call (insn) == 8)
-    return ".CALL\tARGW0=GR\n\t{bl|b,l} $$dyncall,%%r31\n\tcopy %%r31,%%r2";
+    return ".CALL\tARGW0=GR\n\t{bl|b,l} $$dyncall,%%r2\n\tcopy %%r2,%%r31";
 
   /* Long millicode call, but we are not generating PIC or portable runtime
      code.  */