[clang] Fix extraneous addition of `-X` flag in baremetal toolchain (PR #148855)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 15 07:13:46 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Garvit Gupta (quic-garvgupt)

<details>
<summary>Changes</summary>

Commit 597ee88 moved the -X flag to a new position in the baremetal toolchain's linker job, 
but unintentionally left the original instance in place.

This patch removes the redundant flag, ensuring -X is passed only once.

---
Full diff: https://github.com/llvm/llvm-project/pull/148855.diff


1 Files Affected:

- (modified) clang/lib/Driver/ToolChains/BareMetal.cpp (-3) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/BareMetal.cpp b/clang/lib/Driver/ToolChains/BareMetal.cpp
index e670696cd59ae..497f3330237b9 100644
--- a/clang/lib/Driver/ToolChains/BareMetal.cpp
+++ b/clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -694,9 +694,6 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
       NeedCRTs)
     CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath(CRTEnd)));
 
-  if (TC.getTriple().isRISCV())
-    CmdArgs.push_back("-X");
-
   // The R_ARM_TARGET2 relocation must be treated as R_ARM_REL32 on arm*-*-elf
   // and arm*-*-eabi (the default is R_ARM_GOT_PREL, used on arm*-*-linux and
   // arm*-*-*bsd).

``````````

</details>


https://github.com/llvm/llvm-project/pull/148855


More information about the cfe-commits mailing list