+2018-05-02  Pedro Alves  <palves@redhat.com>
+
+       * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Don't call
+       procfs_target/add_target here.
+       * procfs.c (procfs_target): Make static.
+       (_initialize_procfs): Call add_target here.
+       * procfs.h (struct target_ops): Remove forward declaration.
+       (procfs_target): Remove declaration.
+       * sparc-sol2-nat.c (_initialize_sparc_sol2_nat): Delete.
+
 2018-05-02  Pedro Alves  <palves@redhat.com>
 
        * procfs.c (procfs_stopped_by_watchpoint)
 
 void
 _initialize_amd64_sol2_nat (void)
 {
-  struct target_ops *t;
-
-  /* Fill in the generic procfs methods.  */
-  t = procfs_target ();
-
 #if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
   amd64_native_gregset32_reg_offset = amd64_sol2_gregset32_reg_offset;
   amd64_native_gregset32_num_regs =
   amd64_native_gregset64_num_regs =
     ARRAY_SIZE (amd64_sol2_gregset64_reg_offset);
 #endif
-
-  add_target (t);
 }
 
 }
 #endif
 
-struct target_ops *
+/* Create a procfs target.  */
+
+static struct target_ops *
 procfs_target (void)
 {
   struct target_ops *t = inf_child_target ();
           _("Cancel a trace of entries into the syscall."));
   add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd,
           _("Cancel a trace of exits from the syscall."));
+
+  add_target (procfs_target ());
 }
 
 /* =================== END, GDB  "MODULE" =================== */
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-struct target_ops;
-
-/* Create a prototype generic procfs target.  The client can override
-   it with local methods.  */
-
-extern struct target_ops *procfs_target (void);
-
 /* Return a ptid for which we guarantee we will be able to find a
    'live' procinfo.  */
 
 
 {
   sparc_collect_fpregset (&sparc_sol2_fpregmap, regcache, regnum, fpregs);
 }
-
-void
-_initialize_sparc_sol2_nat (void)
-{
-  struct target_ops *t;
-
-  t = procfs_target ();
-  add_target (t);
-}