Exemplo n.º 1
0
        public override ElfRelocation LoadRelaEntry(EndianImageReader rdr)
        {
            var rela = Elf32_Rela.Read(rdr);

            return(new ElfRelocation
            {
                Offset = rela.r_offset,
                Info = rela.r_info,
                Addend = rela.r_addend,
                SymbolIndex = (int)(rela.r_info >> 8)
            });
        }
Exemplo n.º 2
0
 public override void Relocate(Program program)
 {
     DumpRela32(loader);
     foreach (var relSection in loader.Sections.Where(s => s.Type == SectionHeaderType.SHT_RELA))
     {
         var symbols          = loader.Symbols[relSection.LinkedSection];
         var referringSection = relSection.RelocatedSection;
         var rdr = loader.CreateReader(relSection.FileOffset);
         for (uint i = 0; i < relSection.EntryCount(); ++i)
         {
             var rela = Elf32_Rela.Read(rdr);
             var sym  = symbols[(int)(rela.r_info >> 8)];
             RelocateEntry(program, sym, referringSection, rela);
         }
     }
 }
Exemplo n.º 3
0
        protected void DumpRela32(ElfLoader32 loader)
        {
            foreach (var section in loader.Sections.Where(s => s.Type == SectionHeaderType.SHT_RELA))
            {
                Debug.Print("RELA: offset {0:X} link section {1}",
                            section.FileOffset,
                            section.LinkedSection.Name);

                var symbols = loader.Symbols[section.LinkedSection];
                var rdr     = loader.CreateReader(section.FileOffset);
                for (uint i = 0; i < section.EntryCount(); ++i)
                {
                    var rela = Elf32_Rela.Read(rdr);
                    Debug.Print("  off:{0:X8} type:{1,-16} add:{3,-20} {4,3} {2}",
                                rela.r_offset,
                                (SparcRt)(rela.r_info & 0xFF),
                                symbols[(int)(rela.r_info >> 8)].Name,
                                rela.r_addend,
                                (int)(rela.r_info >> 8));
                }
            }
        }