[libc-commits] [libc] [LibC] Refactor arm64 to aarch64 for darwin. (PR #141509)
Aly ElAshram via libc-commits
libc-commits at lists.llvm.org
Mon May 26 10:19:21 PDT 2025
https://github.com/AlyElashram created https://github.com/llvm/llvm-project/pull/141509
Fixes [#141505](https://github.com/llvm/llvm-project/issues/141505)
The main intention behind this PR is to update the LibCTargetArchitecture for arm64 to use the implementation of aarch64 architecture and not arm32.
This is a historical issue , and is a blocker to issue #138407.
The intended fix is to set the `LibCTargetArchitecture` to aarch64 when it matches arm64 , this in turn would help us run darwin/aarch64 specific code on our MacOs pipeline in the git actions.
Methods used to search and find "darwin/arm" directories was
1. "find . -type d -path "*/libc/*/darwin/arm" in a linux terminal to check for arm specifically
2. "find . -type d -path "*/libc/*/darwin/*" to ensure there are no directories that are named "*arm*" where star is a wildcard for any character.
>From 9edb551fe776d5eee5be746636d06a5a0a87d8f5 Mon Sep 17 00:00:00 2001
From: AlyElashram <alyahelashram at gmail.com>
Date: Mon, 26 May 2025 20:11:34 +0300
Subject: [PATCH 1/3] Update architecture matching for arm64 and remove todo
---
libc/cmake/modules/LLVMLibCArchitectures.cmake | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 62f3a2e3bdb59..c94a407d974df 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -33,12 +33,10 @@ function(get_arch_and_system_from_triple triple arch_var sys_var)
# value.
if(target_arch MATCHES "^mips")
set(target_arch "mips")
+ elseif(target_arch MATCHES "^aarch64|^arm64")
+ set(target_arch "aarch64")
elseif(target_arch MATCHES "^arm")
- # TODO(lntue): Shall we separate `arm64`? It is currently recognized as
- # `arm` here.
set(target_arch "arm")
- elseif(target_arch MATCHES "^aarch64")
- set(target_arch "aarch64")
elseif(target_arch MATCHES "(x86_64)|(AMD64|amd64)")
set(target_arch "x86_64")
elseif(target_arch MATCHES "(^i.86$)")
>From b9841bf8c43f7935bbef2c458b4228f2c15bb186 Mon Sep 17 00:00:00 2001
From: AlyElashram <alyahelashram at gmail.com>
Date: Mon, 26 May 2025 20:11:57 +0300
Subject: [PATCH 2/3] Update directory name from arm to aarch64 in darwin
config
---
libc/config/darwin/{arm => aarch64}/entrypoints.txt | 0
libc/config/darwin/{arm => aarch64}/headers.txt | 0
libc/src/__support/OSUtil/darwin/{arm => aarch64}/CMakeLists.txt | 0
3 files changed, 0 insertions(+), 0 deletions(-)
rename libc/config/darwin/{arm => aarch64}/entrypoints.txt (100%)
rename libc/config/darwin/{arm => aarch64}/headers.txt (100%)
rename libc/src/__support/OSUtil/darwin/{arm => aarch64}/CMakeLists.txt (100%)
diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
similarity index 100%
rename from libc/config/darwin/arm/entrypoints.txt
rename to libc/config/darwin/aarch64/entrypoints.txt
diff --git a/libc/config/darwin/arm/headers.txt b/libc/config/darwin/aarch64/headers.txt
similarity index 100%
rename from libc/config/darwin/arm/headers.txt
rename to libc/config/darwin/aarch64/headers.txt
diff --git a/libc/src/__support/OSUtil/darwin/arm/CMakeLists.txt b/libc/src/__support/OSUtil/darwin/aarch64/CMakeLists.txt
similarity index 100%
rename from libc/src/__support/OSUtil/darwin/arm/CMakeLists.txt
rename to libc/src/__support/OSUtil/darwin/aarch64/CMakeLists.txt
>From 83c16d4bbd385cdf61afc7f499c7fa7659590d67 Mon Sep 17 00:00:00 2001
From: AlyElashram <alyahelashram at gmail.com>
Date: Mon, 26 May 2025 20:12:14 +0300
Subject: [PATCH 3/3] Update syscall util to use aarch64 instead of arm name
---
libc/src/__support/OSUtil/darwin/{arm => aarch64}/syscall.h | 0
libc/src/__support/OSUtil/darwin/syscall.h | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename libc/src/__support/OSUtil/darwin/{arm => aarch64}/syscall.h (100%)
diff --git a/libc/src/__support/OSUtil/darwin/arm/syscall.h b/libc/src/__support/OSUtil/darwin/aarch64/syscall.h
similarity index 100%
rename from libc/src/__support/OSUtil/darwin/arm/syscall.h
rename to libc/src/__support/OSUtil/darwin/aarch64/syscall.h
diff --git a/libc/src/__support/OSUtil/darwin/syscall.h b/libc/src/__support/OSUtil/darwin/syscall.h
index eab96366a21a3..463407dbe19ef 100644
--- a/libc/src/__support/OSUtil/darwin/syscall.h
+++ b/libc/src/__support/OSUtil/darwin/syscall.h
@@ -15,7 +15,7 @@
#include "src/__support/macros/properties/architectures.h"
#ifdef LIBC_TARGET_ARCH_IS_ANY_ARM
-#include "arm/syscall.h"
+#include "aarch64/syscall.h"
#else
#error "Unsupported architecture"
#endif
More information about the libc-commits
mailing list