-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] fix build on aarch64 #73739
[libc] fix build on aarch64 #73739
Conversation
SchrodingerZhu
commented
Nov 29, 2023
- avoid implicit narrowing conversion
- move hsearch entrypoints to FULL_BUILD
* avoid implicit narrowing conversion * move hsearch entrypoints to FULL_BUILD
@llvm/pr-subscribers-libc Author: Schrodinger ZHU Yifan (SchrodingerZhu) Changes
Full diff: https://github.com/llvm/llvm-project/pull/73739.diff 5 Files Affected:
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index ecefa5884adb3eb..7a60c44570c4e8a 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -130,14 +130,6 @@ set(TARGET_LIBC_ENTRYPOINTS
#libc.src.stdio.scanf
#libc.src.stdio.fscanf
- # search.h entrypoints
- libc.src.search.hcreate
- libc.src.search.hcreate_r
- libc.src.search.hsearch
- libc.src.search.hsearch_r
- libc.src.search.hdestroy
- libc.src.search.hdestroy_r
-
# sys/mman.h entrypoints
libc.src.sys.mman.madvise
libc.src.sys.mman.mmap
@@ -459,6 +451,14 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.signal.sigfillset
libc.src.signal.signal
+ # search.h entrypoints
+ libc.src.search.hcreate
+ libc.src.search.hcreate_r
+ libc.src.search.hsearch
+ libc.src.search.hsearch_r
+ libc.src.search.hdestroy
+ libc.src.search.hdestroy_r
+
# threads.h entrypoints
libc.src.threads.call_once
libc.src.threads.cnd_broadcast
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index ee701c04b2e2a8a..b7783ace90a886d 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -88,15 +88,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdlib.strtoll
libc.src.stdlib.strtoul
libc.src.stdlib.strtoull
-
- # search.h entrypoints
- libc.src.search.hcreate
- libc.src.search.hcreate_r
- libc.src.search.hsearch
- libc.src.search.hsearch_r
- libc.src.search.hdestroy
- libc.src.search.hdestroy_r
-
+
# sys/mman.h entrypoints
libc.src.sys.mman.mmap
libc.src.sys.mman.munmap
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 1ccb40108bd8507..28687ef8e234e2f 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -136,14 +136,6 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdio.scanf
libc.src.stdio.fscanf
- # search.h entrypoints
- libc.src.search.hcreate
- libc.src.search.hcreate_r
- libc.src.search.hsearch
- libc.src.search.hsearch_r
- libc.src.search.hdestroy
- libc.src.search.hdestroy_r
-
# sys/mman.h entrypoints
libc.src.sys.mman.madvise
libc.src.sys.mman.mmap
@@ -492,6 +484,14 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.spawn.posix_spawn_file_actions_destroy
libc.src.spawn.posix_spawn_file_actions_init
+ # search.h entrypoints
+ libc.src.search.hcreate
+ libc.src.search.hcreate_r
+ libc.src.search.hsearch
+ libc.src.search.hsearch_r
+ libc.src.search.hdestroy
+ libc.src.search.hdestroy_r
+
# threads.h entrypoints
libc.src.threads.call_once
libc.src.threads.cnd_broadcast
diff --git a/libc/src/__support/bit.h b/libc/src/__support/bit.h
index ab2e07744a866f2..ba7fc31de1227c7 100644
--- a/libc/src/__support/bit.h
+++ b/libc/src/__support/bit.h
@@ -31,11 +31,11 @@ template <typename T> LIBC_INLINE int constexpr correct_zero(T val, int bits) {
template <typename T> LIBC_INLINE constexpr int clz(T val);
template <> LIBC_INLINE int clz<unsigned char>(unsigned char val) {
return __builtin_clz(static_cast<unsigned int>(val)) -
- 8 * (sizeof(unsigned int) - sizeof(unsigned char));
+ 8 * static_cast<int>(sizeof(unsigned int) - sizeof(unsigned char));
}
template <> LIBC_INLINE int clz<unsigned short>(unsigned short val) {
return __builtin_clz(static_cast<unsigned int>(val)) -
- 8 * (sizeof(unsigned int) - sizeof(unsigned short));
+ 8 * static_cast<int>(sizeof(unsigned int) - sizeof(unsigned short));
}
template <> LIBC_INLINE int clz<unsigned int>(unsigned int val) {
return __builtin_clz(val);
diff --git a/libc/test/src/__support/hash_test.cpp b/libc/test/src/__support/hash_test.cpp
index 612efd544c66f9f..f23a43a3bc5e4de 100644
--- a/libc/test/src/__support/hash_test.cpp
+++ b/libc/test/src/__support/hash_test.cpp
@@ -29,7 +29,7 @@ template <class T> struct AlignedMemory {
};
size_t sizes[] = {0, 1, 23, 59, 1024, 5261};
-char values[] = {0, 1, 23, 59, 102, -1};
+uint8_t values[] = {0, 1, 23, 59, 102, 255};
// Hash value should not change with different alignments.
TEST(LlvmLibcHashTest, SanityCheck) {
|
@lntue There is another seemingly strange error on x86-64: Should I try to fix it by including subparts of |
I'll investigate that error. Look like something messing up the |