[libc-commits] [libc] [libc] Correct 'memrchr' definition and re-enable on GPU (PR #67850)
via libc-commits
libc-commits at lists.llvm.org
Fri Sep 29 13:37:01 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
<details>
<summary>Changes</summary>
Summary:
This was disabled on the GPU because it conflicted with the definition
in `glibc`. According to information online and in the `glibc`
implementation, the first argument should be a `const void *`. Fixing
this resolves the problem when exporting this to offloading languages.
---
Full diff: https://github.com/llvm/llvm-project/pull/67850.diff
2 Files Affected:
- (modified) libc/config/gpu/entrypoints.txt (+1)
- (modified) libc/spec/gnu_ext.td (+1-1)
``````````diff
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index ad68216a76b9429..839213f82a845eb 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -45,6 +45,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.string.strncmp
libc.src.string.strncpy
libc.src.string.strnlen
+ libc.src.string.memrchr
libc.src.string.strspn
libc.src.string.strtok
libc.src.string.strtok_r
diff --git a/libc/spec/gnu_ext.td b/libc/spec/gnu_ext.td
index 362add7283d6e11..dfb12419d14005b 100644
--- a/libc/spec/gnu_ext.td
+++ b/libc/spec/gnu_ext.td
@@ -69,7 +69,7 @@ def GnuExtensions : StandardSpec<"GNUExtensions"> {
FunctionSpec<
"memrchr",
RetValSpec<VoidPtr>,
- [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
+ [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
>,
FunctionSpec<
"strerror_r",
``````````
</details>
https://github.com/llvm/llvm-project/pull/67850
More information about the libc-commits
mailing list