diff --git a/README.md b/README.md index f4ee389a6..30dd83065 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,7 @@ The compiler is currently verified to compile on Linux, OpenBSD, Windows and Mac | ELF freestanding Aarch64 | No | Untested | No | No | No | Yes* | | ELF freestanding Riscv64 | No | Untested | No | No | No | Untested | | ELF freestanding Riscv32 | No | Untested | No | No | No | Untested | +| ELF freestanding Xtensa* | No | Untested | No | No | No | Untested | | FreeBSD x86 | Untested | Untested | No | Yes | Untested | Yes* | | FreeBSD x64 | Untested | Untested | No | Yes | Untested | Yes* | | NetBSD x86 | Untested | Untested | No | Yes | Untested | Yes* | @@ -184,7 +185,8 @@ The compiler is currently verified to compile on Linux, OpenBSD, Windows and Mac *\* Inline asm is still a work in progress*
*\* OpenBSD 7.7 is the only tested version*
-*\* OpenBSD has limited stacktrace, needs to be tested further* +*\* OpenBSD has limited stacktrace, needs to be tested further*
+*\* Xtensa support is enabled by compiling with `-DXTENSA_ENABLE`. The [espressif llvm fork](https://github.com/espressif/llvm-project) is recommended for best compatibility* More platforms will be supported in the future. diff --git a/releasenotes.md b/releasenotes.md index 5a2943df9..f289fb7d0 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -15,6 +15,7 @@ - Support `@param` directives for `...` parameters. #2578 - Allow splatting of structs. #2555 - Deprecate `--test-nocapture` in favour of `--test-show-output` #2588. +- Xtensa target no longer enabled by default on LLVM 22, Compile with `-DXTENSA_ENABLE` to enable it instead ### Fixes - `Foo.is_eq` would return false if the type was a `typedef` and had an overload, but the underlying type was not comparable. diff --git a/src/compiler/target.c b/src/compiler/target.c index 166a0c35d..c21b83a55 100644 --- a/src/compiler/target.c +++ b/src/compiler/target.c @@ -1910,12 +1910,6 @@ INLINE const char *llvm_macos_target_triple(const char *triple) LLVMInitialize ## X ## TargetMC(); \ } while(0) -#if LLVM_VERSION_MAJOR > 21 -#define XTENSA_AVAILABLE 1 -#else -#define XTENSA_AVAILABLE 0 -#endif - void *llvm_target_machine_create(void) { static bool llvm_initialized = false; @@ -1923,11 +1917,9 @@ void *llvm_target_machine_create(void) if (!llvm_initialized) { llvm_initialized = true; -#if XTENSA_AVAILABLE -#ifndef XTENSA_DISABLE +#ifdef XTENSA_ENABLE INITIALIZE_TARGET(Xtensa); #endif -#endif #ifndef ARM_DISABLE INITIALIZE_TARGET(ARM); #endif @@ -1982,10 +1974,6 @@ void *llvm_target_machine_create(void) return result; } -#else - -#define XTENSA_AVAILABLE 1 - #endif @@ -2144,10 +2132,12 @@ void target_setup(BuildTarget *target) error_exit("Failed to find Windows def file: '%s' in path.", target->win.def); } - if (target->arch_os_target == ELF_XTENSA && !XTENSA_AVAILABLE) +#ifndef XTENSA_ENABLE + if (target->arch_os_target == ELF_XTENSA) { error_exit("Xtensa support is not available with this LLVM version."); } +#endif compiler.platform.target_triple = arch_to_target_triple[target->arch_os_target]; ASSERT(compiler.platform.target_triple);