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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 20 10:17:27 PDT 2020


MaskRay added inline comments.


================
Comment at: llvm/include/llvm/ADT/Triple.h:506
 
+  bool isOSBSDLike() const {
+    return isOSNetBSD() || isOSOpenBSD() || isOSFreeBSD();
----------------
We should not need this helper.


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


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