Пример #1
0
        public override ElfSectionLink ResolveLink(ElfSectionLink link, string errorMessageFormat)
        {
            if (errorMessageFormat == null)
            {
                throw new ArgumentNullException(nameof(errorMessageFormat));
            }

            // Connect section Link instance
            if (!link.IsSpecial)
            {
                if (link.SpecialIndex == _sectionStringTableIndex)
                {
                    link = new ElfSectionLink(ObjectFile.SectionHeaderStringTable);
                }
                else
                {
                    var sectionIndex = link.SpecialIndex;

                    bool sectionFound = false;
                    foreach (var section in ObjectFile.Sections)
                    {
                        if (section.SectionIndex == sectionIndex)
                        {
                            link         = new ElfSectionLink(section);
                            sectionFound = true;
                            break;
                        }
                    }

                    if (!sectionFound)
                    {
                        Diagnostics.Error(DiagnosticId.ELF_ERR_InvalidResolvedLink, string.Format(errorMessageFormat, link.SpecialIndex));
                    }
                }
            }

            return(link);
        }
Пример #2
0
 public abstract ElfSectionLink ResolveLink(ElfSectionLink link, string errorMessageFormat);