2/2 fix in machvec.h
PATCH 1/1 2/2 fix in machvec.h
IA64 ABI specifies that globals > 8 bytes need to be aligned to 16 bytes. gcc doesn't follow this convention. Current kernel code will fail to work with a compiler which follows the ABI.
size of structure ia64_machine_vector is > 8 bytes and not multiple of 16 bytes. When we have CONFIG_IA64_GENERIC, each machine specific vector from different object files gets linked into a user defined section(forming array of structures).
Now with a compiler conforming to ABI, there will be holes in this array resulting in the code failure when it goes through this array of structures.
Following patch will make the size of the structure to be multiple of 16 bytes, making both ABI confirming/non-conforming compilers happy.
thanks,
suresh
include/asm-ia64/machvec.h renamed from include/asm-ia64/machvec.h~ +6 -1
@@ -113,6 +113,11 @@# define platofrm_mmiob ia64_mv.mmiob# endif +/* __attribute__((__aligned__(16))) is required to make size of the +* structure multiple of 16 bytes. +* This will fillup the holes created because of section 3.3.1 in +* Software Conventions guide. +*/ struct ia64_machine_vector {const char *name;ia64_mv_setup_t *setup;
@@ -145,7 +150,7 @@ia64_mv_outw_t *outw;ia64_mv_outl_t *outl;ia64_mv_mmiob_t *mmiob; -}; +} __attribute__((__aligned__(16)));#define MACHVEC_INIT (name) \ { \
include/asm-ia64/machvec.h renamed from include/asm-ia64/machvec.h~ +6 -1
@@ -113,6 +113,11 @@# define platofrm_mmiob ia64_mv.mmiob# endif +/* __attribute__((__aligned__(16))) is required to make size of the +* structure multiple of 16 bytes. +* This will fillup the holes created because of section 3.3.1 in +* Software Conventions guide. +*/ struct ia64_machine_vector {const char *name;ia64_mv_setup_t *setup;
@@ -145,7 +150,7 @@ia64_mv_outw_t *outw;ia64_mv_outl_t *outl;ia64_mv_mmiob_t *mmiob; -}; +} __attribute__((__aligned__(16)));#define MACHVEC_INIT (name) \ { \
Quoted 1 line · Suresh B
IA64 ABI specifies that globals > 8 bytes need to be aligned to 16
bytes.
Quoted 1 line
gcc doesn't follow this convention.
That looks like an usual part of the ABI that was missed in the original gcc port. The ABI states that structures have a certain alignment in one place, and then in a different place it states that global variables have a possibly larger alignment. Thus the alignment of a structure depends on whether it is a local or global variable. I am not familiar with any other ABI that has this requirement. It should be only the alignment of global variables of structure or array type that are wrong.
I don't think that there is any way to get the right behavior from gcc without modifying the variable alignment code to add a new hook for this special case. This change may create incompatibilities, which means it may be a difficult change to make without breaking existing linux distros.
Jim