Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* x86-64 gdbserver config
@ 2009-11-02 12:51 Nathan Sidwell
  2009-11-02 23:08 ` Joel Brobecker
  2009-11-03  3:55 ` Daniel Jacobowitz
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Sidwell @ 2009-11-02 12:51 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

This patch allows building an x86-64 gdbserver for a multilibbed 
i686-pc-linux-gnu target.  One cannot tell from the target triplet that x86-64 
source files are needed -- one must invoke the compiler and examine the 
__x86_64__ #define.  For instance, the CC_FOR_TARGET may be 'my-gcc -m64'.

built and tested for an m64 multilib of an i686-pc-linux-gnu target.  ok?

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery


[-- Attachment #2: x86-64.patch --]
[-- Type: text/x-patch, Size: 2307 bytes --]

2009-10-30  Nathan Sidwell  <nathan@codesourcery.com>

	* configure.ac (i[34567]86-*): Check if we're targetting x86-64
	with an i686 compiler.
	* configure.srv (i[34567]86-*-linux*): Pull in x86-64 handling if
	needed.
	* configure: Rebuilt.

Index: configure
===================================================================
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.28
diff -c -3 -p -r1.28 configure.ac
*** configure.ac	29 Oct 2009 17:43:44 -0000	1.28
--- configure.ac	2 Nov 2009 12:44:11 -0000
*************** ACX_BUGURL([http://www.gnu.org/software/
*** 73,78 ****
--- 73,97 ----
  AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
  AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
  
+ # Check for various supplementary target information (beyond the
+ # triplet) which might affect the choices in configure.srv.
+ case "${target}" in
+ changequote(,)dnl
+   i[34567]86-*-linux*)
+ changequote([,])dnl
+     AC_CACHE_CHECK([if building for x86-64], [gdb_cv_i386_is_x86_64],
+       	           [save_CPPFLAGS="$CPPFLAGS"
+                     CPPFLAGS="$CPPFLAGS $CFLAGS"
+                     AC_EGREP_CPP([got it], [
+ #if __x86_64__
+ got it
+ #endif
+                  ], [gdb_cv_i386_is_x86_64=yes],
+                     [gdb_cv_i386_is_x86_64=no])
+                     CPPFLAGS="$save_CPPFLAGS"])
+     ;;
+ esac
+ 
  . ${srcdir}/configure.srv
  
  if test "${srv_mingwce}" = "yes"; then
Index: configure.srv
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.srv,v
retrieving revision 1.46
diff -c -3 -p -r1.46 configure.srv
*** configure.srv	31 Jul 2009 15:23:20 -0000	1.46
--- configure.srv	2 Nov 2009 12:44:11 -0000
*************** case "${target}" in
*** 64,69 ****
--- 64,72 ----
  			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
  			;;
    i[34567]86-*-linux*)	srv_regobj=reg-i386-linux.o
+ 			if test "$gdb_cv_i386_is_x86_64" = yes ; then
+ 			    srv_regobj="reg-x86-64-linux.o $srv_regobj"
+ 			fi
  			srv_tgtobj="linux-low.o linux-x86-low.o i386-low.o i387-fp.o"
  			srv_linux_usrregs=yes
  			srv_linux_regsets=yes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86-64 gdbserver config
  2009-11-02 12:51 x86-64 gdbserver config Nathan Sidwell
@ 2009-11-02 23:08 ` Joel Brobecker
  2009-11-03  2:37   ` Daniel Jacobowitz
  2009-11-03  3:55 ` Daniel Jacobowitz
  1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2009-11-02 23:08 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: gdb-patches

Hello Nathan,

> This patch allows building an x86-64 gdbserver for a multilibbed  
> i686-pc-linux-gnu target.  One cannot tell from the target triplet that 
> x86-64 source files are needed -- one must invoke the compiler and 
> examine the __x86_64__ #define.  For instance, the CC_FOR_TARGET may be 
> 'my-gcc -m64'.

I am trying to understand the situation under which this patch would
be used. Is it when using a cross compiler or can it be when using
a native compiler? Or both?

I'm a little confused, because I was under the impression that the target
was either specified using configure --target=, or deduced using
"config.guess".  Either way, I would have thought that the user is
responsible for configuring gdbserver as needed.

This is something that we do already when building GDB for sparc64.
However, I just noticed today that on pc/solaris, config.guess actually
returns different values dependending on whether our GCC was configured
as i386-sun-solaris2.8 or x86_64-sun-solaris2.8... I don't think the
same sort of trick is really applicable to GNU/Linux, though.

Anyway, just trying to think aloud for now...

-- 
Joel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86-64 gdbserver config
  2009-11-02 23:08 ` Joel Brobecker
@ 2009-11-03  2:37   ` Daniel Jacobowitz
  2009-11-03  3:39     ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2009-11-03  2:37 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Nathan Sidwell, gdb-patches

On Mon, Nov 02, 2009 at 03:08:40PM -0800, Joel Brobecker wrote:
> I am trying to understand the situation under which this patch would
> be used. Is it when using a cross compiler or can it be when using
> a native compiler? Or both?

Either.  It's not too uncommon in my experience to build a
64-bit-capable toolchain as i686-linux-gnu or i686-solaris2.10.
At least for Debian, we did this to avoid having to change the triplet
inappropriately when 32-bit systems were still supported.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86-64 gdbserver config
  2009-11-03  2:37   ` Daniel Jacobowitz
@ 2009-11-03  3:39     ` Joel Brobecker
  0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2009-11-03  3:39 UTC (permalink / raw)
  To: Nathan Sidwell, gdb-patches

> Either.  It's not too uncommon in my experience to build a
> 64-bit-capable toolchain as i686-linux-gnu or i686-solaris2.10.
> At least for Debian, we did this to avoid having to change the triplet
> inappropriately when 32-bit systems were still supported.

I see, I didn't know that, thanks! I have no objection, and I can have
a look at the patch if you neither you nor Pedro have already done so.

-- 
Joel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: x86-64 gdbserver config
  2009-11-02 12:51 x86-64 gdbserver config Nathan Sidwell
  2009-11-02 23:08 ` Joel Brobecker
@ 2009-11-03  3:55 ` Daniel Jacobowitz
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2009-11-03  3:55 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: gdb-patches

On Mon, Nov 02, 2009 at 12:50:59PM +0000, Nathan Sidwell wrote:
> This patch allows building an x86-64 gdbserver for a multilibbed
> i686-pc-linux-gnu target.  One cannot tell from the target triplet
> that x86-64 source files are needed -- one must invoke the compiler
> and examine the __x86_64__ #define.  For instance, the CC_FOR_TARGET
> may be 'my-gcc -m64'.
> 
> built and tested for an m64 multilib of an i686-pc-linux-gnu target.  ok?

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-03  3:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-02 12:51 x86-64 gdbserver config Nathan Sidwell
2009-11-02 23:08 ` Joel Brobecker
2009-11-03  2:37   ` Daniel Jacobowitz
2009-11-03  3:39     ` Joel Brobecker
2009-11-03  3:55 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox