[LLVMdev] [lld] need to figure out if file is an archive member and record more information...

Rui Ueyama ruiu at google.com
Tue Dec 2 21:19:39 PST 2014


Do you have to know whether a MemoryBuffer was in a library or not during
parsing that MemoryBuffer?

If not, we could just set a library name to a File in
FileArchive::instantiateMember after we call _registry.parseFile.

On Tue, Dec 2, 2014 at 9:08 PM, Shankar Easwaran <shankare at codeaurora.org>
wrote:

> Hi Nick,
>
> Currently the Reader doesnot have  a way to figure out that a file that is
> being parsed is part of an archive.
>
> 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.
>
> For example :-
>
> SECTIONS {
> .myoutputsection : {
>     libc.a : { *(.text) }
>     printf.o : { *(.rodata) }
> }
> }
>
> 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.
>
> Current Design
> ------------------------
> 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.
>
> Information that needs to be recorded
> ---------------------------------------------------------
> 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.
>
> Approach we could take is :-
> -------------------------------------------
> a) Rename MemoryBuffer to LinkerMemoryBuffer, which is a container for
> MemoryBuffer but with extra information(that contains the filename and an
> optional member name)
>
> If the member name is not empty, the Reader could treat this as an archive
> member.
>
> Comments ??
>
> Shankar Easwaran
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by the Linux Foundation
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141202/4d52c762/attachment.html>


More information about the llvm-dev mailing list