This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Linking error
naga raj <gnuuser.raj@gmail.com> writes:
> On Fri, Jun 15, 2012 at 8:51 PM, Ian Lance Taylor <iant@google.com> wrote:
>> naga raj <gnuuser.raj@gmail.com> writes:
>>
>>>>> ../../empty_cpp_bsp_0/lib/liblocal.a(close.o): In function `close':
>>>>> /proj/empty_cpp_bsp_0//libsrc/src/close.c:50: multiple definition of `close'
>>>>> /bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysclose.o):sysclose.c:(.text+0x0):
>>>>> first defined here
>>
>>
>>> ÂFrom map file I found that close() function is called from libc of
>>> toolchain and not from my local library. I dont know why it is still
>>> refering close in local library.
>>
>> Something is causing both liblocal.a(close.o) and
>> libc.a(lib_a-sysclose.o) to be included. ÂThe map file should tell for
>> each object why it was pulled in to the link.
>>
> From the map file I have observed that it is only being refered from
> libc.a library
The top of the map file lists, for each object included from an archive,
why that object was included. The section is headed
"Archive member included because of file (symbol)"
That is where you need to look.
I don't know why you are looking at fstat, earlier you said the problem
was with close.
> /bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
I think you left out the next line, which would tell you which symbol
caused libc_a-fstartr.o to be included in the link.
Ian