+2004-09-21  Mark Mitchell  <mark@codesourcery.com>
+
+       * c-decl.c (implicityl_declare): Call maybe_apply_renaming_pragma.
+       (finish_decl): Likewise.
+
 2004-09-21  Devang Patel  <dpatel@apple.com>
 
        * tree.def (VEC_COND_EXPR): New tree node.
 
 {
   struct c_binding *b;
   tree decl = 0;
+  tree asmspec_tree;
+
   for (b = I_SYMBOL_BINDING (functionid); b; b = b->shadowed)
     {
       if (B_IN_SCOPE (b, external_scope))
   TREE_PUBLIC (decl) = 1;
   C_DECL_IMPLICIT (decl) = 1;
   implicit_decl_warning (functionid, 0);
+  asmspec_tree = maybe_apply_renaming_pragma (decl, /*asmname=*/NULL);
+  if (asmspec_tree)
+    set_user_assembler_name (decl, TREE_STRING_POINTER (asmspec_tree));
 
   /* C89 says implicit declarations are in the innermost block.
      So we record the decl in the standard fashion.  */
   const char *asmspec = 0;
 
   /* If a name was specified, get the string.  */
-  if (current_scope == file_scope)
+  if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
+      && DECL_FILE_SCOPE_P (decl))
     asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree);
   if (asmspec_tree)
     asmspec = TREE_STRING_POINTER (asmspec_tree);
 
-       2004-09-17  Matt Austern  <austern@apple.com>
+2004-09-21  Mark Mitchell  <mark@codesourcery.com>
+
+       * gcc.dg/pragma-re-3.c: New test.
+
+2004-09-17  Matt Austern  <austern@apple.com>
 
        PR c++/15049
        * g++.dg/other/anon3.C: New.
 
--- /dev/null
+/* { dg-do link { target *-*-solaris* } } */
+
+#pragma redefine_extname f1 f
+#pragma redefine_extname g1 g
+
+void f() {
+  extern int f1();
+  f1();
+}
+
+void g() {
+  g1();
+}
+
+int main () {
+  f();
+  g();
+}