exporting archieve library symbols to the executable

Guy Wolfovitz gwolfovi@study.haifa.ac.il
Tue Jan 15 05:55:00 GMT 2002


Hello,

I have got three files: main.c, func.c and shared.c;
I compile main.c to an object file, func.c to an archive library and
shared.c to an shared library.

I then compile link main.o and func.a into an executable (a.out).

Now, main.o performs dynamic loading of shared.sl;
shared.sl uses a function F() defined and implemented at func.c;
However, main.c does not reffer to F(), which again, is defined at func.c;

Therefore, the symbol for F() does not shows at the symbol table of a.out
(using nm utility);

I thought at first to use the -E flag to ld, but this just exports symbols
that already are defined at a.out to any shared library that is linked
with the executable .. (( please correct me if I'm wrong here.. ));

Well then, my question would be, can I make the symbol F() be seen in the
a.out symbol table without explicitly calling (using) F() from within
main()? 

I know that on HP11.00 there is a switch to ld that makes this happen :
+forceload; Is there perhaps a similiar flag that I have missed, for gld?
Or perhaps there are other dirty tricks to do the job done?



Thanks. 
-guy.



More information about the Binutils mailing list