[all-commits] [llvm/llvm-project] f05ae4: [libclang/python] Fix visitor callback return data...
Milad Fa via All-commits
all-commits at lists.llvm.org
Thu Sep 24 07:01:35 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f05ae447f56404dce7b43145676242d63e0734f4
https://github.com/llvm/llvm-project/commit/f05ae447f56404dce7b43145676242d63e0734f4
Author: Milad Fa <mfarazma at ibm.com>
Date: 2026-09-24 (Thu, 24 Sep 2026)
Changed paths:
M clang/bindings/python/clang/cindex.py
M clang/bindings/python/tests/cindex/test_cursor.py
M clang/docs/ReleaseNotes.md
Log Message:
-----------
[libclang/python] Fix visitor callback return data type (#221024)
Declare the visitor callbacks return as c_long, i.e. a full register
word rather than c_int.
This is currently causing an issue on s390x, a 64-bit big-endian target.
The V8 JavaScript engine has recently started using libclang as a
dependency
to parse header files. It is currently crashing on s390x with a SIGFPE
due to this issue.
Both the s390x ELF ABI and libffi require the value to be sign/zero
extended to register
size, and leaving it as `c_int` leaves garbage on the high side.
cindex.py calls into libclang through ctypes, which builds the callback
closures using
libffi. With a `c_int` return, ctypes writes only the low 32 bits and
skips the extension
that both the ABI and libffi's closure contract require, so libffi hands
libclang a register
whose high bits are garbage.
Using c_long makes the value fill the register at its native width on
all platforms.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list