[cfe-commits] [Patch] Add suppor for Bitrig, an OpenBSD fork.

Eli Friedman eli.friedman at gmail.com
Mon Aug 6 20:18:57 PDT 2012


On Mon, Aug 6, 2012 at 7:28 PM, David Hill <dhill at mindcry.org> wrote:
> Attached is a diff to add support for Bitrig, an OpenBSD fork.
>
> Please review.

I'm a little uncomfortable with the amount of code which appears to be
copy-pasted in lib/Driver/, but I'm not sure how much of it can be
refactored.  Worth considering, at least.

+void Bitrig::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+                                          ArgStringList &CC1Args) const {
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
+      DriverArgs.hasArg(options::OPT_nostdincxx))
+    return;
+
+  std::string Triple = getTriple().str();
+  if (Triple.substr(0, 5) == "amd64")
+    Triple.replace(0, 5, "x86_64");
+
+  addSystemInclude(DriverArgs, CC1Args, "/usr/include/c++/4.6.2");
+  addSystemInclude(DriverArgs, CC1Args, "/usr/include/c++/4.6.2/backward");
+  addSystemInclude(DriverArgs, CC1Args, "/usr/include/c++/4.6.2/" + Triple);
+
+}

Are you sure you want to hardcode this path?

Also, I think you want support for libc++; not sure what the path
would be, though.

+    } else if (getToolChain().getOS().startswith("bitrig"))  {
+      if (getToolChain().getArch() == llvm::Triple::x86_64)
+        CPUName = "x86-64";
+      else if (getToolChain().getArch() == llvm::Triple::x86)
+        CPUName = "i486";

This is actually a non-trivial decision... LLVM code generation will
be much happier if you bump it up to at least i686.

Otherwise, looks fine.

-Eli



More information about the cfe-commits mailing list