[llvm] r241721 - Start adding support for writing archives in BSD format.
Rafael Espíndola
rafael.espindola at gmail.com
Thu Jul 9 12:27:15 PDT 2015
>> My idea was to always pad the name with nulls so that we have members
>> that are 8 byte aligned and we never modify files put in the archive.
>
> That get the member to start on an 8-byte boundary, but its size is not a multiple of 8 bytes you still have to deal with that. Again the only way I could think of dealing with this is to change the member size. If objects always have sizes that are 8-byte multiples it never matters. If not it makes a mess of things. That is why we use libtool(1) to create “static libraries” and not ar(1) to create “archive files”. As we have stricter rules on “static libraries” including no non-object files allowed in them, sized to 8 byte multiples, warns if there are no symbols in the table of contents, etc.
I am not sure I follow what is the problem with files that are not a
multiple of 8 bytes. Lets say we are in the middle of creating an
archive and we just got a file (foo) that is 5 bytes long. What we
will have is
* Stuff before foo.
* Start of the member header for foo:
#1/......
This starts at a 2 byte aligned offset.
* Name of foo ("foo") with nulls added at the end.
* Start of foo itself. This will be aligned to 8 by the nulls on the name.
* A single '\n' to align to 2 bytes.
* Start of the member header for the next file. This starts at a 2
byte aligned offset.
I just missed llvm.org going down, but with the attached patch it
looks like we can bootstrap using llvm-ar+/usr/bin/true instead of
ar+ranlib.
>> I will also be adding support for thin archives.
>
> Not sure what "thin archives” are but I’ll watch for the diffs an help in any way I can.
The idea is that they have just the index. The users (liker mostly)
will fetch the members from the original files. This reduces IO during
a build.
Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 2956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150709/396eaef6/attachment.obj>
More information about the llvm-commits
mailing list