This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linking error


Hi Ian,Rohit

   Thanks for the replies...

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.
>
> Ian
  From the map file I have observed that it is only being refered from
libc.a library
   .text          0x00124128       0x1c
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o)
                0x00124128                fstat
 .text          0x001262d0       0x20
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
                0x001262e0                _fstat

I dont understand why my linker is still linking fstat function in
liblocal.a. Please find all the refences to fstat related functions in
map file...

      /bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)

/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fseek.o)
(_fstat_r)

/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
(errno)
  /bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o)

/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-ldpart.o)
(fstat)
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)

/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
(_fstat)
 .text          0x001121a8       0x3c
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
                0x001121a8                _fstat_r
 .text          0x00124128       0x1c
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o)
                0x00124128                fstat
 .text          0x001262d0       0x20
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
                0x001262e0                _fstat
 .data          0x00174a2c        0x0
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
 .data          0x00174f34        0x0
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o)
 .data          0x00174f34        0x0
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .bss           0x00174fe8        0x0
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
 .bss           0x00175138        0x0
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o)
 .bss           0x00175138        0x0
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
                0x001802cf       0x43
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
                0x00181fdc       0x43
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o)
                0x001821e2       0x31
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .debug_info    0x0000322f      0x274
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .debug_abbrev  0x00000c64       0xbe
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .debug_loc     0x00000800       0x26
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
                0x00000260       0x20
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .debug_line    0x000014ed       0xef
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .debug_str     0x00000d78       0xd8
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .comment       0x00000000       0x31
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)
 .debug_frame   0x0000ccb0       0x2c
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-fstatr.o)
 .debug_frame   0x0000e6e0       0x20
/bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o)
 .debug_frame   0x0000e838       0x30
../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o)

Thanks,
Nagaraju


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]