<meta http-equiv="content-type" content="text/html; charset=utf-8"><div>Thanks Rui for the feedback.</div><div><br>I would settle for a derived class and the class would be called LinkerMemoryBuffer. I will send a patch for review soon.</div><div><br></div><div>Shankar Easwaran<br><br></div><div><br>On Dec 2, 2014, at 23:40, Rui Ueyama [via LLVM] <<a href="/user/SendEmail.jtp?type=node&node=74960&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:<br><br></div><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' type="cite"><div>
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">I think another way to do what you want is to add a new parameter to parse() to propagate library file name to the parser, so that the parser can determine if it's reading a library member. In this way you don't have to make a derived class of MemoryBuffer.</div><div class="gmail_quote"><br></div><div class="gmail_quote">One fault of that approach is the new parameter seems a bit arbitrary. In order to get file name, you would call MemoryBuffer::getIdentifier, but in order to get, you would use the second parameter of parse(). This is not wrong but looks odd.</div><div class="gmail_quote"><br></div><div class="gmail_quote">The other approach is to parse "filename(libraryname)" string returned from MemoryBuffer::getIdentifier. But this is of course not robust. (What if we have an object file whose file path contains parentheses?)</div><div class="gmail_quote"><br></div><div class="gmail_quote">So I think making a derived class would be fine.</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Tue, Dec 2, 2014 at 9:24 PM, Shankar Easwaran <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=74959&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span> wrote:<br><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" class="gmail_quote"><span class="">On 12/2/2014 11:19 PM, Rui Ueyama wrote:<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" class="gmail_quote">
Do you have to know whether a MemoryBuffer was in a library or not during<br>
parsing that MemoryBuffer?<br>
</blockquote></span>
Yes, I need to know that while parsing the buffer too.<div class="HOEnZb"><div class="h5"><br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" class="gmail_quote">
<br>
If not, we could just set a library name to a File in<br>
FileArchive::instantiateMember after we call _registry.parseFile.<br>
<br>
On Tue, Dec 2, 2014 at 9:08 PM, Shankar Easwaran <<a href="/user/SendEmail.jtp?type=node&node=74959&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>><br>
wrote:<br>
<br>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #CCCCCC;padding:0 1em" class="gmail_quote">
Hi Nick,<br>
<br>
Currently the Reader doesnot have a way to figure out that a file that is<br>
being parsed is part of an archive.<br>
<br>
For linker script support this is needed to match a rule that matches only<br>
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<br>
and the rule says pick all text sections from members of libc.a that the<br>
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<br>
memory buffer and identify using library(member) which is part of the<br>
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<br>
as the linker script syntax allows to to distinguish library names and<br>
member names.<br>
<br>
Approach we could take is :-<br>
------------------------------<u></u>-------------<br>
a) Rename MemoryBuffer to LinkerMemoryBuffer, which is a container for<br>
MemoryBuffer but with extra information(that contains the filename and an<br>
optional member name)<br>
<br>
If the member name is not empty, the Reader could treat this as an archive<br>
member.<br>
<br>
Comments ??<br>
<br>
Shankar Easwaran<br>
<br>
--<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by the Linux Foundation<br>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="/user/SendEmail.jtp?type=node&node=74959&i=2" target="_top" rel="nofollow" link="external">[hidden email]</a> <a href="http://llvm.cs.uiuc.edu" target="_blank" rel="nofollow" link="external">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank" rel="nofollow" link="external">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
<br>
</blockquote></blockquote>
<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
</div></div></blockquote></div><br></div></div>
<br>_______________________________________________
<br>LLVM Developers mailing list
<br><a href="/user/SendEmail.jtp?type=node&node=74959&i=3" target="_top" rel="nofollow" link="external">[hidden email]</a> <a href="http://llvm.cs.uiuc.edu" target="_top" rel="nofollow" link="external">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_top" rel="nofollow" link="external">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
<br>
<hr noshade="noshade" size="1" color="#cccccc">
<div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
<a href="http://llvm.1065342.n5.nabble.com/lld-need-to-figure-out-if-file-is-an-archive-member-and-record-more-information-tp74956p74959.html" target="_top" rel="nofollow" link="external">http://llvm.1065342.n5.nabble.com/lld-need-to-figure-out-if-file-is-an-archive-member-and-record-more-information-tp74956p74959.html</a>
</div>
<div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To start a new topic under LLVM - Dev, email <a href="/user/SendEmail.jtp?type=node&node=74960&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a> <br>
To unsubscribe from LLVM - Dev, <a href="" target="_top" rel="nofollow" link="external">click here</a>.<br>
<a href="http://llvm.1065342.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a>
</div></div></blockquote>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://llvm.1065342.n5.nabble.com/lld-need-to-figure-out-if-file-is-an-archive-member-and-record-more-information-tp74956p74960.html">Re: [lld] need to figure out if file is an archive member and record more information...</a><br/>
Sent from the <a href="http://llvm.1065342.n5.nabble.com/LLVM-Dev-f3.html">LLVM - Dev mailing list archive</a> at Nabble.com.<br/>