public void Eol32_CommonSymbol() { Given_SegName(".text"); Given_SegName(".data"); Given_Section(".text", SectionHeaderType.SHT_PROGBITS, ElfLoader.SHF_ALLOC | ElfLoader.SHF_EXECINSTR, new byte[] { 0xc3 }); Given_Section(".data", SectionHeaderType.SHT_PROGBITS, ElfLoader.SHF_ALLOC | ElfLoader.SHF_WRITE, new byte[] { 0x01, 0x02, 0x03, 0x04 }); Given_Symbol( "shared_global", 8, 0x4000, ElfLoader32.ELF32_ST_INFO(0, ElfSymbolType.STT_OBJECT), 0xFFF2); Given_Linker(false); linker.ComputeSegmentSizes(); Assert.AreEqual(0x4000, linker.Segments[3].p_pmemsz); }
public void Eol32_UnresolvedExternals_OwnSegment() { Given_SegName(".text"); Given_SegName(".data"); Given_Section(".text", SectionHeaderType.SHT_PROGBITS, ElfLoader.SHF_ALLOC | ElfLoader.SHF_EXECINSTR, new byte[] { 0xc3 }); Given_Section(".data", SectionHeaderType.SHT_PROGBITS, ElfLoader.SHF_ALLOC | ElfLoader.SHF_WRITE, new byte[] { 0x01, 0x02, 0x03, 0x04 }); Given_Symbol( "unresolved_global1", 0, 0, ElfLoader32.ELF32_ST_INFO(0, ElfSymbolType.STT_NOTYPE), 0); Given_Symbol( "unresolved_global2", 0, 0, ElfLoader32.ELF32_ST_INFO(0, ElfSymbolType.STT_NOTYPE), 0); Given_Linker(false); linker.ComputeSegmentSizes(); Assert.AreEqual(0x0030, linker.Segments[0].p_pmemsz, "Each external symbol is simulated with 16 bytes and added to executable section"); }