コード例 #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
ファイル: ElfReader.cs プロジェクト: tmds/LibObjectFile
 public abstract ElfSectionLink ResolveLink(ElfSectionLink link, string errorMessageFormat);