-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Modify __int64 definition in PAL to match the OS definition #77056
Conversation
This change modifies the definition of __int64 and thus of many other types defined on the basis of it to match the OS definitions. This ensures that we can use these types in interfaces between code in coreclr and various PALs that are compiled against OS headers. The key issue was that we were defining __int64 for 64 bit OSes as long while Unix defines it as long long. The size of those types is the same on Unix, but they are different and result in different mangling of C++ names.
cc @AaronRobinsonMSFT This contributes to Win32 PAL elimination. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -195,12 +195,7 @@ extern "C" { | |||
// they must be either signed or unsigned) and we want to be able to use | |||
// __int64 as though it were intrinsic | |||
|
|||
#ifdef HOST_64BIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an error after deleting this on LoongArch64.
In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkotas
Why define the ULONG64
as unsigned long long
?
While define SIZE_T
as unsigned long
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?
Yes, it's ok for LA64 now.
Thanks.
…7056) * Modify __int64 definition in PAL to match the OS definition This change modifies the definition of __int64 and thus of many other types defined on the basis of it to match the OS definitions. This ensures that we can use these types in interfaces between code in coreclr and various PALs that are compiled against OS headers. The key issue was that we were defining __int64 for 64 bit OSes as long while Unix defines it as long long. The size of those types is the same on Unix, but they are different and result in different mangling of C++ names. * Fix coreclr tests build * Fix comment on #endif in jit.h * Reflect PR feedback * Fix jit source formatting * Fix FreeBSD build
This change modifies the definition of
__int64
and thus of many other types defined on the basis of it to match the OS definitions. This ensures that we can use these types in interfaces between code in coreclr and various PALs that are compiled against OS headers.The key issue was that we were defining
__int64
for 64 bit OSes as long while Unix defines it aslong long
. The size of those types is the same on Unix, but they are different and result in different mangling of C++ names.The changes I had to make in runtime were due to the fact that size_t and ssize_t are not defined as __int64 anymore due to the change and many places relied on the fact those matched.
The StressLog tools were defining couple of types including
size_t
on its own, which collided with the new definitions. I've fixed it by including thestdint.h
instead of defining the types manually.