AddDependency() публичный Метод

public AddDependency ( Section section ) : void
section Section
Результат void
Пример #1
0
        private void CreateStringSection()
        {
            stringSection.Name             = ".strtab";
            stringSection.Type             = SectionType.StringTable;
            stringSection.AddressAlignment = linker.SectionAlignment;
            stringSection.EmitMethod       = WriteStringSection;

            AddSection(stringSection);

            sectionHeaderStringSection.AddDependency(stringSection);
        }
Пример #2
0
        protected void CreateRelocationSection(SectionKind kind, bool addend)
        {
            var relocationSection = new Section();

            relocationSection.Name             = (addend ? ".rela" : ".rel") + LinkerSectionNames[(int)kind];
            relocationSection.Type             = addend ? SectionType.RelocationA : SectionType.Relocation;
            relocationSection.Link             = symbolSection;
            relocationSection.Info             = GetSection(kind);
            relocationSection.AddressAlignment = linker.SectionAlignment;
            relocationSection.EntrySize        = (uint)(addend ? RelocationAddendEntry.GetEntrySize(linkerFormatType) : RelocationEntry.GetEntrySize(linkerFormatType));
            relocationSection.EmitMethod       = WriteRelocationSection;

            AddSection(relocationSection);

            relocationSection.AddDependency(symbolSection);
            relocationSection.AddDependency(GetSection(kind));
        }
Пример #3
0
        private void CreateSymbolSection()
        {
            symbolSection.Name             = ".symtab";
            symbolSection.Type             = SectionType.SymbolTable;
            symbolSection.AddressAlignment = linker.SectionAlignment;
            symbolSection.EntrySize        = SymbolEntry.GetEntrySize(linkerFormatType);
            symbolSection.Link             = stringSection;

            //symbolSection.Info = sectionHeaderStringSection;
            symbolSection.EmitMethod = WriteSymbolSection;

            AddSection(symbolSection);

            stringSection.AddDependency(symbolSection);
            sectionHeaderStringSection.AddDependency(symbolSection);
        }
Пример #4
0
        private void CreateSections()
        {
            CreateNullSection();

            Section previous = nullSection;

            foreach (var linkerSection in linker.LinkerSections)
            {
                if (linkerSection.Size == 0 && linkerSection.SectionKind != SectionKind.BSS)
                {
                    continue;
                }

                var section = new Section()
                {
                    Name             = LinkerSectionNames[(int)linkerSection.SectionKind],
                    Address          = linkerSection.VirtualAddress,
                    Offset           = linkerSection.FileOffset,
                    Size             = linkerSection.AlignedSize,
                    AddressAlignment = linkerSection.SectionAlignment,
                    EmitMethod       = WriteLinkerSection,
                    SectionKind      = linkerSection.SectionKind
                };
                switch (linkerSection.SectionKind)
                {
                case SectionKind.Text:
                    section.Type  = SectionType.ProgBits;
                    section.Flags = SectionAttribute.AllocExecute;
                    break;

                case SectionKind.Data:
                    section.Type  = SectionType.ProgBits;
                    section.Flags = SectionAttribute.Alloc | SectionAttribute.Write;
                    break;

                case SectionKind.ROData:
                    section.Type  = SectionType.ProgBits;
                    section.Flags = SectionAttribute.Alloc;
                    break;

                case SectionKind.BSS:
                    section.Type  = SectionType.NoBits;
                    section.Flags = SectionAttribute.Alloc | SectionAttribute.Write;
                    break;
                }

                section.AddDependency(previous);

                AddSection(section);

                previous = section;
            }

            if (linker.EmitSymbols)
            {
                CreateSymbolSection();
                CreateStringSection();

                CreateRelocationSections();
            }

            CreateSectionHeaderStringSection();
        }