Fix PR sim/13418: building with --enable-targets=all fails
authorPedro Alves <palves@redhat.com>
Tue, 5 Jan 2016 11:03:40 +0000 (11:03 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 5 Jan 2016 11:03:40 +0000 (11:03 +0000)
Multitarget builds currently fail when:

 (1) simulator support is enabled (the main --target supports target sim)
 (2) powerpc is included in the --enable-targets list
 (3) powerpc is not the main/default target (--target)

This is because the powerpc sim provides a non-standard API function
sim_spr_register_name which gdb/rs6000-tdep.c utilizes.  Since the sim
does not yet support multitarget, only the sim (if one exists) for the
main target is built.  When that target isn't powerpc, this function
is not available leading to linking errors:

rs6000-tdep.c:(.text+0x1e34d): undefined reference to
`sim_spr_register_name'

Fix this by only using that API if the sim linked in is the powerpc
sim.

gdb/ChangeLog:
2016-01-05  Pedro Alves  <palves@redhat.com>

PR sim/13418
* configure.ac: Define WITH_PPC_SIM when linking in the sim and
the target is powerpc*.
* configure: Regenerate.
* config.in: Regenerate.

gdb/ChangeLog
gdb/config.in
gdb/configure
gdb/configure.ac
gdb/rs6000-tdep.c

index 3d8923bc45767c53eddadab3422e60e7e8d6e04d..b10aa04eeb91e91a06673d1bbc60ed59634c9225 100644 (file)
@@ -1,3 +1,11 @@
+2016-01-05  Pedro Alves  <palves@redhat.com>
+
+       PR sim/13418
+       * configure.ac: Define WITH_PPC_SIM when linking in the sim and
+       the target is powerpc*.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+
 2016-01-04  Markus Metzger  <markus.t.metzger@intel.com>
 
        * btrace.c (btrace_pt_readmem_callback): Do not return in TRY/CATCH.
index ccc0098fd01a0de00af94ebf4449ca1cd1d02dca..6196fa0052640ea55f4fcd18f510032a3d42cfeb 100644 (file)
    when building for Cygwin. */
 #undef USE_WIN32API
 
+/* Define if the PPC simulator is being linked in. */
+#undef WITH_PPC_SIM
+
 /* Define if --with-python provides a path, either directly or via
    python-config.py --exec-prefix. */
 #undef WITH_PYTHON_PATH
index 5afdbbc0f44fed903705571a436cb556ad430bb7..15383d6ff91e4a9280b6ed2b47c962bdcb37e81a 100755 (executable)
@@ -15846,6 +15846,16 @@ if test "${ignore_sim}" = "false"; then
 
 $as_echo "#define WITH_SIM 1" >>confdefs.h
 
+
+    # Some tdep code should only be compiled in when the ppc sim is
+    # built.  PR sim/13418.
+    case $target in
+      powerpc*-*-*)
+
+$as_echo "#define WITH_PPC_SIM 1" >>confdefs.h
+
+       ;;
+    esac
   fi
 fi
 
index 5b618c97f9acae22e1af2e9ea72ac4cd11c43d3a..d1026406a63c898dc4cdfd86d8a4fac391135ff7 100644 (file)
@@ -2260,6 +2260,14 @@ if test "${ignore_sim}" = "false"; then
     SIM="${gdb_sim}"
     SIM_OBS="remote-sim.o"
     AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.])
+
+    # Some tdep code should only be compiled in when the ppc sim is
+    # built.  PR sim/13418.
+    case $target in
+      powerpc*-*-*)
+       AC_DEFINE(WITH_PPC_SIM, 1, [Define if the PPC simulator is being linked in.])
+       ;;
+    esac
   fi
 fi
 AC_SUBST(SIM)
index 47b0749dcd2c0b1708f8f48a259fe816b9726f54..599b0768a9a64976b6e3346c02c05d3fa56ba5f1 100644 (file)
@@ -328,7 +328,7 @@ init_sim_regno_table (struct gdbarch *arch)
     set_sim_regno (sim_regno, tdep->ppc_acc_regnum, sim_ppc_acc_regnum);
   /* spefscr is a special-purpose register, so the code below handles it.  */
 
-#ifdef WITH_SIM
+#ifdef WITH_PPC_SIM
   /* Now handle all special-purpose registers.  Verify that they
      haven't mistakenly been assigned numbers by any of the above
      code.  */