[libc-commits] [PATCH] D157792: [libc] Fix compilation on 32-bit systems

Mikhail Ramalho via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Aug 12 11:09:25 PDT 2023


mikhail.ramalho created this revision.
mikhail.ramalho added reviewers: michaelrj, sivachandra.
Herald added subscribers: libc-commits, asb.
Herald added projects: libc-project, All.
mikhail.ramalho requested review of this revision.

This fixes the following compilation error: no known conversion from 'off_t *'
(aka 'long long *') to 'long' for 5th argument.

Since pointers are 32-bit long anyway, casting it to long shouldn't be a
problem. Tested on rv32.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157792

Files:
  libc/src/unistd/linux/lseek.cpp


Index: libc/src/unistd/linux/lseek.cpp
===================================================================
--- libc/src/unistd/linux/lseek.cpp
+++ libc/src/unistd/linux/lseek.cpp
@@ -26,7 +26,7 @@
 #elif defined(SYS_llseek)
   long ret = __llvm_libc::syscall_impl(SYS_llseek, fd,
                                        (long)(((uint64_t)(offset)) >> 32),
-                                       (long)offset, &result, whence);
+                                       (long)offset, (long)&result, whence);
   result = ret;
 #elif defined(SYS__llseek)
   int ret = __llvm_libc::syscall_impl<int>(SYS__llseek, fd, offset >> 32,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157792.549635.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230812/02f8e180/attachment.bin>


More information about the libc-commits mailing list