bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] Re: Multiple definitions of symbol _xalloc_die


From: Simon Josefsson
Subject: [Bug-gnulib] Re: Multiple definitions of symbol _xalloc_die
Date: Fri, 15 Oct 2004 19:34:42 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Simon Josefsson wrote:
>> It seems to me that the Mac OS X linker is too picky.
>
> No, the Mac OS X linker is fine. It's giving errors for violations of ANSI C.
> You have two functions with the same name; this is an error.
>
>> On all other
>> systems, the linker presumably just ignore the xalloc_die inside
>> libshishi when linking libgss.
>
> But on ELF systems, only one of the two functions will be active. I.e.
> an allocation failure in libshishi will call the xalloc_die from libgss.
> You said that this is not what you want.

Yes.  Allocation failures inside libshishi should call the xalloc_die
inside shishi.  I guess I want the linker to resolve the xalloc_die
symbol "internally" within libshishi.

>> solve in some clean way.
>
> The clean way is: You want to have two functions of different behaviour,
> so give them different names. For example, while compiling libshishi,
> add "-Dxalloc_die=shishi_xalloc_die" to the CPPFLAGS, and similarly for
> libgss. At the linker level, the two function names will be different,
> and all is fine.

I guess it would be required when compiling libgnulib inside Shishi as
well, since it would otherwise call xalloc_die anyway.

It would help me understand this better, if you could explain why the
same doesn't apply to, say, xmalloc which is also in both libgss and
libshishi (via gnulib)?  Why isn't the linker complaining that xmalloc
is defined both in libgnulib and libshishi, when creating libgss?

address@hidden:~$ nm -B ~/src/shishi/lib/.libs/libshishi.so|grep -e xalloc_die 
-e xmalloc|grep T
0003066b T xalloc_die
00040112 T xmalloc
address@hidden:~$ nm -B ~/src/gss/lib/.libs/libgss.so|grep -e xalloc_die -e 
xmalloc|grep T
000052e8 T xalloc_die
0000585a T xmalloc
address@hidden:~$

Thanks.




reply via email to

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