Re: [arm-gnu] GCC library linker problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] GCC library linker problems



Eric Fattah wrote:
I have spent more than three full days trying to debug a library linker problem.
My project has custom start up code, and I must use -nodefaultlibs -nostartfiles, in order to prevent conflicts with automatic startup code. Thus, I need to manually add libraries. I am working within Eclipse and don't have the option of a custom makefile. If I try to use functions such as cos(x) or sprintf(), I get a huge list of unresolved references. I have added every library I am aware of, without success. Below is a dump. Any help would be greatly appreciated.

Many of the missing symbols are in libgcc which you have added but in the wrong place on the command line. If you look in the manual for LD (included in the Code Sourcery distribution) it says the following under option `-lARCHIVE'

     The linker will search an archive only once, at the location where
     it is specified on the command line.  If the archive defines a
     symbol which was undefined in some object which appeared before
     the archive on the command line, the linker will include the
     appropriate file(s) from the archive.  However, an undefined
     symbol in an object appearing later on the command line will not
     cause the linker to search the archive again.

     See the `-(' option for a way to force the linker to search
     archives multiple times.

So put your library options like '-lgcc' before the object files you are linking.

--
Tixy