[gdb] Fix linking on non-x86* (such as s390*) after libgdb.a removal.

Jan Kratochvil jankratochvil at fedoraproject.org
Thu Jan 5 13:45:06 UTC 2012


commit 2f2930eb780c0f38a24e62e0667d6c7fd294fa41
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Thu Jan 5 14:44:59 2012 +0100

    Fix linking on non-x86* (such as s390*) after libgdb.a removal.

 gdb-archer.patch            |   93 +----------
 gdb-build-libgdb-1of3.patch |  123 ++++++++++++++
 gdb-build-libgdb-2of3.patch |  370 +++++++++++++++++++++++++++++++++++++++++++
 gdb-build-libgdb-3of3.patch |   63 ++++++++
 gdb.spec                    |   14 ++-
 5 files changed, 577 insertions(+), 86 deletions(-)
---
diff --git a/gdb-archer.patch b/gdb-archer.patch
index 804fa25..edee7ca 100644
--- a/gdb-archer.patch
+++ b/gdb-archer.patch
@@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
 http://sourceware.org/gdb/wiki/ArcherBranchManagement
 
 GIT snapshot:
-commit 8cc17242e1d8f61a4aabc9e08e4272e8dbe77e52
+commit 9d032ca6bf6de39c55d99ffc09056683c7a6498b
 
 branch `archer' - the merge of branches:
 archer-jankratochvil-vla
@@ -8514,91 +8514,14 @@ index 9bfebd2..44aeaae 100644
    char *pkt;
    struct breakpoint *b = loc->owner;
 diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
-index 6381675..883620c 100644
+index 6381675..0c2ea24 100644
 --- a/gdb/s390-nat.c
 +++ b/gdb/s390-nat.c
-@@ -438,11 +438,36 @@ struct watch_area
-   CORE_ADDR hi_addr;
- };
- 
--static struct watch_area *watch_base = NULL;
-+/* Per-inferior data key.  */
-+
-+struct s390_inferior_data
-+  {
-+    struct watch_area *watch_base;
-+  };
-+
-+static struct s390_inferior_data *
-+s390_inferior_data_get (void)
-+{
-+  /* Intermediate patch stub.  */
-+  static struct i386_inferior_data inf_data_local;
-+  struct inferior *inf = current_inferior ();
-+  struct i386_inferior_data *inf_data = &inf_data_local;
-+
-+  return inf->pid == ptid_get_pid (inferior_ptid) ? inf_data : NULL;
-+}
-+
-+static struct watch_area *
-+s390_watch_base_get (void)
-+{
-+  struct s390_inferior_data *inferior_data = s390_inferior_data_get ();
-+
-+  return inferior_data ? inferior_data->watch_base : NULL;
-+}
- 
- static int
- s390_stopped_by_watchpoint (void)
- {
-+  struct watch_area *watch_base = s390_watch_base_get ();
-   per_lowcore_bits per_lowcore;
-   ptrace_area parea;
-   int result;
-@@ -471,9 +496,13 @@ s390_stopped_by_watchpoint (void)
-   return result;
- }
- 
-+/* Update hardware registers of this specific LP.  LP must belong to
-+   CURRENT_INFERIOR.  */
-+
- static void
- s390_fix_watch_points (struct lwp_info *lp)
- {
-+  struct watch_area *watch_base;
-   int tid;
- 
-   per_struct per_info;
-@@ -482,9 +511,20 @@ s390_fix_watch_points (struct lwp_info *lp)
-   CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0;
-   struct watch_area *area;
- 
--  tid = TIDGET (lp->ptid);
--  if (tid == 0)
--    tid = PIDGET (lp->ptid);
-+  gdb_assert (lp == NULL || current_inferior ()->pid == PIDGET (lp->ptid));
-+
-+  if (lp == NULL)
-+    {
-+      tid = PIDGET (inferior_ptid);
-+      watch_base = NULL;
-+    }
-+  else
-+    {
-+      tid = TIDGET (lp->ptid);
-+      if (tid == 0)
-+	tid = PIDGET (lp->ptid);
-+      watch_base = s390_watch_base_get ();
-+    }
- 
-   for (area = watch_base; area; area = area->next)
-     {
-@@ -515,6 +555,18 @@ s390_fix_watch_points (struct lwp_info *lp)
+@@ -515,6 +515,17 @@ s390_fix_watch_points (struct lwp_info *lp)
      perror_with_name (_("Couldn't modify watchpoint status"));
  }
  
-+/* Callback for linux_nat_iterate_watchpoint_lwps,
-+   to call s390_fix_watch_points.  */
++/* Callback for iterate_over_lwps, to call s390_fix_watch_points.  */
 +
 +static int
 +s390_fix_watch_points_iterate (struct lwp_info *lp, void *arg)
@@ -8612,24 +8535,24 @@ index 6381675..883620c 100644
  static int
  s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
  			struct expression *cond)
-@@ -531,8 +583,8 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
+@@ -531,8 +542,8 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
    area->next = watch_base;
    watch_base = area;
  
 -  ALL_LWPS (lp)
 -    s390_fix_watch_points (lp);
-+  linux_nat_iterate_watchpoint_lwps (s390_fix_watch_points_iterate, NULL);
++  iterate_over_lwps (minus_one_ptid, s390_fix_watch_points_iterate, NULL);
 +
    return 0;
  }
  
-@@ -559,8 +611,8 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
+@@ -559,8 +570,8 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
    *parea = area->next;
    xfree (area);
  
 -  ALL_LWPS (lp)
 -    s390_fix_watch_points (lp);
-+  linux_nat_iterate_watchpoint_lwps (s390_fix_watch_points_iterate, NULL);
++  iterate_over_lwps (minus_one_ptid, s390_fix_watch_points_iterate, NULL);
 +
    return 0;
  }
diff --git a/gdb-build-libgdb-1of3.patch b/gdb-build-libgdb-1of3.patch
new file mode 100644
index 0000000..6f879c0
--- /dev/null
+++ b/gdb-build-libgdb-1of3.patch
@@ -0,0 +1,123 @@
+http://sourceware.org/ml/gdb-patches/2012-01/msg00168.html
+Subject: [patch 1/2] Fix linking on non-x86* after libgdb.a removal
+
+Hi,
+
+I am sorry but I found after the patch
+	[patch 2/2] Do not build libgdb.a by default
+	http://sourceware.org/ml/gdb-patches/2011-12/msg00716.html
+
+For example s390x-linux-gnu no longer builds native GDB:
+	corelow.o:(.bss+0x0): multiple definition of `core_gdbarch'
+	corelow.o:(.bss+0x0): first defined here
+	corelow.o: In function `deprecated_add_core_fns':
+	corelow.c:(.text+0x0): multiple definition of `deprecated_add_core_fns'
+	corelow.o:corelow.c:(.text+0x0): first defined here
+
+I have found more such duplicates:
+
+solib.o is clear, that one is now in COMMON_OBS.  BTW it seems this change
+broke functionality of xcoffsolib.c due to:
+powerpc-*-aix* | rs6000-*-*)
+                        gdb_host=aix ;;
+as xcoffsolib.c probably cannot work with solib.c together but that is offtopic
+here, I do not have access+interest in AIX.
+
+xcoffread.o is also clear, powerpc/aix.mh NATDEPFILES get used only together
+with configure.tgt entry for the same target which is:
+powerpc-*-aix* | rs6000-*-*)
+        # Target: PowerPC running AIX
+        gdb_target_obs="rs6000-tdep.o rs6000-aix-tdep.o xcoffread.o \
+                        ppc-sysv-tdep.o solib-svr4.o"
+
+There remains that more complicated corelow.o for the next patch.
+
+gdbtui was bigger performance hit than libgdb.a but after libgdb.a got removed
+I do not want to revert that patch as this duplicity fix does not look hard.
+
+
+Sorry,
+Jan
+
+
+2012-01-04  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Partially fix duplicate .o files after omitting libbfd.a.
+	* config/alpha/alpha-osf3.mh (NATDEPFILES): Remove solib.o.
+	* config/i386/nbsdaout.mh (NATDEPFILES): Remove solib.o.
+	* config/i386/obsdaout.mh (NATDEPFILES): Remove solib.o.
+	* config/m68k/nbsdaout.mh (NATDEPFILES): Remove solib.o.
+	* config/m68k/obsd.mh (NATDEPFILES): Remove solib.o.
+	* config/powerpc/aix.mh (NATDEPFILES): Remove xcoffread.o.
+	* config/vax/nbsdaout.mh (NATDEPFILES): Remove solib.o.
+
+--- a/gdb/config/alpha/alpha-osf3.mh
++++ b/gdb/config/alpha/alpha-osf3.mh
+@@ -1,6 +1,6 @@
+ # Host: Little-endian Alpha running OSF/1-3.x and higher using procfs
+ NAT_FILE= nm-osf3.h
+ NATDEPFILES= corelow.o alpha-nat.o fork-child.o \
+-	solib-osf.o solib.o procfs.o proc-api.o proc-events.o proc-flags.o \
++	solib-osf.o procfs.o proc-api.o proc-events.o proc-flags.o \
+ 	proc-why.o dec-thread.o
+ NAT_CLIBS= -lpthreaddebug
+--- a/gdb/config/i386/nbsdaout.mh
++++ b/gdb/config/i386/nbsdaout.mh
+@@ -1,6 +1,6 @@
+ # Host: NetBSD/i386 a.out
+ NATDEPFILES= fork-child.o inf-ptrace.o \
+ 	nbsd-nat.o i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o \
+-	solib.o solib-sunos.o
++	solib-sunos.o
+ 
+ LOADLIBES= -lkvm
+--- a/gdb/config/i386/obsdaout.mh
++++ b/gdb/config/i386/obsdaout.mh
+@@ -1,6 +1,6 @@
+ # Host: OpenBSD/i386 a.out
+ NATDEPFILES= fork-child.o inf-ptrace.o \
+ 	i386bsd-nat.o i386nbsd-nat.o i386obsd-nat.o bsd-kvm.o \
+-	solib.o solib-sunos.o
++	solib-sunos.o
+ 
+ LOADLIBES= -lkvm
+--- a/gdb/config/m68k/nbsdaout.mh
++++ b/gdb/config/m68k/nbsdaout.mh
+@@ -1,5 +1,5 @@
+ # Host: NetBSD/m68k a.out
+ NATDEPFILES= m68kbsd-nat.o fork-child.o inf-ptrace.o \
+-	solib.o solib-sunos.o
++	solib-sunos.o
+ 
+ LOADLIBES= -lkvm
+--- a/gdb/config/m68k/obsd.mh
++++ b/gdb/config/m68k/obsd.mh
+@@ -1,5 +1,5 @@
+ # Host: OpenBSD/m68k
+ NATDEPFILES= m68kbsd-nat.o bsd-kvm.o fork-child.o inf-ptrace.o \
+-	solib.o solib-sunos.o
++	solib-sunos.o
+ 
+ LOADLIBES= -lkvm
+--- a/gdb/config/powerpc/aix.mh
++++ b/gdb/config/powerpc/aix.mh
+@@ -4,7 +4,7 @@ NAT_FILE= config/rs6000/nm-rs6000.h
+ 
+ # aix-thread.o is not listed in NATDEPFILES as it is pulled in by configure.
+ NATDEPFILES= fork-child.o inf-ptrace.o corelow.o rs6000-nat.o \
+-	     xcoffread.o xcoffsolib.o
++	     xcoffsolib.o
+ 
+ # When compiled with cc, for debugging, this argument should be passed.
+ # We have no idea who our current compiler is though, so we skip it.
+--- a/gdb/config/vax/nbsdaout.mh
++++ b/gdb/config/vax/nbsdaout.mh
+@@ -1,6 +1,6 @@
+ # Host: NetBSD/vax a.out
+ NATDEPFILES= fork-child.o inf-ptrace.o \
+ 	vaxbsd-nat.o bsd-kvm.o \
+-	solib.o solib-sunos.o
++	solib-sunos.o
+ 
+ LOADLIBES= -lkvm
+
diff --git a/gdb-build-libgdb-2of3.patch b/gdb-build-libgdb-2of3.patch
new file mode 100644
index 0000000..e634a89
--- /dev/null
+++ b/gdb-build-libgdb-2of3.patch
@@ -0,0 +1,370 @@
+http://sourceware.org/ml/gdb-patches/2012-01/msg00170.html
+Subject: [patch 2/2] Fix linking on non-x86* after libgdb.a removal
+
+Hi,
+
+this is the second part for solving corelow after the s390x regression:
+	[patch 2/2] Do not build libgdb.a by default
+	http://sourceware.org/ml/gdb-patches/2011-12/msg00716.html
+->
+	corelow.o:(.bss+0x0): multiple definition of `core_gdbarch'
+	corelow.o:(.bss+0x0): first defined here
+	corelow.o: In function `deprecated_add_core_fns':
+	corelow.c:(.text+0x0): multiple definition of `deprecated_add_core_fns'
+	corelow.o:corelow.c:(.text+0x0): first defined here
+
+
+For targets using new set_gdbarch_regset_from_core_section it would not be
+a problem, just put corelow.o into the right entry of gdb/configure.tgt.
+
+But for legacy targets still using deprecated_add_core_fns (like
+sparc-solaris2.6 etc.) the addition to gdb/configure.tgt would enable
+corelow.o even for cross-targeted GDBs where there is unfortunately still no
+core files support.
+
+Created the original configuration, just avoiding a duplicate corelow.o entry.
+A better idea is welcome.
+
+(s390x not available now for a test but it should work I hope.)
+
+
+Sorry,
+Jan
+
+
+2012-01-04  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Fix duplicate .o files after omitting libbfd.a.
+	* Makefile.in (CORELOW_O): New definition.
+	(ALL_TARGET_OBS): Remove corelow.o.
+	(DEPFILES): Add $(CORELOW_O).
+	* config/alpha/alpha-linux.mh (NATDEPFILES): Remove corelow.o.
+	(CORELOW_O): New definition.
+	* config/alpha/alpha-osf3.mh: Likewise.
+	* config/alpha/fbsd.mh: Likewise.
+	* config/arm/nbsdaout.mh: Likewise.
+	* config/arm/nbsdelf.mh: Likewise.
+	* config/i386/i386gnu.mh: Likewise.
+	* config/ia64/hpux.mh: Likewise.
+	* config/ia64/linux.mh: Likewise.
+	* config/m32r/linux.mh: Likewise.
+	* config/m68k/linux.mh: Likewise.
+	* config/mips/irix5.mh: Likewise.
+	* config/mips/irix6.mh: Likewise.
+	* config/pa/hpux.mh: Likewise.
+	* config/pa/linux.mh: Likewise.
+	* config/powerpc/aix.mh: Likewise.
+	* config/s390/s390.mh: Likewise.
+	* config/sparc/linux.mh: Likewise.
+	* config/sparc/linux64.mh: Likewise.
+	* config/sparc/sol2.mh: Likewise.
+	* config/vax/vax.mh: Likewise.
+	* configure: Regenerate.
+	* configure.ac (CORELOW_O): New variable.
+	(gdb_target_obs): Exclude corelow.o and set CORELOW_O instead.
+	(all_targets): Set CORELOW_O.
+	(CORELOW_O): AC_SUBST it.
+
+--- a/gdb/Makefile.in
++++ b/gdb/Makefile.in
+@@ -512,6 +512,12 @@ SIM_OBS = @SIM_OBS@
+ # Target-dependent object files.
+ TARGET_OBS = @TARGET_OBS@
+ 
++# corelow.o may be requested by either config/*/*.mh file or for ALL_TARGET_OBS
++# or for specific target(s) from configure.tgt.  Avoid duplicating it.
++# CORELOW_O may get overriden (set to corelow.o) by 'host_makefile_frag' below.
++# CORELOW_O is assumed to be corelow.o for ALL_TARGET_OBS.
++CORELOW_O := @CORELOW_O@
++
+ # All target-dependent objects files that require 64-bit CORE_ADDR
+ # (used with --enable-targets=all --enable-64-bit-bfd).
+ ALL_64_TARGET_OBS = \
+@@ -581,7 +587,6 @@ ALL_TARGET_OBS = \
+ 	remote-m32r-sdi.o remote-mips.o \
+ 	xcoffread.o \
+ 	symfile-mem.o \
+-	corelow.o \
+ 	windows-tdep.o \
+ 	linux-record.o
+ 
+@@ -843,7 +848,7 @@ REMOTE_EXAMPLES = m68k-stub.c i386-stub.c sparc-stub.c rem-multi.shar
+ # variables analogous to SER_HARDWIRE which get defaulted in this
+ # Makefile.in
+ 
+-DEPFILES = $(TARGET_OBS) $(SER_HARDWIRE) $(NATDEPFILES) \
++DEPFILES = $(TARGET_OBS) $(SER_HARDWIRE) $(NATDEPFILES) $(CORELOW_O) \
+ 	   $(REMOTE_OBS) $(SIM_OBS)
+ 
+ SOURCES = $(SFILES) $(ALLDEPFILES) $(YYFILES) $(CONFIG_SRCS)
+--- a/gdb/config/alpha/alpha-linux.mh
++++ b/gdb/config/alpha/alpha-linux.mh
+@@ -1,8 +1,9 @@
+ # Host: Little-endian Alpha running Linux
+ NAT_FILE= config/nm-linux.h
+-NATDEPFILES= inf-ptrace.o corelow.o alpha-linux-nat.o \
++NATDEPFILES= inf-ptrace.o alpha-linux-nat.o \
+ 	fork-child.o proc-service.o linux-thread-db.o \
+ 	linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ 
+ # The dynamically loaded libthread_db needs access to symbols in the
+--- a/gdb/config/alpha/alpha-osf3.mh
++++ b/gdb/config/alpha/alpha-osf3.mh
+@@ -1,6 +1,7 @@
+ # Host: Little-endian Alpha running OSF/1-3.x and higher using procfs
+ NAT_FILE= nm-osf3.h
+-NATDEPFILES= corelow.o alpha-nat.o fork-child.o \
++NATDEPFILES= alpha-nat.o fork-child.o \
+ 	solib-osf.o procfs.o proc-api.o proc-events.o proc-flags.o \
+ 	proc-why.o dec-thread.o
++CORELOW_O := corelow.o
+ NAT_CLIBS= -lpthreaddebug
+--- a/gdb/config/alpha/fbsd.mh
++++ b/gdb/config/alpha/fbsd.mh
+@@ -1,6 +1,7 @@
+ # Host: FreeBSD/alpha
+ NATDEPFILES= fork-child.o inf-ptrace.o \
+ 	fbsd-nat.o alphabsd-nat.o bsd-kvm.o \
+-	corelow.o core-regset.o
++	core-regset.o
++CORELOW_O := corelow.o
+ 
+ LOADLIBES= -lkvm
+--- a/gdb/config/arm/nbsdaout.mh
++++ b/gdb/config/arm/nbsdaout.mh
+@@ -1,3 +1,4 @@
+ # Host: NetBSD/arm
+-NATDEPFILES= fork-child.o inf-ptrace.o corelow.o armnbsd-nat.o \
++NATDEPFILES= fork-child.o inf-ptrace.o armnbsd-nat.o \
+ 	solib-sunos.o
++CORELOW_O := corelow.o
+--- a/gdb/config/arm/nbsdelf.mh
++++ b/gdb/config/arm/nbsdelf.mh
+@@ -1,2 +1,3 @@
+ # Host: NetBSD/arm
+-NATDEPFILES= fork-child.o inf-ptrace.o corelow.o armnbsd-nat.o
++NATDEPFILES= fork-child.o inf-ptrace.o armnbsd-nat.o
++CORELOW_O := corelow.o
+--- a/gdb/config/i386/i386gnu.mh
++++ b/gdb/config/i386/i386gnu.mh
+@@ -1,7 +1,8 @@
+ # Host: Intel 386 running the GNU Hurd
+-NATDEPFILES= i386gnu-nat.o gnu-nat.o corelow.o core-regset.o fork-child.o \
++NATDEPFILES= i386gnu-nat.o gnu-nat.o core-regset.o fork-child.o \
+ 	     notify_S.o process_reply_S.o msg_reply_S.o \
+ 	     msg_U.o exc_request_U.o exc_request_S.o
++CORELOW_O := corelow.o
+ 
+ NAT_FILE= nm-i386gnu.h
+ MH_CFLAGS = -D_GNU_SOURCE
+--- a/gdb/config/ia64/hpux.mh
++++ b/gdb/config/ia64/hpux.mh
+@@ -1,3 +1,4 @@
+ # Host: ia64 running HP-UX
+-NATDEPFILES= fork-child.o inf-ttrace.o corelow.o ia64-hpux-nat.o \
++NATDEPFILES= fork-child.o inf-ttrace.o ia64-hpux-nat.o \
+         solib-ia64-hpux.o
++CORELOW_O := corelow.o
+--- a/gdb/config/ia64/linux.mh
++++ b/gdb/config/ia64/linux.mh
+@@ -1,11 +1,12 @@
+ # Host: Intel IA-64 running GNU/Linux
+ 
+ NAT_FILE= config/nm-linux.h
+-NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
++NATDEPFILES= inf-ptrace.o fork-child.o \
+ 	core-regset.o ia64-linux-nat.o \
+ 	proc-service.o linux-thread-db.o \
+ 	linux-nat.o linux-osdata.o linux-fork.o \
+ 	linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ 
+ LOADLIBES = -ldl $(RDYNAMIC)
+--- a/gdb/config/m32r/linux.mh
++++ b/gdb/config/m32r/linux.mh
+@@ -1,9 +1,10 @@
+ # Host: M32R based machine running GNU/Linux
+ 
+ NAT_FILE= config/nm-linux.h
+-NATDEPFILES= inf-ptrace.o fork-child.o corelow.o	\
++NATDEPFILES= inf-ptrace.o fork-child.o				\
+ 	m32r-linux-nat.o proc-service.o linux-thread-db.o	\
+ 	linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ 
+ LOADLIBES= -ldl $(RDYNAMIC)
+--- a/gdb/config/m68k/linux.mh
++++ b/gdb/config/m68k/linux.mh
+@@ -2,9 +2,10 @@
+ 
+ NAT_FILE= config/nm-linux.h
+ NATDEPFILES= inf-ptrace.o fork-child.o \
+-	corelow.o m68klinux-nat.o \
++	m68klinux-nat.o \
+ 	proc-service.o linux-thread-db.o \
+ 	linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ 
+ # The dynamically loaded libthread_db needs access to symbols in the
+--- a/gdb/config/mips/irix5.mh
++++ b/gdb/config/mips/irix5.mh
+@@ -1,3 +1,4 @@
+ # Host: SGI Iris running irix 5.x
+-NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \
++NATDEPFILES= fork-child.o irix5-nat.o procfs.o \
+ 	proc-api.o proc-events.o proc-flags.o proc-why.o
++CORELOW_O := corelow.o
+--- a/gdb/config/mips/irix6.mh
++++ b/gdb/config/mips/irix6.mh
+@@ -1,3 +1,4 @@
+ # Host: SGI Iris running irix 6.x
+-NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \
++NATDEPFILES= fork-child.o irix5-nat.o procfs.o \
+ 	proc-api.o proc-events.o proc-flags.o proc-why.o
++CORELOW_O := corelow.o
+--- a/gdb/config/pa/hpux.mh
++++ b/gdb/config/pa/hpux.mh
+@@ -1,3 +1,4 @@
+ # Host: PA-RISC HP-UX
+ NATDEPFILES= fork-child.o inf-ptrace.o inf-ttrace.o \
+-	hppa-hpux-nat.o corelow.o somread.o
++	hppa-hpux-nat.o somread.o
++CORELOW_O := corelow.o
+--- a/gdb/config/pa/linux.mh
++++ b/gdb/config/pa/linux.mh
+@@ -1,9 +1,10 @@
+ # Host: Hewlett-Packard PA-RISC machine, running Linux
+ NAT_FILE= config/nm-linux.h
+-NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
++NATDEPFILES= inf-ptrace.o fork-child.o \
+ 	hppa-linux-nat.o proc-service.o linux-thread-db.o \
+ 	linux-nat.o linux-osdata.o linux-fork.o \
+ 	linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ 
+ LOADLIBES = -ldl $(RDYNAMIC)
+--- a/gdb/config/powerpc/aix.mh
++++ b/gdb/config/powerpc/aix.mh
+@@ -3,8 +3,9 @@
+ NAT_FILE= config/rs6000/nm-rs6000.h
+ 
+ # aix-thread.o is not listed in NATDEPFILES as it is pulled in by configure.
+-NATDEPFILES= fork-child.o inf-ptrace.o corelow.o rs6000-nat.o \
++NATDEPFILES= fork-child.o inf-ptrace.o rs6000-nat.o \
+ 	     xcoffsolib.o
++CORELOW_O := corelow.o
+ 
+ # When compiled with cc, for debugging, this argument should be passed.
+ # We have no idea who our current compiler is though, so we skip it.
+--- a/gdb/config/s390/s390.mh
++++ b/gdb/config/s390/s390.mh
+@@ -1,7 +1,8 @@
+ # Host: S390, running Linux
+ NAT_FILE= config/nm-linux.h
+-NATDEPFILES= inf-ptrace.o fork-child.o corelow.o s390-nat.o \
++NATDEPFILES= inf-ptrace.o fork-child.o s390-nat.o \
+ 	linux-thread-db.o proc-service.o \
+ 	linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ LOADLIBES = -ldl $(RDYNAMIC)
+--- a/gdb/config/sparc/linux.mh
++++ b/gdb/config/sparc/linux.mh
+@@ -1,10 +1,11 @@
+ # Host: GNU/Linux SPARC
+ NAT_FILE= config/nm-linux.h
+ NATDEPFILES= sparc-nat.o sparc-linux-nat.o \
+-	corelow.o core-regset.o fork-child.o inf-ptrace.o \
++	core-regset.o fork-child.o inf-ptrace.o \
+ 	proc-service.o linux-thread-db.o \
+ 	linux-nat.o linux-osdata.o linux-fork.o \
+ 	linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ 
+ # The dynamically loaded libthread_db needs access to symbols in the
+--- a/gdb/config/sparc/linux64.mh
++++ b/gdb/config/sparc/linux64.mh
+@@ -1,11 +1,12 @@
+ # Host: GNU/Linux UltraSPARC
+ NAT_FILE= config/nm-linux.h
+ NATDEPFILES= sparc-nat.o sparc64-nat.o sparc64-linux-nat.o \
+-	corelow.o core-regset.o \
++	core-regset.o \
+ 	fork-child.o inf-ptrace.o \
+ 	proc-service.o linux-thread-db.o \
+ 	linux-nat.o linux-osdata.o linux-fork.o \
+ 	linux-procfs.o
++CORELOW_O := corelow.o
+ NAT_CDEPS = $(srcdir)/proc-service.list
+ 
+ # The dynamically loaded libthread_db needs access to symbols in the
+--- a/gdb/config/sparc/sol2.mh
++++ b/gdb/config/sparc/sol2.mh
+@@ -1,5 +1,6 @@
+ # Host: Solaris SPARC & UltraSPARC
+ NAT_FILE= nm-sol2.h
+ NATDEPFILES= sparc-sol2-nat.o \
+-	corelow.o core-regset.o fork-child.o \
++	core-regset.o fork-child.o \
+ 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
++CORELOW_O := corelow.o
+--- a/gdb/config/vax/vax.mh
++++ b/gdb/config/vax/vax.mh
+@@ -1,2 +1,3 @@
+ # Host: VAX running 4.2BSD or Ultrix
+-NATDEPFILES= vax-nat.o fork-child.o inf-ptrace.o corelow.o
++NATDEPFILES= vax-nat.o fork-child.o inf-ptrace.o
++CORELOW_O := corelow.o
+--- a/gdb/configure.ac
++++ b/gdb/configure.ac
+@@ -174,6 +174,7 @@ fi
+ # Accumulate some settings from configure.tgt over all enabled targets
+ 
+ TARGET_OBS=
++CORELOW_O=
+ all_targets=
+ 
+ for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
+@@ -196,12 +197,16 @@ do
+ 
+     # Target-specific object files
+     for i in ${gdb_target_obs}; do
+-        case " $TARGET_OBS " in
+-        *" ${i} "*) ;;
+-        *)
+-          TARGET_OBS="$TARGET_OBS ${i}"
+-          ;;
+-        esac
++        if test "$i" = corelow.o; then
++            CORELOW_O=corelow.o
++        else
++            case " $TARGET_OBS " in
++            *" ${i} "*) ;;
++            *)
++              TARGET_OBS="$TARGET_OBS ${i}"
++              ;;
++            esac
++        fi
+     done
+ 
+     # Check whether this target needs 64-bit CORE_ADDR
+@@ -233,9 +238,11 @@ if test x${all_targets} = xtrue; then
+   else
+     TARGET_OBS='$(ALL_TARGET_OBS)'
+   fi
++  CORELOW_O=corelow.o
+ fi
+ 
+ AC_SUBST(TARGET_OBS)
++AC_SUBST(CORELOW_O)
+ 
+ # For other settings, only the main target counts.
+ gdb_sim=
+
diff --git a/gdb-build-libgdb-3of3.patch b/gdb-build-libgdb-3of3.patch
new file mode 100644
index 0000000..52b83ef
--- /dev/null
+++ b/gdb-build-libgdb-3of3.patch
@@ -0,0 +1,63 @@
+--- gdb-7.4.50.20120103/gdb/configure.orig	2012-01-05 10:23:09.251299043 +0100
++++ gdb-7.4.50.20120103/gdb/configure	2012-01-05 10:23:29.921225968 +0100
+@@ -682,6 +682,7 @@ LN_S
+ REPORT_BUGS_TEXI
+ REPORT_BUGS_TO
+ PKGVERSION
++CORELOW_O
+ TARGET_OBS
+ subdirs
+ RPM_LIBS
+@@ -8504,6 +8505,7 @@ fi
+ # Accumulate some settings from configure.tgt over all enabled targets
+ 
+ TARGET_OBS=
++CORELOW_O=
+ all_targets=
+ 
+ for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
+@@ -8527,12 +8529,16 @@ fi
+ 
+     # Target-specific object files
+     for i in ${gdb_target_obs}; do
+-        case " $TARGET_OBS " in
+-        *" ${i} "*) ;;
+-        *)
+-          TARGET_OBS="$TARGET_OBS ${i}"
+-          ;;
+-        esac
++        if test "$i" = corelow.o; then
++            CORELOW_O=corelow.o
++        else
++            case " $TARGET_OBS " in
++            *" ${i} "*) ;;
++            *)
++              TARGET_OBS="$TARGET_OBS ${i}"
++              ;;
++            esac
++        fi
+     done
+ 
+     # Check whether this target needs 64-bit CORE_ADDR
+@@ -8597,10 +8603,12 @@ _ACEOF
+   else
+     TARGET_OBS='$(ALL_TARGET_OBS)'
+   fi
++  CORELOW_O=corelow.o
+ fi
+ 
+ 
+ 
++
+ # For other settings, only the main target counts.
+ gdb_sim=
+ gdb_osabi=
+@@ -12153,7 +12161,7 @@ for ac_header in nlist.h machine/reg.h p
+ 		  sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
+ 		  sys/types.h sys/wait.h wait.h termios.h termio.h \
+ 		  sgtty.h unistd.h elf_hp.h ctype.h time.h locale.h \
+-                  dlfcn.h
++		  dlfcn.h
+ do :
+   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/gdb.spec b/gdb.spec
index 2bad477..1a37063 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -27,7 +27,7 @@ Version: 7.4.50.20120103
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 3%{?_with_upstream:.upstream}%{?dist}
+Release: 4%{?_with_upstream:.upstream}%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
 Group: Development/Debuggers
@@ -520,6 +520,12 @@ Patch634: gdb-runtest-pie-override.patch
 #=push
 Patch638: gdb-gcc47-gcore-zero.patch
 
+# Fix linking on non-x86* (such as s390*) after libgdb.a removal.
+#=push
+Patch639: gdb-build-libgdb-1of3.patch
+Patch640: gdb-build-libgdb-2of3.patch
+Patch641: gdb-build-libgdb-3of3.patch
+
 BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
 # --without-system-readline
 # Requires: readline%{?_isa}
@@ -782,6 +788,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch627 -p1
 %patch634 -p1
 %patch638 -p1
+%patch639 -p1
+%patch640 -p1
+%patch641 -p1
 
 %patch393 -p1
 %patch335 -p1
@@ -1197,6 +1206,9 @@ fi
 %{_infodir}/gdb.info*
 
 %changelog
+* Thu Jan  5 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.4.50.20120103-4.fc17
+- Fix linking on non-x86* (such as s390*) after libgdb.a removal.
+
 * Wed Jan  4 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.4.50.20120103-3.fc17
 - Reinclude gdb-dlopen-stap-probe.patch (missing in Fedora glibc - BZ 752476).
 


More information about the scm-commits mailing list