c - What is Partial Linking in GNU Linker? -
the best explanation able find official document:
-r --relocateable generate relocatable output--i.e., generate output file can in turn serve input ld. called partial linking. side effect, in environments support standard unix magic numbers, option sets output file's magic number omagic. if option not specified, absolute file produced. when linking c++ programs, option not resolve references constructors; that, use -ur. option same thing `-i'.
i interested in knowing happens symbols present in inputs linker. take specific case when have static library libstatic.a contains single object file component.o. now, want create static library libfinal.a work interface libstatic.a. use command create it:
ld -r -o libfinal.a wrapper.o -l. -lstatic
where wrapper.o provides exclusive apis call functions defined in libstatic.a
will libfinal.a combined archive having wrapper.o , component.o or references can-be-resolved between wrapper.o , component.o resolved(linking) , placed libfinal.a?
edit_1: updating question based on progress made: objdump of component library libstatic.a
(objdump -d libstatic.a
) shows .text
sections separately each function (as expected). whereas in combined library libfinal.a
, has been created partial linking (-r
flag) there 1 single .text
section. guess means internal-linking has taken place , it's not creating plain archive.
ld
creates executables , shared libraries, not object file archives (.a files).
ar
creates , modifies object file archives.
-r, --relocateable
option useful when resolve (unresolved) symbols of .so
, produce .so
.
Comments
Post a Comment