Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* cross-target gdb compilation problems
@ 2002-07-01  9:17 Michal Ludvig
  2002-07-01  9:29 ` Andrew Cagney
  2002-07-01 10:52 ` Kevin Buettner
  0 siblings, 2 replies; 5+ messages in thread
From: Michal Ludvig @ 2002-07-01  9:17 UTC (permalink / raw)
  To: gdb

Hi all,
I'm trying to fix cross-target gdb compilation for x86-64 target 
(testing on i386 host). The problem is, that it always fails with:
libgdb.a(solib.o): In function `clear_solib':
/ttt/64/gdb/gdb/solib.c:742: undefined reference to 
`disable_breakpoints_in_shlibs'
libgdb.a(solib-svr4.o): In function `enable_break':
/ttt/64/gdb/gdb/solib-svr4.c:856: undefined reference to 
`remove_solib_event_breakpoints'
/ttt/64/gdb/gdb/solib-svr4.c:983: undefined reference to 
`create_solib_event_breakpoint'
collect2: ld returned 1 exit status
make: *** [gdb] Error 1
while linking gdb binary.

I realised, that many other targets define #include "solib.h" in their 
config/*/tm-*.h files. However x86-64 is a pure multiarch target and 
thus using TM file is not allowed.
When I add '#include "solib.h"' directly to breakpoints.c it compiles 
and links just fine. Also it seems like most targets use it anyway. If 
we would wrap all #defines in solib.h between #ifndef...#endif it would 
remain backward compatible for targets that define their own macros. Or 
am I wrong? Like this:

[solib.h]
+ #ifndef SOLIB_ADD
   #define SOLIB_ADD(filename, from_tty, targ, readsyms) \
       solib_add (filename, from_tty, targ, readsyms)
+ #endif

Or is there another way to solve my compilation problems?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* +420 2 9654 5373   * http://www.suse.cz


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

* Re: cross-target gdb compilation problems
  2002-07-01  9:17 cross-target gdb compilation problems Michal Ludvig
@ 2002-07-01  9:29 ` Andrew Cagney
  2002-07-01 14:16   ` Michal Ludvig
  2002-07-01 10:52 ` Kevin Buettner
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-07-01  9:29 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: gdb

> Hi all,
> I'm trying to fix cross-target gdb compilation for x86-64 target (testing on i386 host). The problem is, that it always fails with:
> libgdb.a(solib.o): In function `clear_solib':
> /ttt/64/gdb/gdb/solib.c:742: undefined reference to `disable_breakpoints_in_shlibs'
> libgdb.a(solib-svr4.o): In function `enable_break':
> /ttt/64/gdb/gdb/solib-svr4.c:856: undefined reference to `remove_solib_event_breakpoints'
> /ttt/64/gdb/gdb/solib-svr4.c:983: undefined reference to `create_solib_event_breakpoint'
> collect2: ld returned 1 exit status
> make: *** [gdb] Error 1
> while linking gdb binary.
> 
> I realised, that many other targets define #include "solib.h" in their config/*/tm-*.h files. However x86-64 is a pure multiarch target and thus using TM file is not allowed.
> When I add '#include "solib.h"' directly to breakpoints.c it compiles and links just fine. Also it seems like most targets use it anyway. If we would wrap all #defines in solib.h between #ifndef...#endif it would remain backward compatible for targets that define their own macros. Or am I wrong? Like this:

Until someone fixes these limitations in the solib code, adding the 
include to the tm*-.h file (and dropping back to multi-arch partial) is 
the accepted way of addressing this problem.

> [solib.h]
> + #ifndef SOLIB_ADD
>   #define SOLIB_ADD(filename, from_tty, targ, readsyms) \
>       solib_add (filename, from_tty, targ, readsyms)
> + #endif
> 
> Or is there another way to solve my compilation problems?

Sigh, yes, someone needs to get down and finish of the solib stuff :-/

enjoy,
Andrew



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

* Re: cross-target gdb compilation problems
  2002-07-01  9:17 cross-target gdb compilation problems Michal Ludvig
  2002-07-01  9:29 ` Andrew Cagney
@ 2002-07-01 10:52 ` Kevin Buettner
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Buettner @ 2002-07-01 10:52 UTC (permalink / raw)
  To: Michal Ludvig, gdb

On Jul 1,  6:17pm, Michal Ludvig wrote:

> When I add '#include "solib.h"' directly to breakpoints.c it compiles 
> and links just fine. Also it seems like most targets use it anyway. If 
> we would wrap all #defines in solib.h between #ifndef...#endif it would 
> remain backward compatible for targets that define their own macros. Or 
> am I wrong?

For targets with shared library support, I think you're right.  I
think there may be problems, however, on targets without shared
library support.  (In breakpoint.c, the SOLIB_ADD macro is being used
as a flag which indicates that the target has shared library support.)

> Like this:
> 
> [solib.h]
> + #ifndef SOLIB_ADD
>    #define SOLIB_ADD(filename, from_tty, targ, readsyms) \
>        solib_add (filename, from_tty, targ, readsyms)
> + #endif
> 
> Or is there another way to solve my compilation problems?

We've had this problem in the past for other pure multiarch targets.
I think we ended up creating (or recreating) a tm-*.h file for these
targets.

Kevin


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

* Re: cross-target gdb compilation problems
  2002-07-01  9:29 ` Andrew Cagney
