Skip to content

[libc] i386 support #93709

@nickdesaulniers

Description

@nickdesaulniers

In order to incorporate llvm-libc into Android, we MUST to support 32b x86.

Currently, the most immediate build failure with -m32 is:

In file included from external/llvm-libc/test/UnitTest/LibcTest.cpp:9:
In file included from external/llvm-libc/test/UnitTest/LibcTest.h:28:
In file included from external/llvm-libc/src/__support/CPP/string.h:14:
In file included from external/llvm-libc/src/string/memory_utils/inline_memcpy.h:22:
external/llvm-libc/src/string/memory_utils/x86_64/inline_memcpy.h:195:22: error: no member named 'K_AVX' in namespace '
llvmlibc::x86'
  195 |   if constexpr (x86::K_AVX) {
      |                 ~~~~~^
external/llvm-libc/src/string/memory_utils/x86_64/inline_memcpy.h:214:17: error: no member named 'Memcpy' in namespace 
'llvmlibc::x86'
  214 |     return x86::Memcpy::repmovsb(dst, src, count);
      |            ~~~~~^
external/llvm-libc/src/string/memory_utils/x86_64/inline_memcpy.h:219:19: error: no member named 'Memcpy' in namespace 
'llvmlibc::x86'
  219 |       return x86::Memcpy::repmovsb(dst, src, count);
      |              ~~~~~^

This is because x86::K_AVX is only defined when LIBC_TARGET_ARCH_IS_X86_64 is, which is 64b only. We probably need more preprocessor guards using LIBC_TARGET_ARCH_IS_X86_64 (64b vs 32b).

(There may be more build or runtime failures)

cc @gchatelet @enh-google

It will be less work for us to support 32b x86 then for Android to drop 32b x86 support.

Sub-issues

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions