Disable Xtensa target by default, enabled with -DXTENSA_ENABLE (#2586)

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
Book-reader
2025-11-25 11:50:52 +13:00
committed by GitHub
parent 5d468ccbf0
commit 869a1d93cb
3 changed files with 8 additions and 15 deletions

View File

@@ -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 Aarch64 | No | Untested | No | No | No | Yes* |
| ELF freestanding Riscv64 | No | Untested | No | No | No | Untested | | ELF freestanding Riscv64 | No | Untested | No | No | No | Untested |
| ELF freestanding Riscv32 | 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 x86 | Untested | Untested | No | Yes | Untested | Yes* |
| FreeBSD x64 | Untested | Untested | No | Yes | Untested | Yes* | | FreeBSD x64 | Untested | Untested | No | Yes | Untested | Yes* |
| NetBSD x86 | 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*<br> *\* Inline asm is still a work in progress*<br>
*\* OpenBSD 7.7 is the only tested version*<br> *\* OpenBSD 7.7 is the only tested version*<br>
*\* OpenBSD has limited stacktrace, needs to be tested further* *\* OpenBSD has limited stacktrace, needs to be tested further*<br>
*\* 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. More platforms will be supported in the future.

View File

@@ -15,6 +15,7 @@
- Support `@param` directives for `...` parameters. #2578 - Support `@param` directives for `...` parameters. #2578
- Allow splatting of structs. #2555 - Allow splatting of structs. #2555
- Deprecate `--test-nocapture` in favour of `--test-show-output` #2588. - 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 ### Fixes
- `Foo.is_eq` would return false if the type was a `typedef` and had an overload, but the underlying type was not comparable. - `Foo.is_eq` would return false if the type was a `typedef` and had an overload, but the underlying type was not comparable.

View File

@@ -1910,12 +1910,6 @@ INLINE const char *llvm_macos_target_triple(const char *triple)
LLVMInitialize ## X ## TargetMC(); \ LLVMInitialize ## X ## TargetMC(); \
} while(0) } while(0)
#if LLVM_VERSION_MAJOR > 21
#define XTENSA_AVAILABLE 1
#else
#define XTENSA_AVAILABLE 0
#endif
void *llvm_target_machine_create(void) void *llvm_target_machine_create(void)
{ {
static bool llvm_initialized = false; static bool llvm_initialized = false;
@@ -1923,11 +1917,9 @@ void *llvm_target_machine_create(void)
if (!llvm_initialized) if (!llvm_initialized)
{ {
llvm_initialized = true; llvm_initialized = true;
#if XTENSA_AVAILABLE #ifdef XTENSA_ENABLE
#ifndef XTENSA_DISABLE
INITIALIZE_TARGET(Xtensa); INITIALIZE_TARGET(Xtensa);
#endif #endif
#endif
#ifndef ARM_DISABLE #ifndef ARM_DISABLE
INITIALIZE_TARGET(ARM); INITIALIZE_TARGET(ARM);
#endif #endif
@@ -1982,10 +1974,6 @@ void *llvm_target_machine_create(void)
return result; return result;
} }
#else
#define XTENSA_AVAILABLE 1
#endif #endif
@@ -2144,10 +2132,12 @@ void target_setup(BuildTarget *target)
error_exit("Failed to find Windows def file: '%s' in path.", target->win.def); 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."); error_exit("Xtensa support is not available with this LLVM version.");
} }
#endif
compiler.platform.target_triple = arch_to_target_triple[target->arch_os_target]; compiler.platform.target_triple = arch_to_target_triple[target->arch_os_target];
ASSERT(compiler.platform.target_triple); ASSERT(compiler.platform.target_triple);