Пример #1
0
        private static (string soName, IList <string> depends) Process64BitElfFile(ELF <ulong> elf)
        {
            var dynamicSection = elf.GetSections <DynamicSection <ulong> >().FirstOrDefault();

            if (dynamicSection == null)
            {
                throw new Exception($"Unable to process the ELF file '{elf}' as it does not have a Dynamic Section.");
            }

            var stringTableEntry = dynamicSection.Entries.FirstOrDefault(x => x.Tag == DynamicTag.StrTab);

            if (stringTableEntry == null)
            {
                throw new Exception($"Unable to process the ELF file '{elf}' as it does not have a Dynamic String Table.");
            }

            var dynStringTable = elf.GetSections <StringTable <ulong> >().FirstOrDefault(x => x.Offset == stringTableEntry.Value);
            var soNameEntry    = dynamicSection.Entries.FirstOrDefault(x => x.Tag == DynamicTag.SoName);
            var neededEntries  = dynamicSection.Entries.Where(x => x.Tag == DynamicTag.Needed);

            var soName = soNameEntry != null ? dynStringTable[(long)soNameEntry.Value] : null;
            var needed = neededEntries.Select(x => dynStringTable[(long)x.Value]).ToList();

            return(soName, needed);
        }
Пример #2
0
 public override void InitFromElf(ELF<uint> elf)
 {
     var bamSection = elf.GetSections<Section<uint>>().FirstOrDefault(x => x.Name == ".__bam_bootarea");
     if(bamSection != null)
     {
         var bamSectionContents = bamSection.GetContents();
         var isValidResetConfigHalfWord = bamSectionContents[1] == 0x5a;
         if(!isValidResetConfigHalfWord)
         {
             this.Log(LogLevel.Warning, "Invalid BAM section, ignoring.");
         }
         else
         {
             StartInVle = (bamSectionContents[0] & 0x1) == 1;
             this.Log(LogLevel.Info, "Will {0}start in VLE mode.", StartInVle ? "" : "not ");
         }
     }
     base.InitFromElf(elf);
 }
Пример #3
0
        public override void InitFromElf(ELF <uint> elf)
        {
            var bamSection = elf.GetSections <Section <uint> >().FirstOrDefault(x => x.Name == ".__bam_bootarea");

            if (bamSection != null)
            {
                var bamSectionContents         = bamSection.GetContents();
                var isValidResetConfigHalfWord = bamSectionContents[1] == 0x5a;
                if (!isValidResetConfigHalfWord)
                {
                    this.Log(LogLevel.Warning, "Invalid BAM section, ignoring.");
                }
                else
                {
                    StartInVle = (bamSectionContents[0] & 0x1) == 1;
                    this.Log(LogLevel.Info, "Will {0}start in VLE mode.", StartInVle ? "" : "not ");
                }
            }
            base.InitFromElf(elf);
        }