@ 2002-07-01 14:16   ` Michal Ludvig
  2002-07-01 14:52     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Ludvig @ 2002-07-01 14:16 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

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

Andrew Cagney wrote:
> Until someone fixes these limitations in the solib code, adding the 
> include to the tm*-.h file (and dropping back to multi-arch partial) is 
> the accepted way of addressing this problem.

Well, so can you then aprove the patch attached? Also please try to 
compile gdb with --target=x86_64-unknown-linux and tell me if I can 
remove the "broken" flag from MAINTAINERS if you were successfull.

2002-07-01  Michal Ludvig  <mludvig@suse.cz>

         * config/i386/tm-x86_64linux.h: New.
         * config/i386/x86-64linux.mt: Add GDB_MULTI_ARCH and TM_FILE
         definitions.

Thanks in advance

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* +420 2 9654 5373   * http://www.suse.cz

[-- Attachment #2: tm-solib.diff --]
[-- Type: text/plain, Size: 2351 bytes --]

Index: config/i386/tm-x86_64linux.h
===================================================================
RCS file: config/i386/tm-x86_64linux.h
diff -N config/i386/tm-x86_64linux.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/i386/tm-x86_64linux.h	1 Jul 2002 20:49:46 -0000
***************
*** 0 ****
--- 1,36 ----
+ /* Definitions to target GDB to GNU/Linux on x86-64.
+ 
+    Copyright 2002 Free Software Foundation, Inc.
+ 
+    Contributed by Michal Ludvig, SuSE Labs.
+ 
+    This file is part of GDB.
+ 
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.  */
+ 
+ #ifndef TM_LINUX_H
+ #define TM_LINUX_H
+ 
+ /* We define SVR4_SHARED_LIBS unconditionally, on the assumption that
+  * link.h is available on all linux platforms.  For I386 and SH3/4, 
+  * we hard-code the information rather than use link.h anyway (for 
+  * the benefit of cross-debugging).  We may move to doing that for
+  * other architectures as well.  */
+ 
+ #define SVR4_SHARED_LIBS
+ #include "solib.h"              /* Support for shared libraries. */
+ 
+ #endif /* #ifndef TM_LINUX_H */
Index: config/i386/x86-64linux.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/x86-64linux.mt,v
retrieving revision 1.4
diff -c -3 -p -r1.4 x86-64linux.mt
*** config/i386/x86-64linux.mt	7 Jun 2002 16:11:10 -0000	1.4
--- config/i386/x86-64linux.mt	1 Jul 2002 20:49:46 -0000
***************
*** 1,3 ****
--- 1,7 ----
  # Target: AMD x86-64 running GNU/Linux
  TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o dwarf2cfi.o \
  	solib.o solib-svr4.o solib-legacy.o
+ 
+ GDB_MULTI_ARCH=GDB_MULTI_ARCH_TM
+ 
+ TM_FILE=tm-x86_64linux.h

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

* Re: cross-target gdb compilation problems
  2002-07-01 14:16   ` Michal Ludvig
@ 2002-07-01 14:52     ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-07-01 14:52 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: gdb

> Andrew Cagney wrote:
> Until someone fixes these limitations in the solib code, adding the include to the tm*-.h file (and dropping back to multi-arch partial) is the accepted way of addressing this problem.
> 
> Well, so can you then aprove the patch attached? Also please try to compile gdb with --target=x86_64-unknown-linux and tell me if I can remove the "broken" flag from MAINTAINERS if you were successfull.
> 
> 2002-07-01  Michal Ludvig  <mludvig@suse.cz>
> 
>         * config/i386/tm-x86_64linux.h: New.

Yes, but tm-x86-64linux.h (``-'' vs ``_'').

and

+ #ifndef TM_LINUX_H
+ #define TM_LINUX_H

should be ifndef TM_X86_64LINUX_H.

>         * config/i386/x86-64linux.mt: Add GDB_MULTI_ARCH and TM_FILE
>         definitions.
> 
> Thanks in advance

enjoy,
Andrew



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

end of thread, other threads:[~2002-07-01 21:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-01  9:17 cross-target gdb compilation problems Michal Ludvig
2002-07-01  9:29 ` Andrew Cagney
2002-07-01 14:16   ` Michal Ludvig
2002-07-01 14:52     ` Andrew Cagney
2002-07-01 10:52 ` Kevin Buettner

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