diff options
author | Konstantin Baladurin <k.baladurin@partner.samsung.com> | 2018-04-16 21:11:41 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-04-16 11:11:41 -0700 |
commit | af74af2f4a01341fce78bcaac370d497f4f511b1 (patch) | |
tree | c87ede1b55e2ca5e3f08bfe04a2ab01a81fa9935 /src/vm/fieldmarshaler.cpp | |
parent | ae51c7aab9ce5f6b30642848d444893a521441f1 (diff) | |
download | coreclr-af74af2f4a01341fce78bcaac370d497f4f511b1.tar.gz coreclr-af74af2f4a01341fce78bcaac370d497f4f511b1.tar.bz2 coreclr-af74af2f4a01341fce78bcaac370d497f4f511b1.zip |
[x86/Linux] Fix marshalling struct with 64-bit types (#17455)
* [x86/Linux] Fix marshalling struct with 64-bit types
The System V ABI for i386 defines 4-byte alignment for 64-bit types.
* [Linux/x86] Fix marshalling tests in the case of System V i386 ABI
Diffstat (limited to 'src/vm/fieldmarshaler.cpp')
-rw-r--r-- | src/vm/fieldmarshaler.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vm/fieldmarshaler.cpp b/src/vm/fieldmarshaler.cpp index 1e24399e30..dfbbb9aebb 100644 --- a/src/vm/fieldmarshaler.cpp +++ b/src/vm/fieldmarshaler.cpp @@ -285,7 +285,27 @@ do \ if (CorTypeInfo::IsPrimitiveType(corElemType)) { pfwalk->m_managedSize = ((UINT32)CorTypeInfo::Size(corElemType)); // Safe cast - no primitive type is larger than 4gb! +#if defined(_TARGET_X86_) && defined(UNIX_X86_ABI) + switch (corElemType) + { + // The System V ABI for i386 defines different packing for these types. + case ELEMENT_TYPE_I8: + case ELEMENT_TYPE_U8: + case ELEMENT_TYPE_R8: + { + pfwalk->m_managedAlignmentReq = 4; + break; + } + + default: + { + pfwalk->m_managedAlignmentReq = pfwalk->m_managedSize; + break; + } + } +#else // _TARGET_X86_ && UNIX_X86_ABI pfwalk->m_managedAlignmentReq = pfwalk->m_managedSize; +#endif } else if (corElemType == ELEMENT_TYPE_PTR) { |