[libc-commits] [PATCH] D81533: [libc] Add a simple linux aarch64 config.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jun 9 22:34:02 PDT 2020


sivachandra created this revision.
sivachandra added a reviewer: asteinhauser.
Herald added subscribers: libc-commits, ecnelises, danielkiss, tschuett, kristof.beyls, mgorny.
Herald added a project: libc-project.

With this change, "ninja check-libc" on linux/aarch64 succeeds.

However, all entrypoints with machine dependent implementations
have been skipped. A good number of these skipped entrypoints can
be enabled once we have aarch64 syscall support available.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81533

Files:
  libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
  libc/config/linux/aarch64/entrypoints.txt
  libc/config/linux/aarch64/headers.txt


Index: libc/config/linux/aarch64/headers.txt
===================================================================
--- /dev/null
+++ libc/config/linux/aarch64/headers.txt
@@ -0,0 +1,5 @@
+set(PUBLIC_HEADERS
+    libc.include.errno
+    libc.include.math
+    libc.include.sys_syscall
+)
Index: libc/config/linux/aarch64/entrypoints.txt
===================================================================
--- /dev/null
+++ libc/config/linux/aarch64/entrypoints.txt
@@ -0,0 +1,25 @@
+set(TARGET_LIBC_ENTRYPOINTS
+    # errno.h entrypoints
+    libc.src.errno.__errno_location
+
+    # string.h entrypoints
+    libc.src.string.strlen
+)
+
+set(TARGET_LIBM_ENTRYPOINTS
+    # math.h entrypoints
+    libc.src.math.ceil
+    libc.src.math.ceilf
+    libc.src.math.cosf
+    libc.src.math.expf
+    libc.src.math.exp2f
+    libc.src.math.fabs
+    libc.src.math.fabsf
+    libc.src.math.floor
+    libc.src.math.floorf
+    libc.src.math.round
+    libc.src.math.sincosf
+    libc.src.math.sinf
+    libc.src.math.trunc
+    libc.src.math.truncf
+)
Index: libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
+++ libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
@@ -4,10 +4,9 @@
 
 if(${LIBC_TARGET_MACHINE} MATCHES "x86|x86_64")
   set(ALL_CPU_FEATURES SSE SSE2 AVX AVX2 AVX512F)
+  list(SORT ALL_CPU_FEATURES)
 endif()
 
-list(SORT ALL_CPU_FEATURES)
-
 # Function to check whether the host supports the provided set of features.
 # Usage:
 # host_supports(
@@ -126,4 +125,11 @@
 endfunction()
 
 # Populates the HOST_CPU_FEATURES list.
-_check_defined_cpu_feature(HOST_CPU_FEATURES MARCH native)
+# Use -march=native only when the compiler supports it.
+include(CheckCXXCompilerFlag)
+CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
+if(COMPILER_SUPPORTS_MARCH_NATIVE)
+  _check_defined_cpu_feature(HOST_CPU_FEATURES MARCH native)
+else()
+  _check_defined_cpu_feature(HOST_CPU_FEATURES)
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81533.269736.patch
Type: text/x-patch
Size: 2036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200610/27e25e86/attachment.bin>


More information about the libc-commits mailing list