are statically allocated structs always aligned to a machine word on x86/x86_64?

Mike Frysinger
Fri Aug 21 17:06:00 GMT 2015

On 21 Aug 2015 17:54, john smith wrote:
> I didn't find any information about alignment requirements for
> statically allocated objects in glibc manual (or I have missed because
> the manual is huge). I noted that sometimes variables such as int are
> not aligned on word boundary in x86 and x86_64 but I have never seen a
> struct that wouldn't be allocated at address that isn't a multiple or
> 4/8. I am asking this question because I would like to know whether
> it's safe to assume that struct will be always assigned at a word
> boundary and therefore it's possible to correctly calculate a struct
> size without running a program.

glibc isn't involved here which is why you won't find documentation.
this is covered by the respective architecture ABIs and enforced by
gcc (and then respected by binutils).  you might want to try the gcc
help mailing lists:

the x86-64 ABI is documented here:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <>

More information about the Libc-help mailing list