ftp.delorie.com/djgpp/bugs/show.cgi | search |
While trying to compile the DLL.CC program, I noticed that some of the structure sizes in COFF.H are wrong. For example, sizeof(struct external_scnhdr) returns 20 when the actual size of the header in an object file is 18. I added up the sizes of all the elements and that came out to 18, so I have no idea where the extra two bytes are coming from... The external_reloc structure exhibits the strange behavior (2 extra "phantom" bytes) also, but the rest of them seem to work fine.
Oops, sorry about that. It looks like the carriage returns aren't automatically added.
It's kind of kludgy, but if you replace fread(syment, filhdr.f_nsyms, SYMESZ, file); with for (t = 0; t < filhdr.f_nsyms; t++) fread(&syment[t], 1, 18, file); It works fine. You can't just enter the size manually e.g. fread(syment, 1, 18, file); because it appears that it is taking up 20 bytes in memory, also.
Are you sure you aren't being confused by the way in which DJGPP aligns structure members? Check chapter 22.9 of the FAQ.
You're right, it's the alignment. Using -fpack-struct fixes the problem... I guess just be sure and specify that when reading in multiple structs from disk.
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |