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

Shankar Easwaran shankare at codeaurora.org
Tue Dec 2 21:08:13 PST 2014

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 :-

.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 

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

More information about the llvm-dev mailing list