This is the mail archive of the binutils@sources.redhat.com 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: Linker script to resolve common symbols.


On Thu, Aug 14, 2003 at 10:56:15AM +0000, Jason Algol wrote:
> Hi there, im investigating a way to "teach" the linker about certain 
> references and how to resolve them
> 
> for example, i have a c program that uses gzread() from zlib, when i 
> compile it i might get a message like
> 
> undefined reference to `gzread'
> 
> would it be possible to edit the linker script to know that if gzread is 
> undefined, libz.a must be added to the list of files to link (this is just 
> an example), so that i wouldnt need to use -lz, but it only links with libz 
> if nescessary.

Write a program that runs ld and scans its output.  Provide some means
for your program to map undefined refs to libs.  On finding an undefined
ref, rerun ld with the extra lib.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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