From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25048 invoked by alias); 21 Sep 2010 16:48:36 -0000 Received: (qmail 25032 invoked by uid 22791); 21 Sep 2010 16:48:32 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,TW_CP,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail1.thewrittenword.com (HELO mail1.thewrittenword.com) (69.67.212.77) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Sep 2010 16:48:25 +0000 Received: from mail1.il.thewrittenword.com (emma-internal-gw.il.thewrittenword.com [192.168.13.25]) by mail1.thewrittenword.com (Postfix) with ESMTP id B76E25CC2 for ; Tue, 21 Sep 2010 17:07:49 +0000 (UTC) Received: from tw.local (unknown [192.168.1.254]) by mail1.il.thewrittenword.com (Postfix) with ESMTP id E0291796 for ; Tue, 21 Sep 2010 16:48:22 +0000 (UTC) Received: from tw.local (tw.local [127.0.0.1]) by tw.local (8.14.4/8.14.4) with ESMTP id o8LGmHKt030037 for ; Tue, 21 Sep 2010 11:48:17 -0500 Received: (from pogma@localhost) by tw.local (8.14.4/8.14.4/Submit) id o8LGmGkj030035 for gdb-patches@sourceware.org; Tue, 21 Sep 2010 11:48:16 -0500 Date: Tue, 21 Sep 2010 19:59:00 -0000 From: "Peter O'Gorman" To: gdb-patches@sourceware.org Subject: minor portability patches Message-ID: <20100921164814.GC32745@tw.local> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00350.txt.bz2 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 789 Hi, We just built gdb-7.2 and had a couple of minor issues. Patches attached, some I am less sure about than others. When we build --with-python, IRIX 6.5 needed -lpthread, I don't know if this is the correct place to add that though. __FUNCTION__ is a gccism. AIX 6.1 does prototype getthrds in /usr/include/procinfo.h, though not identically to gdb's prototype, it has these: extern int getthrds( pid_t, void *, int, tid_t *, int ); extern int getthrds64( pid_t, void *, int, tid64_t *, int ); Also avoid some warnings on AIX about ptrace32's third argument. -rdynamic was being added regardless, causing link failures on multiple platforms. At least solaris cc complained about returning from void functions. Thanks, Peter -- Peter O'Gorman pogma@thewrittenword.com --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Do-not-use-__FUNCTION__.patch" Content-length: 2577 >From 1c413972833ee2547579c9d4a7acc1db612abb14 Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Tue, 21 Sep 2010 11:32:22 -0500 Subject: [PATCH 1/6] Do not use __FUNCTION__ Helps gdb to build with non-gcc compilers. --- bfd/elf32-i386.c | 4 ++-- bfd/elf64-x86-64.c | 4 ++-- bfd/elfxx-sparc.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 7a426d5..ef1f849 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1408,7 +1408,7 @@ elf_i386_check_relocs (bfd *abfd, (_("%B: relocation %s against STT_GNU_IFUNC " "symbol `%s' isn't handled by %s"), abfd, elf_howto_table[r_type].name, - name, __FUNCTION__); + name, "elf_i386_check_relocs"); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -3056,7 +3056,7 @@ elf_i386_relocate_section (bfd *output_bfd, (_("%B: relocation %s against STT_GNU_IFUNC " "symbol `%s' isn't handled by %s"), input_bfd, elf_howto_table[r_type].name, - name, __FUNCTION__); + name, "elf_i386_relocate_section"); bfd_set_error (bfd_error_bad_value); return FALSE; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 9da73a1..76520a1 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1194,7 +1194,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, (_("%B: relocation %s against STT_GNU_IFUNC " "symbol `%s' isn't handled by %s"), abfd, x86_64_elf_howto_table[r_type].name, - name, __FUNCTION__); + name, "elf_x86_64_check_relocs"); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -2768,7 +2768,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, (_("%B: relocation %s against STT_GNU_IFUNC " "symbol `%s' isn't handled by %s"), input_bfd, x86_64_elf_howto_table[r_type].name, - name, __FUNCTION__); + name, "elf_x86_64_relocate_section"); bfd_set_error (bfd_error_bad_value); return FALSE; diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 58b1890..db7f511 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -3079,7 +3079,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, (_("%B: relocation %s against STT_GNU_IFUNC " "symbol `%s' isn't handled by %s"), input_bfd, _bfd_sparc_elf_howto_table[r_type].name, - name, __FUNCTION__); + name, "_bfd_sparc_elf_relocate_section"); bfd_set_error (bfd_error_bad_value); return FALSE; } -- 1.7.0.1 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0002-Allow-build-to-succeed-on-AIX-6.1.patch" Content-length: 2053 >From aa5b6559bd80cdf2c161c1341878876061bdf606 Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Tue, 21 Sep 2010 11:24:35 -0500 Subject: [PATCH 2/6] Allow build to succeed on AIX 6.1 getthrds is prototyped on aix 6.1 (and probably later) The third argument to ptrace32 is an int* --- gdb/aix-thread.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index cbdb099..01a276c 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -349,7 +349,7 @@ pdc_read_regs (pthdb_user_t user, } else { - if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL)) + if (!ptrace32 (PTT_READ_GPRS, tid, (int*)gprs32, 0, NULL)) memset (gprs32, 0, sizeof (gprs32)); memcpy (context->gpr, gprs32, sizeof(gprs32)); } @@ -647,9 +647,12 @@ get_signaled_thread (void) pthdb_tid_t ktid = 0; int result = 0; - /* getthrds(3) isn't prototyped in any AIX 4.3.3 #include file. */ + /* getthrds(3) isn't prototyped in any AIX 4.3.3 #include file. + but is in AIX 6.1 (and later?) */ +#ifndef _AIX61 extern int getthrds (pid_t, struct thrdsinfo64 *, int, pthdb_tid_t *, int); +#endif while (1) { @@ -1238,7 +1241,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, } else { - if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL)) + if (!ptrace32 (PTT_READ_GPRS, tid, (int*)gprs32, 0, NULL)) memset (gprs32, 0, sizeof (gprs32)); for (i = 0; i < ppc_num_gprs; i++) supply_reg32 (regcache, tdep->ppc_gp0_regnum + i, gprs32[i]); @@ -1557,9 +1560,9 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, else { /* Pre-fetch: some regs may not be in the cache. */ - ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL); + ptrace32 (PTT_READ_GPRS, tid, (int*)gprs32, 0, NULL); fill_gprs32 (regcache, gprs32); - ptrace32 (PTT_WRITE_GPRS, tid, gprs32, 0, NULL); + ptrace32 (PTT_WRITE_GPRS, tid, (int*)gprs32, 0, NULL); } } -- 1.7.0.1 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0003-Don-t-use-rdynamic-by-default-for-non-gcc.patch" Content-length: 844 >From 2ec438d72fe8e7f33b316055cd42219f43d530bd Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Tue, 21 Sep 2010 11:26:47 -0500 Subject: [PATCH 3/6] Don't use -rdynamic by default for non-gcc -rdynamic breaks non-gcc build. --- gdb/configure.ac | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/configure.ac b/gdb/configure.ac index 2f8090e..0e84c0f 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1496,8 +1496,13 @@ if $dynamic_list; then found="-Wl,--dynamic-list" RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list' else - found="-rdynamic" - RDYNAMIC="-rdynamic" + if test "$GCC" = "yes"; then + found="-rdynamic" + RDYNAMIC="-rdynamic" + else + found=none + RDYNAMIC= + fi fi AC_SUBST(RDYNAMIC) AC_MSG_RESULT($found) -- 1.7.0.1 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0004-Don-t-return-from-void-functions.patch" Content-length: 1103 >From b91aa4ae16fd861188ba3a57a135c4a3119544ff Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Tue, 21 Sep 2010 11:34:17 -0500 Subject: [PATCH 4/6] Don't return from void functions. Helps with solaris cc --- gdb/dwarf2loc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index b2aecf2..47ab667 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -260,7 +260,7 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset) { struct dwarf_expr_baton *debaton = ctx->baton; - return per_cu_dwarf_call (ctx, die_offset, debaton->per_cu); + per_cu_dwarf_call (ctx, die_offset, debaton->per_cu); } struct piece_closure @@ -1070,7 +1070,7 @@ needs_frame_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset) { struct needs_frame_baton *nf_baton = ctx->baton; - return per_cu_dwarf_call (ctx, die_offset, nf_baton->per_cu); + per_cu_dwarf_call (ctx, die_offset, nf_baton->per_cu); } /* Return non-zero iff the location expression at DATA (length SIZE) -- 1.7.0.1 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0005-IRIX-6.5-needs-lpthread.patch" Content-length: 685 >From 204e9e17f0216156c29a3265755440e3b59a7e48 Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Tue, 21 Sep 2010 11:28:15 -0500 Subject: [PATCH 5/6] IRIX 6.5 needs -lpthread At least when building -with-python --- gdb/config/mips/irix6.mh | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gdb/config/mips/irix6.mh b/gdb/config/mips/irix6.mh index de212b2..6f57035 100644 --- 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 \ proc-api.o proc-events.o proc-flags.o proc-why.o +NAT_CLIBS= -lpthread -- 1.7.0.1 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0006-Initialize-cplus_struct_default-portably.patch" Content-length: 812 >From cd219062f4383084a5054d8ac1ad3f18eed8773d Mon Sep 17 00:00:00 2001 From: Peter O'Gorman Date: Tue, 21 Sep 2010 11:35:48 -0500 Subject: [PATCH 6/6] Initialize cplus_struct_default portably. Helps with IRIX 6.5's MIPSpro compiler --- gdb/gdbtypes.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c35adbb..a813f22 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1732,7 +1732,7 @@ check_stub_method_group (struct type *type, int method_id) } /* Ensure it is in .rodata (if available) by workarounding GCC PR 44690. */ -const struct cplus_struct_type cplus_struct_default = { }; +const struct cplus_struct_type cplus_struct_default = {0}; void allocate_cplus_struct_type (struct type *type) -- 1.7.0.1 --G4iJoqBmSsgzjUCe--