This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: Add xmalloc_failed() to common-utils.c
- From: Pedro Alves <palves at redhat dot com>
- To: Nick Clifton <nickc at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 1 Jun 2016 11:22:09 +0100
- Subject: Re: RFA: Add xmalloc_failed() to common-utils.c
- Authentication-results: sourceware.org; auth=none
- References: <87inxtgtc2 dot fsf at redhat dot com>
On 06/01/2016 10:18 AM, Nick Clifton wrote:
> Hi Guys,
>
> I am finding that GDB currently fails to build because of a problem
> with libiberty and multiple definitions of xmalloc. For example:
>
> % cd arm-eabi
> % make all-gdb
> [...]
> ../libiberty/libiberty.a(xmalloc.o): In function `xmalloc':
> libiberty/xmalloc.c:147: multiple definition of `xmalloc'
> common-utils.o:/work/sources/gcc/current/gdb/common/common-utils.c:41: first defined here
> [...]
>
> Which is strange because the xmalloc functions provided by
> common-utils.c ought to be sufficient. I have traced this down to the
> fact that libiberty's cplus-dem.o file includes an unresolved reference
> to the xmalloc_failed() function. (I am not sure exactly how this
> reference comes about however).
Sounds like you're using a combined gcc+binutils-gdb build?
Our libiberty copy is behind gcc's -- gcc's has a patch that
added a reference to xmalloc_failed to cplus-dem.c:
https://gcc.gnu.org/ml/gcc-patches/2016-04/msg00072.html
So turns out you're preemptively fixing a problem for whoever
merges libiberty next.
> The fix for the problem is, I think, quite straightforward - provide a
> copy of the xmalloc_failed function in common-utils.c. I have tested
> this patch with a variety of different targets (x86, x86_64, arm,
> msp430) and not found any problems or regressions. So...
>
> OK to apply ?
OK.
Thanks,
Pedro Alves