b) Is there a compiler flag for gcc compiler that will pack all data structures?
But note that this option will pack everything, including structures defined in system header files, which means your program will no longer be compatible with your C library unless you also recompile your C library this way. And then you have to worry about system calls too if you have any that take structures, which means you might need to recompile parts of your kernel.
It is almost always wrong to use this option. Better is to use __attribute__ ((pack)), or #pragma pack, that way you can control what gets packed.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com