aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-08-19 12:07:44 +0100
committerPedro Alves <palves@redhat.com>2016-08-19 12:07:44 +0100
commit201506dadd117df72d0528f735e44ce2e68cc66f (patch)
tree781a1a8c0644c9f89363c3c475cb9212714aa891
parent576438f0fa3ecbe0b49b3bcc2f028d586d198247 (diff)
downloadgdb-201506dadd117df72d0528f735e44ce2e68cc66f.zip
gdb-201506dadd117df72d0528f735e44ce2e68cc66f.tar.gz
gdb-201506dadd117df72d0528f735e44ce2e68cc66f.tar.bz2
x32 Fast tracepoints: IPA target descriptions
Building GDB for x32 fails building the IPA, with: .../src/gdb/gdbserver/linux-amd64-ipa.c: In function ‘const target_desc* get_ipa_tdesc(int)’: .../src/gdb/gdbserver/linux-amd64-ipa.c:182:14: error: ‘tdesc_amd64_avx_linux’ was not declared in this scope return tdesc_amd64_avx_linux; ^ .../src/gdb/gdbserver/linux-amd64-ipa.c:184:14: error: ‘tdesc_amd64_mpx_linux’ was not declared in this scope return tdesc_amd64_mpx_linux; ^ .../src/gdb/gdbserver/linux-amd64-ipa.c:186:14: error: ‘tdesc_amd64_avx_mpx_linux’ was not declared in this scope return tdesc_amd64_avx_mpx_linux; ^ [...] The problem is that the IPA is trying to use the 64-bit descriptions, when it should be using the x32 ones. gdb/gdbserver/ChangeLog: 2016-08-19 Pedro Alves <palves@redhat.com> PR gdb/20415 * Makefile.in (x32-linux-ipa.o, x32-avx-linux-ipa.o) (x32-avx512-linux-ipa.o): New rules. * configure.ac (x86_64-*-linux*): New x32 check. * configure.srv (ipa_x32_linux_regobj): New. (x86_64-*-linux*): Use $ipa_x32_linux_regobj if building for x32. * linux-amd64-ipa.c (get_ipa_tdesc) [__ILP32__]: Return x32 descriptions. (initialize_low_tracepoint) [__ILP32__]: Initialize x32 descriptions. * configure: Regenerate.
-rw-r--r--gdb/gdbserver/ChangeLog14
-rw-r--r--gdb/gdbserver/Makefile.in9
-rwxr-xr-xgdb/gdbserver/configure31
-rw-r--r--gdb/gdbserver/configure.ac14
-rw-r--r--gdb/gdbserver/configure.srv8
-rw-r--r--gdb/gdbserver/linux-amd64-ipa.c27
6 files changed, 98 insertions, 5 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 6986714..833075d 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,17 @@
+2016-08-19 Pedro Alves <palves@redhat.com>
+
+ PR gdb/20415
+ * Makefile.in (x32-linux-ipa.o, x32-avx-linux-ipa.o)
+ (x32-avx512-linux-ipa.o): New rules.
+ * configure.ac (x86_64-*-linux*): New x32 check.
+ * configure.srv (ipa_x32_linux_regobj): New.
+ (x86_64-*-linux*): Use $ipa_x32_linux_regobj if building for x32.
+ * linux-amd64-ipa.c (get_ipa_tdesc) [__ILP32__]: Return x32
+ descriptions.
+ (initialize_low_tracepoint) [__ILP32__]: Initialize x32
+ descriptions.
+ * configure: Regenerate.
+
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/18653
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index bed2b1e..f844ab8 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -648,6 +648,15 @@ rsp-low-ipa.o: ../common/rsp-low.c
errors-ipa.o: ../common/errors.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
+x32-linux-ipa.o: x32-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+x32-avx-linux-ipa.o: x32-avx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+x32-avx512-linux-ipa.o: x32-avx512-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
ax.o: ax.c
$(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 889e35b..6b14b52 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -6796,6 +6796,37 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_i386_is_x86_64" >&5
$as_echo "$gdb_cv_i386_is_x86_64" >&6; }
;;
+
+ x86_64-*-linux*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if building for x32" >&5
+$as_echo_n "checking if building for x32... " >&6; }
+if test "${gdb_cv_x86_is_x32+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $CFLAGS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#if __x86_64__ && __ILP32__
+got it
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "got it" >/dev/null 2>&1; then :
+ gdb_cv_x86_is_x32=yes
+else
+ gdb_cv_x86_is_x32=no
+fi
+rm -f conftest*
+
+ CPPFLAGS="$save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_x86_is_x32" >&5
+$as_echo "$gdb_cv_x86_is_x32" >&6; }
+ ;;
+
m68k-*-*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if building for Coldfire" >&5
$as_echo_n "checking if building for Coldfire... " >&6; }
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 627c590..01ec634 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -218,6 +218,20 @@ got it
[gdb_cv_i386_is_x86_64=no])
CPPFLAGS="$save_CPPFLAGS"])
;;
+
+ x86_64-*-linux*)
+ AC_CACHE_CHECK([if building for x32], [gdb_cv_x86_is_x32],
+ [save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $CFLAGS"
+ AC_EGREP_CPP([got it], [
+#if __x86_64__ && __ILP32__
+got it
+#endif
+ ], [gdb_cv_x86_is_x32=yes],
+ [gdb_cv_x86_is_x32=no])
+ CPPFLAGS="$save_CPPFLAGS"])
+ ;;
+
m68k-*-*)
AC_CACHE_CHECK([if building for Coldfire], [gdb_cv_m68k_is_coldfire],
[save_CPPFLAGS="$CPPFLAGS"
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index fe53e03..39e8392 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -31,6 +31,7 @@ srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx512-linux.o amd
ipa_i386_linux_regobj="i386-linux-ipa.o i386-avx-linux-ipa.o i386-avx-mpx-linux-ipa.o i386-avx512-linux-ipa.o i386-mpx-linux-ipa.o i386-mmx-linux-ipa.o"
ipa_amd64_linux_regobj="amd64-linux-ipa.o amd64-avx-linux-ipa.o amd64-avx-mpx-linux-ipa.o amd64-avx512-linux-ipa.o amd64-mpx-linux-ipa.o"
+ipa_x32_linux_regobj="x32-linux-ipa.o x32-avx-linux-ipa.o x32-avx512-linux-ipa.o"
ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o"
srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml i386/32bit-avx512.xml i386/32bit-mpx.xml"
@@ -364,7 +365,12 @@ case "${target}" in
srv_linux_regsets=yes
srv_linux_thread_db=yes
srv_linux_btrace=yes
- ipa_obj="${ipa_amd64_linux_regobj} linux-amd64-ipa.o"
+ if test "$gdb_cv_x86_is_x32" = yes ; then
+ ipa_obj="${ipa_x32_linux_regobj}"
+ else
+ ipa_obj="${ipa_amd64_linux_regobj}"
+ fi
+ ipa_obj="${ipa_obj} linux-amd64-ipa.o"
;;
x86_64-*-mingw*) srv_regobj="$srv_amd64_regobj"
srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
diff --git a/gdb/gdbserver/linux-amd64-ipa.c b/gdb/gdbserver/linux-amd64-ipa.c
index 4997d0e..15d08ff 100644
--- a/gdb/gdbserver/linux-amd64-ipa.c
+++ b/gdb/gdbserver/linux-amd64-ipa.c
@@ -174,6 +174,19 @@ supply_static_tracepoint_registers (struct regcache *regcache,
const struct target_desc *
get_ipa_tdesc (int idx)
{
+#if defined __ILP32__
+ switch (idx)
+ {
+ case X86_TDESC_SSE:
+ return tdesc_x32_linux;
+ case X86_TDESC_AVX:
+ return tdesc_x32_avx_linux;
+ case X86_TDESC_AVX512:
+ return tdesc_x32_avx512_linux;
+ default:
+ break;
+ }
+#else
switch (idx)
{
case X86_TDESC_SSE:
@@ -186,11 +199,11 @@ get_ipa_tdesc (int idx)
return tdesc_amd64_avx_mpx_linux;
case X86_TDESC_AVX512:
return tdesc_amd64_avx512_linux;
- default:
- internal_error (__FILE__, __LINE__,
- "unknown ipa tdesc index: %d", idx);
- return tdesc_amd64_linux;
}
+#endif
+
+ internal_error (__FILE__, __LINE__,
+ "unknown ipa tdesc index: %d", idx);
}
/* Allocate buffer for the jump pads. Since we're using 32-bit jumps
@@ -213,9 +226,15 @@ alloc_jump_pad_buffer (size_t size)
void
initialize_low_tracepoint (void)
{
+#if defined __ILP32__
+ init_registers_x32_linux ();
+ init_registers_x32_avx_linux ();
+ init_registers_x32_avx512_linux ();
+#else
init_registers_amd64_linux ();
init_registers_amd64_avx_linux ();
init_registers_amd64_avx_mpx_linux ();
init_registers_amd64_mpx_linux ();
init_registers_amd64_avx512_linux ();
+#endif
}