No, it doesn't. It starts at file offset 0x8D0 and is 0x8730 bytes in length. When the load loads this PE file, it allocates a memory range large enough to hold the entire image (all sections together). Let's assume this memory range starts at address 1M. It starts loading the sections one by one at this address (actually, Windows places the PE headers first at this address, so the first section won't be loaded at 1M, but 1M+256 bytes or whatever. But let's ignore this). This address is the base address. The sections will be loaded at base address + LMA, and if paging is used, they will appear at base address + VMA.Sam111 wrote:
Assuming I have a PE and search it to find that .data , .text begain atSo .text begins at 000010d0.Code: Select all
Sections: Idx Name Size VMA LMA File off Algn 0 .text 00008730 000010d0 000010d0 000008d0 2**4 CONTENTS, ALLOC, LOAD, CODE 1 .data 00000e00 00009800 00009800 00009000 2**4 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00003400 0000a600 0000a600 00000000 2**2 ALLOC 3 .comment 00000010 0000da00 0000da00 00009e00 2**2 CONTENTS, DEBUGGING
If you mean it's virtual address (the address the application "sees"), then it starts at load address + 0x10d0.
However, if you consider an object file (which is NOT a PE file as you wrote), the linker combines all code, data and rdata sections to one big code, data and rdata section respectively (all code segments from all object files will be combined into one large code segment. All data segments from all object files will be combined into one large data segment, and so on). Then the linker calculates the addresses of the symbols, and resolves references to the symbols. But I already wrote that.
You set the load address to 0x3456 and recalculate the base addresses of each section, then copy the sections there and perform base relocations (this is actually the step that gathers most of the hate towards PE). If that wasn't the answer to your question, then I didn't understand what you wrote.Sam111 wrote: Also If I want to load it to some other memory address say 00003456. I would first have to find the entry point symbol in the symbol table then find it's memory size then update it with 00003456. And then we would have the next symbol at 00003456 + size of starting entry = next need to be updated symbol.
I would guess symbol 731 is defined in section 1 (-1 means external if I remember correctly), which has flags 0, is at the specified address and has the specified name.Sam111 wrote: Don't know what all this crap means belowCode: Select all
[731](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1)... important stuff like start address symbol name...