* [Linux-ia64] [Patch] 2/2 fix in machvec.h
@ 2003-02-24 18:21 Siddha, Suresh B
2003-02-24 20:30 ` Jim Wilson
0 siblings, 1 reply; 2+ messages in thread
From: Siddha, Suresh B @ 2003-02-24 18:21 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]
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
--- linux/include/asm-ia64/machvec.h~ Thu Feb 20 13:51:48 2003
+++ linux/include/asm-ia64/machvec.h Thu Feb 20 13:59:35 2003
@@ -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) \
{ \
[-- Attachment #2: machvec.diff --]
[-- Type: application/octet-stream, Size: 692 bytes --]
--- linux/include/asm-ia64/machvec.h~ Thu Feb 20 13:51:48 2003
+++ linux/include/asm-ia64/machvec.h Thu Feb 20 13:59:35 2003
@@ -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) \
{ \
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Linux-ia64] [Patch] 2/2 fix in machvec.h
2003-02-24 18:21 [Linux-ia64] [Patch] 2/2 fix in machvec.h Siddha, Suresh B
@ 2003-02-24 20:30 ` Jim Wilson
0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2003-02-24 20:30 UTC (permalink / raw)
To: linux-ia64
On Mon, 2003-02-24 at 13:21, Siddha, Suresh B wrote:
> IA64 ABI specifies that globals > 8 bytes need to be aligned to 16
bytes.
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-24 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-24 18:21 [Linux-ia64] [Patch] 2/2 fix in machvec.h Siddha, Suresh B
2003-02-24 20:30 ` Jim Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox