[clang] Reland [Driver] Add support for crtbegin.o, crtend.o and libgloss lib to BareMetal toolchain object (PR #144649)
Garvit Gupta via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 30 03:00:10 PDT 2025
quic-garvgupt wrote:
> > Moreover, this patch makes gnuld the default linker for baremetal
> > toolchain object. User need to pass -fuse-ld=lld explicitly to driver to select
> > lld
>
> This seems like an unrelated change, it was not mentioned in the RFC, and it breaks things: baremetal toolchains generally should not be presumed to be for the same architecture as host. On an x86_64 host, this results in `/usr/bin/ld` being used for `clang --target=riscv64`, but `/usr/bin/ld` is (generally) a linker that does not understand RISC-V targets or object files. This seems like a bad idea, can this please be reverted?
This patch does not make assumption that it is for the same architecture as host. Rather, it is inline with other toolchain objects that supports GCCInstallation which have ld as the default linker. And this change is done only after reaching a consensus with lld and clang driver maintainer which can be found [here](https://github.com/llvm/llvm-project/pull/121830). The conclusion of that discussion was that if a user wants to use a different linker, they should do by specifying it explicitly via `-fuse-ld` or `CLANG_DEFAULT_LINKER`.
https://github.com/llvm/llvm-project/pull/144649
More information about the cfe-commits
mailing list