[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] please rename xmalloc

From: Chet Ramey
Subject: Re: [Bug-readline] please rename xmalloc
Date: Thu, 09 Jan 2014 16:56:55 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

On 1/9/14 3:43 PM, Tom Tromey wrote:
>>>>>> "Chet" == Chet Ramey <address@hidden> writes:
>>> Currently gdb provides its own xmalloc in the main executable.  This
>>> overrides the readline xmalloc.  However, while experimenting with
>>> removing gdb's copy in favor of the libiberty xmalloc, I tripped across
>>> the readline copy.  Having gdb use libiberty's fails because then gdb
>>> tries to link against two libraries that each provide their own xmalloc.
> Chet> That's an interesting problem.  Traditional linker behavior would 
> suggest
> Chet> that the first library to provide the symbol wins.
> Sorry, I was incomplete in my note.
> I can dig a bit deeper but I suspect the issue is indeed that the
> readline .o file is picked up by the link -- but then the libiberty .o
> file is picked up as well, because it defines xcalloc, which is also
> used by gdb.
> gdb actually wants a bit more control over the semantics of xmalloc; in
> particular it wants to control what happens on alloc failure.  libiberty
> is easy to hack to let us do this, since it is part of our maintenance
> domain.

Then this suggests that linking with libibterty before libreadline
would solve the problem. But see below...

> Chet> Which version of readline are you using?
> 6.2 is in the tree now.
> Chet> Readline-6.1 provided `xfree' in the same file as xmalloc and
> Chet> xrealloc, and doing so caused the linker to drag in readline's
> Chet> xmalloc.o, resulting in multiple symbol definitions.
> Yeah, this is the case in 6.2 as well.

Not as it was distributed.  If someone did a merge from 6.1 and somehow
left xmalloc.c unmodified, I can see it. However, the version available
for ftp from gnu.org and cwru.edu doesn't have xfree in xmalloc.c (it
moved to xfree.c).

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]