Example #1
0
        public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
        {
            ObjectDataBuilder objData = new ObjectDataBuilder(factory);
            objData.RequirePointerAlignment();
            objData.DefinedSymbols.Add(this);
            ObjectAndOffsetSymbolNode startNode = new ObjectAndOffsetSymbolNode(this, 0, "__modules_a");
            ObjectAndOffsetSymbolNode endNode = new ObjectAndOffsetSymbolNode(this, 0, "__modules_z");

            if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
            {
                // Temporary work-around for Linux / OSX until CLI is updated
                objData.DefinedSymbols.Add(startNode);
            }

            objData.EmitPointerReloc(factory.ReadyToRunHeader);

            if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
            {
                // Temporary work-around for Linux / OSX until CLI is updated
                endNode.SetSymbolOffset(objData.CountBytes);
                objData.DefinedSymbols.Add(endNode);
                objData.EmitZeroPointer();
            }

            return objData.ToObjectData();
        }
Example #2
0
        public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
        {
            ObjectDataBuilder objData = new ObjectDataBuilder(factory);

            objData.RequirePointerAlignment();
            objData.DefinedSymbols.Add(this);
            ObjectAndOffsetSymbolNode startNode = new ObjectAndOffsetSymbolNode(this, 0, "__modules_a");
            ObjectAndOffsetSymbolNode endNode   = new ObjectAndOffsetSymbolNode(this, 0, "__modules_z");

            if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
            {
                // Temporary work-around for Linux / OSX until CLI is updated
                objData.DefinedSymbols.Add(startNode);
            }

            objData.EmitPointerReloc(factory.ReadyToRunHeader);

            if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
            {
                // Temporary work-around for Linux / OSX until CLI is updated
                endNode.SetSymbolOffset(objData.CountBytes);
                objData.DefinedSymbols.Add(endNode);
                objData.EmitZeroPointer();
            }

            return(objData.ToObjectData());
        }
Example #3
0
        public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
        {
            ObjectDataBuilder objData = new ObjectDataBuilder(factory);
            objData.RequirePointerAlignment();
            objData.DefinedSymbols.Add(this);
            if (factory.Target.OperatingSystem == Internal.TypeSystem.TargetOS.OSX)
            {
                objData.EmitPointerReloc(factory.JumpThunk((ExternSymbolNode)factory.ExternSymbol("RegisterReadyToRunModule"), factory.ReadyToRunHeader));
            }
            else
            {
                objData.EmitPointerReloc(factory.ReadyToRunHeader);
            }

            return objData.ToObjectData();
        }
Example #4
0
        public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
        {
            ObjectDataBuilder objData = new ObjectDataBuilder(factory);

            objData.RequirePointerAlignment();
            objData.DefinedSymbols.Add(this);
            if (factory.Target.OperatingSystem == Internal.TypeSystem.TargetOS.OSX)
            {
                objData.EmitPointerReloc(factory.JumpThunk((ExternSymbolNode)factory.ExternSymbol("RegisterReadyToRunModule"), factory.ReadyToRunHeader));
            }
            else
            {
                objData.EmitPointerReloc(factory.ReadyToRunHeader);
            }

            return(objData.ToObjectData());
        }
Example #5
0
        public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
        {
            var builder = new ObjectDataBuilder(factory);

            builder.RequirePointerAlignment();
            builder.DefinedSymbols.Add(this);

            builder.EmitPointerReloc(_indirectedNode);

            return(builder.ToObjectData());
        }
        public override void WriteData(ref ObjectDataBuilder builder, NodeFactory factory)
        {
            MetadataType type = (MetadataType)FieldFixup.OwningType;

            // Do not support fixing up fields from external modules
            if (!factory.CompilationModuleGroup.ContainsType(type))
            {
                throw new BadImageFormatException();
            }

            ISymbolNode staticBase = FieldFixup.HasGCStaticBase ? factory.TypeGCStaticsSymbol(type) : factory.TypeNonGCStaticsSymbol(type);

            builder.EmitPointerReloc(staticBase, FieldFixup.Offset.AsInt);
        }
Example #7
0
        public override void EncodeData(ref ObjectDataBuilder dataBuilder, NodeFactory factory, bool relocsOnly)
        {
            ProfileDataNode nextElementInList = ((ProfileDataSectionNode)ContainingNode).NextElementToEncode;

            if (nextElementInList != null)
            {
                dataBuilder.EmitPointerReloc(nextElementInList, -OffsetFromStartOfObjectToSymbol);
            }
            else
            {
                dataBuilder.EmitZeroPointer();
            }

            if (relocsOnly)
            {
                return;
            }

            EcmaMethod ecmaMethod  = (EcmaMethod)_methodNode.Method.GetTypicalMethodDefinition();
            int        startOffset = dataBuilder.CountBytes;
            var        reservation = dataBuilder.ReserveInt();

            dataBuilder.EmitInt(0);                                                     // CORBBTPROF_METHOD_HEADER::cDetail
            dataBuilder.EmitInt(ecmaMethod.MetadataReader.GetToken(ecmaMethod.Handle)); // CORBBT_METHOD_INFO::token
            dataBuilder.EmitInt(_ilSize);                                               // CORBBT_METHOD_INFO::ILSize
            dataBuilder.EmitInt(_blockCount);                                           // CORBBT_METHOD_INFO::cBlock
            int sizeOfCORBBTPROF_METHOD_HEADER = dataBuilder.CountBytes - startOffset;

            Debug.Assert(sizeOfCORBBTPROF_METHOD_HEADER == (OffsetFromStartOfObjectToSymbol - _targetDetails.PointerSize));
            dataBuilder.EmitInt(reservation, sizeOfCORBBTPROF_METHOD_HEADER + _profileData.Length);

            dataBuilder.EmitBytes(_profileData);

            while ((dataBuilder.CountBytes & (dataBuilder.TargetPointerSize - 1)) != 0)
            {
                dataBuilder.EmitByte(0);
            }
        }
 public override void WriteData(ref ObjectDataBuilder builder, NodeFactory factory)
 {
     builder.EmitPointerReloc(factory.ExactCallableAddress(MethodFixup));
 }
Example #9
0
 public override void WriteData(ref ObjectDataBuilder builder, NodeFactory factory)
 {
     builder.EmitPointerReloc(factory.MethodEntrypoint(MethodFixup));
 }
Example #10
0
 public override void WriteData(ref ObjectDataBuilder builder, NodeFactory factory)
 {
     builder.EmitPointerReloc(factory.NecessaryTypeSymbol(TypeFixup));
 }