Пример #1
0
        public DwarfSections(Compiler compiler, ElfLinker elfLinker)
        {
            Compiler   = compiler;
            Linker     = compiler.Linker;
            TypeSystem = compiler.TypeSystem;

            elfLinker.RegisterSection(new Section
            {
                Name    = ".debug_info",
                Type    = SectionType.ProgBits,
                Emitter = () => { return(EmitDebugInfo()); }
            });

            elfLinker.RegisterSection(new Section
            {
                Name    = ".debug_abbrev",
                Type    = SectionType.ProgBits,
                Emitter = () => { return(EmitDebugAbbrev()); }
            });

            elfLinker.RegisterSection(new Section
            {
                Name    = ".debug_line",
                Type    = SectionType.ProgBits,
                Emitter = () => { return(EmitDebugLine()); }
            });
        }
Пример #2
0
        public MosaLinker(Compiler compiler)
        {
            Compiler = compiler;

            LinkerSettings = new LinkerSettings(compiler.CompilerSettings.Settings);

            LinkerFormatType = LinkerSettings.LinkerFormat.ToLower() == "elf64" ? LinkerFormatType.Elf64 : LinkerFormatType.Elf32;

            ElfLinker = new ElfLinker(this, LinkerFormatType, compiler.Architecture.ElfMachineType);

            AddSection(new LinkerSection(SectionKind.Text));
            AddSection(new LinkerSection(SectionKind.Data));
            AddSection(new LinkerSection(SectionKind.ROData));
            AddSection(new LinkerSection(SectionKind.BSS));
        }
Пример #3
0
        public BaseLinker(ulong baseAddress, Endianness endianness, MachineType machineType, bool emitSymbols, LinkerFormatType linkerFormatType)
        {
            LinkerSections = new LinkerSection[4];

            BaseAddress = baseAddress;
            Endianness  = endianness;
            MachineType = machineType;
            EmitSymbols = emitSymbols;

            elfLinker = new ElfLinker(this, LinkerFormatType);

            BaseFileOffset   = elfLinker.BaseFileOffset;
            SectionAlignment = elfLinker.SectionAlignment;

            AddSection(new LinkerSection(SectionKind.Text, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.Data, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.ROData, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.BSS, SectionAlignment));
        }
Пример #4
0
        public BaseLinker(ulong baseAddress, Endianness endianness, MachineType machineType, bool emitSymbols, LinkerFormatType linkerFormatType)
        {
            LinkerSections = new LinkerSection[4];

            BaseAddress = baseAddress;
            Endianness = endianness;
            MachineType = machineType;
            EmitSymbols = emitSymbols;

            elfLinker = new ElfLinker(this, LinkerFormatType);

            BaseFileOffset = elfLinker.BaseFileOffset;
            SectionAlignment = elfLinker.SectionAlignment;

            AddSection(new LinkerSection(SectionKind.Text, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.Data, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.ROData, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.BSS, SectionAlignment));
        }
Пример #5
0
        public MosaLinker(ulong baseAddress, MachineType machineType, bool emitAllSymbols, bool emitStaticRelocations, LinkerFormatType linkerFormatType, CreateExtraSectionsDelegate createExtraSections, CreateExtraProgramHeaderDelegate createExtraProgramHeaders)
        {
            BaseAddress               = baseAddress;
            MachineType               = machineType;
            EmitAllSymbols            = emitAllSymbols;
            EmitStaticRelocations     = emitStaticRelocations;
            LinkerFormatType          = linkerFormatType;
            CreateExtraSections       = createExtraSections;
            CreateExtraProgramHeaders = createExtraProgramHeaders;

            elfLinker = new ElfLinker(this, LinkerFormatType);

            BaseFileOffset   = elfLinker.BaseFileOffset;
            SectionAlignment = elfLinker.SectionAlignment;

            AddSection(new LinkerSection(SectionKind.Text, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.Data, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.ROData, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.BSS, SectionAlignment));
        }