[PATCH] D77776: [Driver] Drop support for FreeBSD < 10

Greg V via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 03:42:39 PDT 2020


myfreeweb added a comment.

> But the default should indeed be either the host version

yep, I've had this patch:

  --- lib/Support/Triple.cpp.orig	2020-04-10 20:51:46 UTC
  +++ lib/Support/Triple.cpp
  @@ -14,6 +14,9 @@
   #include "llvm/Support/Host.h"
   #include "llvm/Support/TargetParser.h"
   #include <cstring>
  +#ifdef __FreeBSD__
  +#include <sys/param.h>
  +#endif
   using namespace llvm;
   
   StringRef Triple::getArchTypeName(ArchType Kind) {
  @@ -1073,6 +1076,13 @@ void Triple::getOSVersion(unsigned &Major, unsigned &M
       OSName.consume_front("macos");
   
     parseVersionFromName(OSName, Major, Minor, Micro);
  +
  +  if (getOS() == FreeBSD && Major == 0)
  +#ifdef __FreeBSD__
  +	  Major = __FreeBSD_version / 100000;
  +#else
  +	  Major = 12;
  +#endif
   }
   
   bool Triple::getMacOSXVersion(unsigned &Major, unsigned &Minor,

I don't see any other OS headers included in this file, so idk about code style, but the general idea should be like this


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77776





More information about the cfe-commits mailing list