This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: "ld -r" on mixed IR/non-IR objects (
On Mon, Dec 6, 2010 at 4:05 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> Without slim lto you never know if a duplicate symbol is a mistake
>> of the programmer or just the "fat lto" copy. Also ELF semantics
>> like weak are hard if you have multiple copies.
>>
>
> It isn't easy, but doable.
>
Here is my proposal. Any comments?
Thanks.
--
H.J.
---
â 2 kinds of object files
â non-IR object file has
 non-IR sections
â IR object file has
 IR sections
 non-IR sections
â The output of "ld -r" with mixed IR/non-IR objects should work with:
â Compilers/linkers with IR support.
â Compilers/linkers without IR support.
â Add the mixed object file has
â IR sections
â non-IR sections:
 Object codes from IR sections.
 Object codes from non-IR object files.
â Object-only section:
 Section name won't be generated by any tools, something like
".objectonly\004".
 Contains non-IR object file.
 Input is discarded after link.
â Linker action:
â Classify each input object file:
â If there is a ".objectonly\004" section, it is a mixed object file.
â If there is a IR section, it is an IR object file.
â Otherwise, it is a non-IR object file.
â Relocatable link:
 Prepare for an object-only output.
 Prepare for a regular output.
 For each mixed object file,
â Add IR and non-IR sections to the regular output.
â For object-only section:
 Extract object only file.
 Add it to the object-only output.
 Discard object-only section.
 For each IR object file,
â Add IR and non-IR sections to the regular output.
 For each non-IR object file,
â Add non-IR sections to the regular output.
â Add non-IR sections to the object-only output.
 Final output:
â If there are IR objects, non-IR objects and the object-only
output isn't empty:
 Put the object-only output into the object-only section.
 Add the object-only section to the regular output.
â Remove the object-only output.
â Normal link
 Prepare for output.
 For each mixed object file,
â Compile and add IR sections to the output.
â For object-only section:
 Extract object only file.
 Add it to the output.
 Discard object-only section.
 For each IR object file,
â Compile and add IR sections to the output.
 For each non-IR object file,
â Add non-IR sections to the output.