This moves the core_bfd global to be a field of the program space.  It
then replaces core_bfd with a macro to avoid a massive patch -- the
same approach taken for various other program space fields.
This is a basic transformation for multi-target work.
2018-05-11  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <tromey@redhat.com>
	* corefile.c (core_bfd): Remove.
	* gdbcore.h (core_bfd): Now a macro.
	* progspace.h (struct program_space) <cbfd>: New field.
+2018-05-11  Tom Tromey  <tromey@redhat.com>
+           Pedro Alves  <tromey@redhat.com>
+
+       * corefile.c (core_bfd): Remove.
+       * gdbcore.h (core_bfd): Now a macro.
+       * progspace.h (struct program_space) <cbfd>: New field.
+
 2018-05-11  Tom Tromey  <tom@tromey.com>
 
        * mdebugread.c (parse_partial_symbols, psymtab_to_symtab_1): Use
 
                                                   hooks.  */
 static int exec_file_hook_count = 0;           /* Size of array.  */
 
-/* Binary file diddling handle for the core file.  */
-
-bfd *core_bfd = NULL;
-
 \f
 
 /* Backward compatability with old way of specifying core files.  */
 
 
 /* Binary File Diddler for the core file.  */
 
-extern bfd *core_bfd;
+#define core_bfd (current_program_space->cbfd)
 
 /* corelow.c target.  It is never NULL after GDB initialization.  */
 
 
      It needs to be freed by xfree.  It is not NULL iff EBFD is not NULL.  */
   char *pspace_exec_filename = NULL;
 
+  /* Binary file diddling handle for the core file.  */
+  bfd *cbfd = NULL;
+
   /* The address space attached to this program space.  More than one
      program space may be bound to the same address space.  In the
      traditional unix-like debugging scenario, this will usually