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 with multiple libraries


Hi Gary,

Both libraries are static libraries.

When linking to one static library, it links okay.

When linking to the library, but it requires a second library (also
specified in the 'ld' command), it does not import the function from the
second library, but also does not throw an error/warning.

OK - then this is a bug - the linker should be issuing some kind of error or warning. Please can you provide a small test case that reproduces the problem so that we can investigate.


It sounds like you need to use the --start-group ... --end-group linker command line options to enclose the two libraries on the command line. Have a look at the linker manual for more information.


As an aside, how important is it to prefix library names with 'lib'? I am
using i386-elf-* under Cygwin.

Fairly important but not essential. You could also use -l:<filename> to have the linker treat <filename> as a library, regardless of how <filename> is formatted. Having libraries start with lib and ending with .a is a convention, which makes things easier, but it is not an absolute requirement.


Cheers
  Nick



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