[llvm-dev] [llvm-ar] default llvm-ar archive format type gnu vs darwin
Owen Reynolds via llvm-dev
llvm-dev at lists.llvm.org
Thu Jul 11 09:03:49 PDT 2019
Thanks for the explanation James, I agree it makes sense to select output
based on platform due to what you outline above. I was thinking that the
behaviour to do this is a little opaque to the user if they were expecting
a particular format. For example a user on Darwin has the correct format by
default, however if they create an archive with non-MachO objects the
format will differ without warning, same if they request a thin archive. I
understand the main use case is as above but I was thinking it has the
potential to cause surprise.
On Wed, Jul 10, 2019 at 3:28 PM James Y Knight <jyknight at google.com> wrote:
> Basically the only reason to choose one ar archive format over another is
> to enable the linker used on that platform to read it (in case it cannot
> read all formats). Thus, attempting to automatically choose the format
> which is most likely to be readable by linkers generally used with the
> provided object-file format seems pretty sensible.
>
> What problem do you see here?
>
> On Wed, Jul 10, 2019 at 9:03 AM Owen Reynolds via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hi all,
>>
>> I've been making some additional tests for llvm-ar recently and was
>> surprised by the behaviour regarding which archive format to output when
>> the --format argument hasn't been used.
>>
>> From 273373:
>>
>> Try to be more clever about selecting the default format. When an
>> existing
>> archive is used, use the type of the archive to determine the format.
>> When
>> existing members are present, use the first member's format to determine
>> the
>> format to use. If we are creating an empty archive (MRI mode) or are
>> adding
>> non-object members, default to the current behaviour of using the host
>> type due
>> to the lack of a better alternative. This aids in cross-compilation on
>> Darwin
>> to non-Darwin platforms which rely on GNU format archives.
>>
>>
>> This doesn't seem ideal to me, particularly the use of the first member
>> to decide format as this is not obvious from a user perspective. Would it
>> be better to just default to host type or treat them as separate tools and
>> decide default format by tool name?
>>
>> Thanks,
>>
>> Owen
>>
>>
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190711/a2efbcdc/attachment.html>
More information about the llvm-dev
mailing list