[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc bug causes parted to write bad GPT entries

From: Richard Hirst
Subject: Re: gcc bug causes parted to write bad GPT entries
Date: Tue, 19 Mar 2002 22:21:50 +0000
User-agent: Mutt/1.3.24i

On Tue, Mar 19, 2002 at 03:36:24PM -0600, address@hidden wrote:
> So, what else could ((packed)) break? :-(

It is not so bad, I think.  We only trigger it because we declare our
GUIDs as preinitialised structures.  That means the data is laid down in
.rodata, and the bug is that gcc forgets to put a .align 1 before it.
If the previous item in .rodata happens to end on something other than a
4 byte boundary then the bug triggers.  The code is generated to access
the data at the expected address (i.e. directly following the previous
.rodata entry), but when .rodata is constructed the lack of a .align
forces a default alignment of 4 to match the first element of the

So, having ((packed)) structs for the various on-disk structures, and
laying them over data buffers read from the disk isn't going to show a
problem.  Should you have a ((packed)) struct allocated in .bss, I guess
you wont have a problem - the code will access it at the right place,
.bss might possibly be laid out with a bit more space than is necessary
(but I havn't tested that theory).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]