[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2025-01-09 Thread Garvit Gupta via cfe-commits
quic-garvgupt wrote: I have divided this PR into three separate PRs to streamline the review process and ensured that ARM and RISCV tests are not modified in the same PR. Please review them and provide any feedback or comments. Thanks! [RISCV] Teach Barmetal toolchain about GCC installation(1/

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-12 Thread Petr Hosek via cfe-commits
petrhosek wrote: > > I think this change could be made a lot smaller by doing a clean up first, > > bringing the BareMetal driver closer to other drivers, before attempting to > > merge the RISCVToolChain driver into it. > > Could you describe in a bit more detail which bits you think need to

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-12 Thread Kito Cheng via cfe-commits
kito-cheng wrote: I would suggest to break this PR into several small pieces, the clang/test folder should not having too much change during the merging, especially I feel not conformable changing the non-RISC-V file within this PR, I expect those change should happened in a separated patch.

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-11 Thread Garvit Gupta via cfe-commits
@@ -78,8 +86,9 @@ class LLVM_LIBRARY_VISIBILITY BareMetal : public ToolChain { using OrderedMultilibs = llvm::iterator_range::const_reverse_iterator>; OrderedMultilibs getOrderedMultilibs() const; - + bool UseLD; quic-garvgupt wrote: please see my

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-11 Thread Garvit Gupta via cfe-commits
@@ -110,20 +111,95 @@ static std::string computeBaseSysRoot(const Driver &D, bool IncludeTriple) { return std::string(SysRootDir); } +// GCC sysroot here means form sysroot from either --gcc-install-dir, or from +// --gcc-toolchain or if the toolchain is installed alongside

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-11 Thread Garvit Gupta via cfe-commits
@@ -6521,11 +6521,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, break; case llvm::Triple::riscv32: case llvm::Triple::riscv64: -if (toolchains::RISCVToolChain::hasGCCToolchain(*this, Args)) - TC = - std::make_

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-11 Thread Garvit Gupta via cfe-commits
https://github.com/quic-garvgupt updated https://github.com/llvm/llvm-project/pull/118809 >From b58f9dd197c78b1e39676022a421ca0e6d5552a5 Mon Sep 17 00:00:00 2001 From: Garvit Gupta Date: Wed, 13 Nov 2024 02:45:51 -0800 Subject: [PATCH] [WIP] Merging RISCVToolChain and BareMetal toolchains Curr

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-11 Thread Garvit Gupta via cfe-commits
https://github.com/quic-garvgupt updated https://github.com/llvm/llvm-project/pull/118809 >From 569feb86c654be044781aa5968907a72ea882e88 Mon Sep 17 00:00:00 2001 From: Garvit Gupta Date: Wed, 13 Nov 2024 02:45:51 -0800 Subject: [PATCH] [WIP] Merging RISCVToolChain and BareMetal toolchains Curr

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > I think this change could be made a lot smaller by doing a clean up first, > bringing the BareMetal driver closer to other drivers, before attempting to > merge the RISCVToolChain driver into it. Could you describe in a bit more detail which bits you think need to be cle

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-06 Thread Petr Hosek via cfe-commits
petrhosek wrote: The `BareMetal` driver currently isn't very idiomatic (compared to other drivers like `Generic_GCC`) and duplicates a lot of the logic that has been already factored out in other drivers. I think this change could be made a lot smaller by doing a clean up first, bringing the `

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-06 Thread Petr Hosek via cfe-commits
@@ -291,6 +365,36 @@ BareMetal::OrderedMultilibs BareMetal::getOrderedMultilibs() const { return llvm::reverse(Default); } +ToolChain::CXXStdlibType BareMetal::GetDefaultCXXStdlibType() const { + if (getTriple().isRISCV()) { +return GCCInstallation.isValid() ? ToolChai

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-06 Thread via cfe-commits
@@ -110,20 +111,95 @@ static std::string computeBaseSysRoot(const Driver &D, bool IncludeTriple) { return std::string(SysRootDir); } +// GCC sysroot here means form sysroot from either --gcc-install-dir, or from +// --gcc-toolchain or if the toolchain is installed alongside

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-06 Thread Garvit Gupta via cfe-commits
@@ -503,12 +624,22 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA, const llvm::Triple::ArchType Arch = TC.getArch(); const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); - AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA); + if (!D

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-06 Thread Kito Cheng via cfe-commits
@@ -503,12 +624,22 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA, const llvm::Triple::ArchType Arch = TC.getArch(); const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); - AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA); + if (!D

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-06 Thread Kito Cheng via cfe-commits
@@ -519,9 +650,24 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(Arch == llvm::Triple::aarch64_be ? "-EB" : "-EL"); } - if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, - options::OPT_r

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Craig Topper via cfe-commits
@@ -103,7 +112,12 @@ class LLVM_LIBRARY_VISIBILITY StaticLibTool : public Tool { class LLVM_LIBRARY_VISIBILITY Linker final : public Tool { public: - Linker(const ToolChain &TC) : Tool("baremetal::Linker", "ld.lld", TC) {} + Linker(const ToolChain &TC) toppe

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Craig Topper via cfe-commits
@@ -103,7 +112,12 @@ class LLVM_LIBRARY_VISIBILITY StaticLibTool : public Tool { class LLVM_LIBRARY_VISIBILITY Linker final : public Tool { public: - Linker(const ToolChain &TC) : Tool("baremetal::Linker", "ld.lld", TC) {} + Linker(const ToolChain &TC) + : Tool("baremet

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Craig Topper via cfe-commits
@@ -503,12 +624,22 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA, const llvm::Triple::ArchType Arch = TC.getArch(); const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); - AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA); + if (!D

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Craig Topper via cfe-commits
@@ -503,12 +624,22 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA, const llvm::Triple::ArchType Arch = TC.getArch(); const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); - AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA); + if (!D

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Craig Topper via cfe-commits
@@ -325,6 +429,19 @@ void BareMetal::addClangTargetOptions(const ArgList &DriverArgs, CC1Args.push_back("-nostdsysteminc"); } +void BareMetal::addLibStdCxxIncludePaths( +const llvm::opt::ArgList &DriverArgs, +llvm::opt::ArgStringList &CC1Args) const { + if (GCCInst

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Craig Topper via cfe-commits
@@ -291,6 +365,36 @@ BareMetal::OrderedMultilibs BareMetal::getOrderedMultilibs() const { return llvm::reverse(Default); } +ToolChain::CXXStdlibType BareMetal::GetDefaultCXXStdlibType() const { + if (getTriple().isRISCV()) { topperc wrote: Could this be s

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Garvit Gupta via cfe-commits
https://github.com/quic-garvgupt updated https://github.com/llvm/llvm-project/pull/118809 >From b74795d44846b79252bd3fb1f1e8179311725c74 Mon Sep 17 00:00:00 2001 From: Garvit Gupta Date: Wed, 13 Nov 2024 02:45:51 -0800 Subject: [PATCH] [RISCV] Merging RISCVToolChain and BareMetal toolchains Cu

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 3740fac0d4640c05ba960be97d14cbd375a7c733 b1bd1ee4f3a4966b50e0b35fd349091660e84576 --e

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-backend-risc-v Author: Garvit Gupta (quic-garvgupt) Changes Currently, LLVM has two RISC-V toolchain classes in Clang for baremetal development, creating unnecessary maintenance overhead. This patch extends the BareMetal toolchain to support an existin

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Garvit Gupta (quic-garvgupt) Changes Currently, LLVM has two RISC-V toolchain classes in Clang for baremetal development, creating unnecessary maintenance overhead. This patch extends the BareMetal toolchain to support an existing GCC ins

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Garvit Gupta (quic-garvgupt) Changes Currently, LLVM has two RISC-V toolchain classes in Clang for baremetal development, creating unnecessary maintenance overhead. This patch extends the BareMetal toolchain to support an existing

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-05 Thread Garvit Gupta via cfe-commits
https://github.com/quic-garvgupt created https://github.com/llvm/llvm-project/pull/118809 Currently, LLVM has two RISC-V toolchain classes in Clang for baremetal development, creating unnecessary maintenance overhead. This patch extends the BareMetal toolchain to support an existing GCC instal