vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Suppose I have an executable foo that was linked against lib1.a, lib2.a and lib3.a at some time in the past. Now there has been a change in, say, lib2.a (but not in either lib1.a or lib3.a) requiring to relink foo. Question: Is there a way to link against lib2.a only? You may ask 'Why would anybody want to do that?' and the answer is quite simple: lib1.a and lib3.a may be huge whereas lib2.a may be tiny, making a total relink rather time consuming (imagine there are some 100 executables to make). So if I could just relink against this tiny lib that could save me a good deal of time. Any suggestions? |
| ||||
| Thorsten Westheider wrote: > Suppose I have an executable foo that was linked against lib1.a, > lib2.a and lib3.a at some time in the past. Now there has been a > change in, say, lib2.a (but not in either lib1.a or lib3.a) requiring > to relink foo. Question: Is there a way to link against lib2.a only? On AIX, yes. Not on other platforms. On AIX, all modules produced by the linker can be used as input to the linker. > You may ask 'Why would anybody want to do that?' Actually, it's not an uncommon question, and quite reasonable. You'll need the interface for the app, if it exports any symbols (dump -HTv), and the libpath in the executable. The rtl_enable -s script might prove useful for this purpose. Anyway, you can replace object code by listing new .o files first on the command line, then list the executable. If you have an archive, you'll need to either extract archive members of interest (ar -xv lib2.a foo.o) or pre-link it into a single .o file (ld -r -o tmp.o lib2.a). Then: ld -o new-exec-file tmp.o old-exec-file -bE:<exports> -lpthread \ -lc ... -blibpath:<libpathfromexecutable> Again, rtl_enable shows this technique, so use the -s option to generate the scripts and study them. -- Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE __________________________________________________ ______________________ |