Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

[arm32 unix] The test Hello fails on arm32 because of difference between initializing and using structures #2780

@sergign60

Description

@sergign60

The test Hello fails on arm32 because of difference between the initializing and using structures

The initializing structure for example in the following function supposes that the offset of the first pointer field equals to 24 bytes

MethodTable * System_Private_CoreLib::System::Object::__getMethodTable()
{
        static struct {
        unsigned char data0[24];
        void* reloc1;
        void* reloc2;
        void* reloc3;
        void* reloc4;

        } mt = {
                {0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xC1,0xB9,0x38,0xB7},
              __typemanager_indirection(),
              (void*)&System_Private_CoreLib::System::Object::ToString,
              (void*)&System_Private_CoreLib::System::Object::GetHashCode,
              (void*)&System_Private_CoreLib::System::Object::Equals,
        };
        return ( MethodTable * )&mt;
}

but in the using structure from the file (src/Native/Runtime/inc/eetype.h)

class EEType
{
...
#ifdef RHDUMP
public:
#else
private:
#endif
    struct RelatedTypeUnion
    {
        union 
        {
            // Kinds.CanonicalEEType
            EEType*     m_pBaseType;
            EEType**    m_ppBaseTypeViaIAT;

            // Kinds.ClonedEEType
            EEType** m_pCanonicalType;
            EEType** m_ppCanonicalTypeViaIAT;

            // Kinds.ParameterizedEEType
            EEType*  m_pRelatedParameterType;
            EEType** m_ppRelatedParameterTypeViaIAT;
#if defined(RHDUMP) || defined(BINDER)
            UIntTarget m_ptrVal;  // ensure this structure is the right size in cross-build scenarios
#endif // defined(RHDUMP) || defined(BINDER)
        };
    };

    UInt16              m_usComponentSize;
    UInt16              m_usFlags;
    UInt32              m_uBaseSize;
    RelatedTypeUnion    m_RelatedType;
    UInt16              m_usNumVtableSlots;
    UInt16              m_usNumInterfaces;
    UInt32              m_uHashCode;
#if defined(EETYPE_TYPE_MANAGER)
    TypeManagerHandle*  m_ppTypeManager;
#endif
    TgtPTR_Void         m_VTable[];  // make this explicit so the binder gets the right alignment

the offset of the first pointer field (m_ppTypeManager) equals to 20 bytes on arm32.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions