[clang] ab9b2fe - [Driver] Define BareMetal::HasNativeLLVMSupport to return true

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 15:06:06 PST 2023


Author: Fangrui Song
Date: 2023-02-23T15:06:02-08:00
New Revision: ab9b2fe2a5f817f3bbca0d187a99aaae23e75d6a

URL: https://github.com/llvm/llvm-project/commit/ab9b2fe2a5f817f3bbca0d187a99aaae23e75d6a
DIFF: https://github.com/llvm/llvm-project/commit/ab9b2fe2a5f817f3bbca0d187a99aaae23e75d6a.diff

LOG: [Driver] Define BareMetal::HasNativeLLVMSupport to return true

D33259 switched the default linker to ld.lld which supports LLVM LTO.
We can support LTO compile/link in one command and drop the
`unable to pass LLVM bit-code files to linker` error.

Fix https://github.com/llvm/llvm-project/issues/52807

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/BareMetal.h
    clang/test/Driver/native-llvm.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/BareMetal.h b/clang/lib/Driver/ToolChains/BareMetal.h
index 2a16a5beb08d7..54de97c734c19 100644
--- a/clang/lib/Driver/ToolChains/BareMetal.h
+++ b/clang/lib/Driver/ToolChains/BareMetal.h
@@ -37,6 +37,7 @@ class LLVM_LIBRARY_VISIBILITY BareMetal : public ToolChain {
   bool useIntegratedAs() const override { return true; }
   bool isBareMetal() const override { return true; }
   bool isCrossCompiling() const override { return true; }
+  bool HasNativeLLVMSupport() const override { return true; }
   bool isPICDefault() const override { return false; }
   bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
     return false;

diff  --git a/clang/test/Driver/native-llvm.c b/clang/test/Driver/native-llvm.c
index c9543b855bc76..a1f9569317081 100644
--- a/clang/test/Driver/native-llvm.c
+++ b/clang/test/Driver/native-llvm.c
@@ -3,3 +3,5 @@
 
 // RUN: %clang -### -flto -target x86_64-unknown-unknown %s 2>&1 | FileCheck %s
 // CHECK: error: {{.*}} unable to pass LLVM bit-code files to linker
+
+// RUN: %clang -### -flto --target=arm-none-eabi %s 2>&1 | FileCheck /dev/null --implicit-check-not=error:


        


More information about the cfe-commits mailing list