[PATCH] D76461: [llvm-ar] Use target triple to deduce archive kind for bitcode inputs

Pirama Arumuga Nainar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 20 10:52:01 PDT 2020


pirama marked 7 inline comments as done.
pirama added inline comments.


================
Comment at: llvm/test/tools/llvm-ar/lto-kind-from-triple.test:2
+Ensure that we generate a GNU style archive if the first input is a bitcode
+file with a GNU target triple (absence of __.SYMDEF in the archive).
+
----------------
MaskRay wrote:
> Darwin archive format is the only different platform now. We can special case it and treat everything else GNU.
Assuming this is just a general observation and no action needed.


================
Comment at: llvm/tools/llvm-ar/llvm-ar.cpp:905
+      else if (TargetTriple.isOSBinFormatELF()) {
+        return TargetTriple.isOSBSDLike() ? object::Archive::K_BSD
+                                          : object::Archive::K_GNU;
----------------
MaskRay wrote:
> MaskRay wrote:
> > I will ask some BSD people whether this is correct.
> > 
> > (Honestly I don't like the logic much.)
> It seems that we can simply use K_GNU. Edited from Bdragon's words:
> 
> K_BSD, "__.SYMDEF", the 4.4BSD archive format (under development in 4.3BSD and finalized in 4.4BSD), is no longer as common use at the moment as people might think it is.
> 
> "openbsd appears to have tossed their ar and ranlib completely 6 years ago, and NetBSD switched to binutils ar 21 years ago."
> 
> So the only difference is between Darwin and GNU.
Thanks for following up on this.  I've updated the latest patch to use K_GNU for all non-Darwin triples.  It was previously set to K_GNU only when OSBinFormat was ELF.  The new logic is in sync with what this deduction is doing everywhere else:
  non-Darwin object file -> K_GNU
  non-Darwin host -> K_GNU.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76461/new/

https://reviews.llvm.org/D76461





More information about the llvm-commits mailing list