[FREELDR]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 19 Jul 2010 23:18:31 +0000 (23:18 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 19 Jul 2010 23:18:31 +0000 (23:18 +0000)
commit2a5f6261a53bb35a7316444ea66c6249bebef33e
treee70b06c3f8d7f3e0d5f96be47651698630ec7d8c
parentde85efc5ed21ff2d86c70e2802c6fd1699792359
[FREELDR]
Convert freeldr and setupldr to PE format.
Previously freeldr was a raw binary file, which made handling by the bootsector very easy, but it disqualified it from proper debugging with gdb using symbols. This is possible with having unstripped PE files.
As we don't have any space to do proper PE loading from the bootsector (I already had to trim some strings to get enough space for the new jump code), we need to make sure, that the PE file doesn't contain a .bss section, which is achieved by a linker script. The next thing is to make sure, we don't have any symbols in the output file, because they would make freeldr too big to be loaded into memory and they are useless anyway. On the other hand we like to keep the symbols in the .nostrip.sys files if requested, as this is the primary purpose. This is in theory not a problem, as we could simply strip the file at the end, but binutils throw a monkey wrench in our plans: both strip and objcopy disrespect the file alignment and create unaligned sections, that don't naturally match their VAs. This is solved by hacking rbuild to do invoke ld 2 times, one time without and one time with the symbols (if requested).
Now the bootsectors also got some changes: instead of jumping to the loading address (0x8000) they get the address of the entry point from the image optional header. This is slightly simplified, by assuming the NtHeader begins at offset 0xE0. This finally allows source level debugging of freeldr with gdb.

svn path=/trunk/; revision=48124
reactos/boot/freeldr/bootsect/ext2.asm
reactos/boot/freeldr/bootsect/fat.asm
reactos/boot/freeldr/bootsect/fat32.asm
reactos/boot/freeldr/bootsect/isoboot.asm
reactos/boot/freeldr/freeldr/freeldr.rbuild
reactos/boot/freeldr/freeldr/freeldr_i386.lnk [new file with mode: 0644]
reactos/boot/freeldr/freeldr/setupldr.rbuild
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/module.cpp