[clang] [clang] add llvm abi support (PR #121123)

Tristan Ross via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 25 18:13:25 PST 2024


https://github.com/RossComputerGuy created https://github.com/llvm/llvm-project/pull/121123

This PR makes it possible to use the LLVM ABI which uses LLVM libc.

>From 058c4d297822cbde97641eb9c35d78d5742b96f2 Mon Sep 17 00:00:00 2001
From: Tristan Ross <tristan.ross at midstall.com>
Date: Wed, 25 Dec 2024 14:38:30 -0800
Subject: [PATCH] [clang] add llvm abi support

---
 clang/lib/Driver/Driver.cpp         | 2 +-
 clang/lib/Driver/ToolChains/Gnu.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index dc84c1b9d1cc4e..98b8e6e97419c6 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1531,7 +1531,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
 
   // Check if the environment version is valid except wasm case.
   llvm::Triple Triple = TC.getTriple();
-  if (!Triple.isWasm()) {
+  if (!Triple.isWasm() && Triple.getEnvironment() != llvm::Triple::LLVM) {
     StringRef TripleVersionName = Triple.getEnvironmentVersionString();
     StringRef TripleObjectFormat =
         Triple.getObjectFormatTypeName(Triple.getObjectFormat());
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 8397f1121ec2ce..2c9539ef56683c 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -464,7 +464,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
       if (!Args.hasArg(options::OPT_shared)) {
         if (Args.hasArg(options::OPT_pg))
           crt1 = "gcrt1.o";
-        else if (IsPIE)
+        else if (IsPIE && Triple.getEnvironment() != llvm::Triple::LLVM)
           crt1 = "Scrt1.o";
         else if (IsStaticPIE)
           crt1 = "rcrt1.o";



More information about the cfe-commits mailing list