From: "Peter O'Gorman" <gdb-patches@mlists.thewrittenword.com>
To: gdb-patches@sourceware.org
Subject: minor portability patches
Date: Tue, 21 Sep 2010 19:59:00 -0000 [thread overview]
Message-ID: <20100921164814.GC32745@tw.local> (raw)
[-- Attachment #1: Type: text/plain, Size: 789 bytes --]
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
[-- Attachment #2: 0001-Do-not-use-__FUNCTION__.patch --]
[-- Type: text/plain, Size: 2576 bytes --]
From 1c413972833ee2547579c9d4a7acc1db612abb14 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <pogma@thewrittenword.com>
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
[-- Attachment #3: 0002-Allow-build-to-succeed-on-AIX-6.1.patch --]
[-- Type: text/plain, Size: 2052 bytes --]
From aa5b6559bd80cdf2c161c1341878876061bdf606 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <pogma@thewrittenword.com>
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
[-- Attachment #4: 0003-Don-t-use-rdynamic-by-default-for-non-gcc.patch --]
[-- Type: text/plain, Size: 843 bytes --]
From 2ec438d72fe8e7f33b316055cd42219f43d530bd Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <pogma@thewrittenword.com>
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
[-- Attachment #5: 0004-Don-t-return-from-void-functions.patch --]
[-- Type: text/plain, Size: 1102 bytes --]
From b91aa4ae16fd861188ba3a57a135c4a3119544ff Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <pogma@thewrittenword.com>
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
[-- Attachment #6: 0005-IRIX-6.5-needs-lpthread.patch --]
[-- Type: text/plain, Size: 684 bytes --]
From 204e9e17f0216156c29a3265755440e3b59a7e48 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <pogma@thewrittenword.com>
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
[-- Attachment #7: 0006-Initialize-cplus_struct_default-portably.patch --]
[-- Type: text/plain, Size: 811 bytes --]
From cd219062f4383084a5054d8ac1ad3f18eed8773d Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <pogma@thewrittenword.com>
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
next reply other threads:[~2010-09-21 16:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-21 19:59 Peter O'Gorman [this message]
2010-09-21 20:06 ` Tom Tromey
2010-09-21 20:40 ` Joel Brobecker
2010-09-21 20:50 ` Peter O'Gorman
2010-09-21 21:56 ` Joel Brobecker
2010-09-21 21:09 ` Peter O'Gorman
2010-09-22 16:15 ` Doug Evans
2010-09-23 22:03 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100921164814.GC32745@tw.local \
--to=gdb-patches@mlists.thewrittenword.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox