<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 10, 2019 at 3:28 PM James Y Knight <<a href="mailto:jyknight@google.com">jyknight@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">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.<div><br></div><div>What problem do you see here?<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 10, 2019 at 9:03 AM Owen Reynolds via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>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. </div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>From 273373:</div><div><br></div><div>Try to be more clever about selecting the default format. When an existing</div><div>archive is used, use the type of the archive to determine the format. When</div><div>existing members are present, use the first member's format to determine the</div><div>format to use. If we are creating an empty archive (MRI mode) or are adding</div><div>non-object members, default to the current behaviour of using the host type due</div><div>to the lack of a better alternative. This aids in cross-compilation on Darwin</div><div>to non-Darwin platforms which rely on GNU format archives.</div></blockquote><div><br></div><div>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?</div><div><br></div><div>Thanks,</div><div><br></div><div>Owen</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>