Int_types.h in compiler-rt for riscv32

Hi,

I’m building Rust for my target triple – riscv32imac-unknown-xous-elf. I’m experiencing a build issue in compiler-rt/lib/builtins/int_types.h. The error that comes from compiling Rust is:

 cargo:warning=[..]\rust-next\src\llvm-project\compiler-rt\lib/builtins\int_types.h:80:1: error: unable to emulate 'TI'
  cargo:warning=   80 | typedef unsigned tu_int __attribute__((mode(TI)));
  cargo:warning=      | ^~~~~~~

Thus far I’ve worked around this by simply removing #define CRT_HAS_128BIT on line 68, however I’d like to understand this issue more and possibly try to get a fix upstream.

Has anyone else run into this issue, and if so, how did you solve it?

The problem seems to stem from the fact that line 67 checks for defined(__riscv) which is the case for both 32- and 64-bit RISC-V variants, however only the 64-bit variant of RISC-V supports 128-bit operations.

Would it make sense to add a check for __SIZEOF_INT128__, which is defined for rv64 targets? Or would it make more sense to #undef CRT_HAS_128BIT if defined(__riscv) && (__riscv_xlen == 32)?