<div dir="ltr"><div>Do you have to know whether a MemoryBuffer was in a library or not during parsing that MemoryBuffer?</div><div><br></div><div>If not, we could just set a library name to a File in FileArchive::instantiateMember after we call _registry.parseFile.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 9:08 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nick,<br>
<br>
Currently the Reader doesnot have  a way to figure out that a file that is being parsed is part of an archive.<br>
<br>
For linker script support this is needed to match a rule that matches only if the file is from an archive library (or a member of an archive.<br>
<br>
For example :-<br>
<br>
SECTIONS {<br>
.myoutputsection : {<br>
    libc.a : { *(.text) }<br>
    printf.o : { *(.rodata) }<br>
}<br>
}<br>
<br>
The colon is used to denote an archive file or a member of an archive file and the rule says pick all text sections from members of libc.a that the linker uses for the current link step.<br>
<br>
Current Design<br>
------------------------<br>
In the current design we record the archive file and the member in the memory buffer and identify using library(member) which is part of the MemoryBuffer.<br>
<br>
Information that needs to be recorded<br>
------------------------------<u></u>---------------------------<br>
The linker also needs to store the library and the member names separately as the linker script syntax allows to to distinguish library names and member names.<br>
<br>
Approach we could take is :-<br>
------------------------------<u></u>-------------<br>
a) Rename MemoryBuffer to LinkerMemoryBuffer, which is a container for MemoryBuffer but with extra information(that contains the filename and an optional member name)<br>
<br>
If the member name is not empty, the Reader could treat this as an archive member.<br>
<br>
Comments ??<span class="HOEnZb"><font color="#888888"><br>
<br>
Shankar Easwaran<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</font></span></blockquote></div><br></div>