[lld] [llvm] Add initial support for Xtensa to LLD (PR #202926)

Alexey Gerenkov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 02:50:21 PDT 2026


gerekon wrote:

> Please add a PR description, and please start an RFC on Discourse before this goes further. Adding a new architecture to lld/ELF is a project-level commitment, not just a new `Arch/*.cpp` file.
> 
> Please also split this into: (1) the new Xtensa.def relocation numbers (2) lld changes.
> 
> Please use a https://clang.llvm.org/docs/SourceBasedCodeCoverage.html build to ensure every relocation, every condition, is covered by test.
> 
> * Is there a published Xtensa ELF psABI (relocations, e_flags, ABI variants), or is the de-facto spec "whatever bfd/elf32-xtensa.c does"? Specifically, what defines R_XTENSA_32's addend semantics — the patch adds in-place contents to the RELA addend because GNU as and the LLVM backend disagree.
> * Which object producers must lld consume? LLVM-produced objects only, or also GNU Assembler output?
> * Since the backend is experimental, `REQUIRES: xtensa` tests won't run in default builds. Who maintains this code, and will there be a buildbot with LLVM_EXPERIMENTAL_TARGETS_TO_BUILD=Xtensa?
> * Is there GOT/PLT/TLS/linker relaxation planned?

@MaskRay Thanks for the detailed comments.

I created [RFC](https://discourse.llvm.org/t/rfc-add-xtensa-support-to-lld-elf-static-linking-for-embedded-targets/91608). Also covered some of your questions there. If it will be accepted I will update this PR and continue work on it.

cc @andreisfr @MabezDev

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


More information about the llvm-commits mailing list