On 8/28/07, Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
Can't we do that in an easier way? Idea: struct { char misalign[1]; char magic[8]; } lar_magic __attribute__ ((aligned(16))) = { 0, "LARCHIVE" };
That should guarantee the string to be always misaligned.
My personal preference is not to depend on this type of magic. The fix I posted is really impossible to fail, and we want to guarantee no failure in this important case.
Stefan's comment about not doing stupid brute force is a good point. I am at fault for putting that in, but I did that because in the early days there were bugs in linuxbios LAR parsing code ... we need to take out the brute force.
thanks
ron