summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTanner Gooding <tagoo@outlook.com>2018-01-21 16:06:00 -0800
committerTanner Gooding <tagoo@outlook.com>2018-01-27 11:37:12 -0800
commit7121570db6f356277647ebaa6d2185da489403e5 (patch)
treedf1e779bdfd685e06ec59884d8234cfe9d08a186 /src
parent1ad63ccad774377063eea4892c504d7ca3bf84ea (diff)
downloadcoreclr-7121570db6f356277647ebaa6d2185da489403e5.tar.gz
coreclr-7121570db6f356277647ebaa6d2185da489403e5.tar.bz2
coreclr-7121570db6f356277647ebaa6d2185da489403e5.zip
Updating the methodtablebuilder to handle the System V ABI packing requirements for i386
Diffstat (limited to 'src')
-rw-r--r--src/vm/fieldmarshaler.h8
-rw-r--r--src/vm/methodtablebuilder.cpp17
2 files changed, 20 insertions, 5 deletions
diff --git a/src/vm/fieldmarshaler.h b/src/vm/fieldmarshaler.h
index f11c81b896..2d11068f15 100644
--- a/src/vm/fieldmarshaler.h
+++ b/src/vm/fieldmarshaler.h
@@ -84,13 +84,11 @@ enum NStructFieldType
//=======================================================================
// Magic number for default struct packing size.
+//
+// Currently we set this to the packing size of the largest supported
+// fundamental type and let the field marshaller downsize where needed.
//=======================================================================
-#if defined(_TARGET_X86_) && defined(UNIX_X86_ABI)
-// A double is 4-byte aligned on GCC (without -malign-dobule)
-#define DEFAULT_PACKING_SIZE 4
-#else // _TARGET_X86_ && UNIX_X86_ABI
#define DEFAULT_PACKING_SIZE 8
-#endif // !_TARGET_X86_ || !UNIX_X86_ABI
//=======================================================================
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 43071609cc..f48e2a7b71 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -9594,6 +9594,23 @@ void MethodTableBuilder::CheckForSystemTypes()
pMT->SetInternalCorElementType(type);
pMT->SetIsTruePrimitive();
+#if defined(_TARGET_X86_) && defined(UNIX_X86_ABI)
+ switch (type)
+ {
+ // The System V ABI for i386 defines different packing for these types.
+
+ case ELEMENT_TYPE_I8:
+ case ELEMENT_TYPE_U8:
+ case ELEMENT_TYPE_R8:
+ {
+ EEClassLayoutInfo * pLayout = pClass->GetLayoutInfo();
+ pLayout->m_LargestAlignmentRequirementOfAllMembers = 4;
+ pLayout->m_ManagedLargestAlignmentRequirementOfAllMembers = 4;
+ break;
+ }
+ }
+#endif // _TARGET_X86_ && UNIX_X86_ABI
+
#ifdef _DEBUG
if (FAILED(GetMDImport()->GetNameOfTypeDef(GetCl(), &name, &nameSpace)))
{