title: What is Partial Linking in GNU Linker?
body: <p>The best explanation I was able to find was from the official document:</p>
  
  <blockquote>
    <p>-r
    --relocateable Generate relocatable output--i.e., generate an output file that can in turn serve as input to ld. This is often called
    partial linking. As a side effect, in environments that support
    standard Unix magic numbers, this option also sets the output file's
    magic number to OMAGIC. If this option is not specified, an absolute
    file is produced. When linking C++ programs, this option will not
    resolve references to constructors; to do that, use -Ur. This option
    does the same thing as `-i'.</p>
  </blockquote>
  
  <p>I am specifically interested in knowing what happens to the symbols present in inputs to linker. Take a specific case when I have a static library <strong>libstatic.a</strong> which contains a single object file <strong>component.o</strong>. 
  Now, I want to create another static library <strong>libfinal.a</strong> which will work as an interface to <strong>libstatic.a</strong>. I use this command to create it:</p>
  
  <p><code>ld -r -o libfinal.a wrapper.o -L. -lstatic</code></p>
  
  <p>Where <strong>wrapper.o</strong> provides exclusive APIs to call the functions defined in libstatic.a</p>
  
  <p>Will the <strong>libfinal.a</strong> be just a combined archive having <strong>wrapper.o</strong> and <strong>component.o</strong> or all the references which can-be-resolved between <strong>wrapper.o</strong> and <strong>component.o</strong> be resolved(linking) and then placed into <strong>libfinal.a</strong>?</p>
  
  <p><strong>Edit_1:</strong> Updating the question based on the progress made:
  The <strong>objdump</strong> of the component library <code>libstatic.a</code> (<code>objdump -D libstatic.a</code>) shows <code>.text</code> sections separately for each function (as expected). Whereas in the combined library <code>libfinal.a</code>, which has been created by partial linking (<code>-r</code>flag) there is just one single <code>.text</code> section. I guess this means that an internal-linking has taken place and it's not just creating a plain archive.</p>