Title: [8862] trunk: FLAT: split the stack & data alignments
- Revision
- 8862
- Author
- vapier
- Date
- 2010-05-28 14:21:37 -0400 (Fri, 28 May 2010)
Log Message
FLAT: split the stack & data alignments
The stack and data have different alignment requirements, so don't force
them to wear the same shoe. Increase the data alignment to match that
which the elf2flt linker script has always been using: 0x20 bytes. Not
only does this bring the kernel loader in line with the toolchain, but
it also fixes a swath of gcc tests which try to force larger alignment
values but ultimately fail.
(this reverts Jie's previous ARCH_FLAT_DATA_ALIGN patch and supports
that requirement a different way)
Modified Paths
Diff
Modified: trunk/arch/blackfin/include/asm/flat.h (8861 => 8862)
--- trunk/arch/blackfin/include/asm/flat.h 2010-05-28 18:16:50 UTC (rev 8861)
+++ trunk/arch/blackfin/include/asm/flat.h 2010-05-28 18:21:37 UTC (rev 8862)
@@ -11,8 +11,6 @@
#include <asm/unaligned.h>
-#define ARCH_FLAT_DATA_ALIGN 0x20
-
#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
Modified: trunk/fs/binfmt_flat.c (8861 => 8862)
--- trunk/fs/binfmt_flat.c 2010-05-28 18:16:50 UTC (rev 8861)
+++ trunk/fs/binfmt_flat.c 2010-05-28 18:21:37 UTC (rev 8862)
@@ -57,20 +57,22 @@
#endif
/*
- * User data (stack, data section and bss) needs to be aligned.
- * If ARCH_FLAT_DATA_ALIGN is defined, use it.
+ * User data (data section and bss) needs to be aligned.
+ * We pick 0x20 here because it is the max value elf2flt has always
+ * used in producing FLAT files, and because it seems to be large
+ * enough to make all the gcc alignment related tests happy.
*/
-#ifdef ARCH_FLAT_DATA_ALIGN
-#define FLAT_DATA_ALIGN (ARCH_FLAT_DATA_ALIGN)
-/* Otherwise user data nees to be aligned for the same reasons
- * as SLAB memory is aligned, and to the same amount.
- * Avoid duplicating architecture specific code by using the same
- * macro as with SLAB allocation:
+#define FLAT_DATA_ALIGN (0x20)
+
+/*
+ * User data (stack) also needs to be aligned.
+ * Here we can be a bit looser than the data sections since this
+ * needs to only meet arch ABI requirements.
*/
-#elif defined(ARCH_SLAB_MINALIGN)
-#define FLAT_DATA_ALIGN (ARCH_SLAB_MINALIGN)
+#ifdef ARCH_SLAB_MINALIGN
+#define FLAT_STACK_ALIGN (ARCH_SLAB_MINALIGN)
#else
-#define FLAT_DATA_ALIGN (sizeof(void *))
+#define FLAT_STACK_ALIGN (sizeof(void *))
#endif
#define RELOC_FAILED 0xff00ff01 /* Relocation incorrect somewhere */
@@ -135,7 +137,7 @@
sp = (unsigned long *)p;
sp -= (envc + argc + 2) + 1 + (flat_argvp_envp_on_stack() ? 2 : 0);
- sp = (unsigned long *) ((unsigned long)sp & -FLAT_DATA_ALIGN);
+ sp = (unsigned long *) ((unsigned long)sp & -FLAT_STACK_ALIGN);
argv = sp + 1 + (flat_argvp_envp_on_stack() ? 2 : 0);
envp = argv + (argc + 1);
@@ -910,7 +912,7 @@
stack_len = TOP_OF_ARGS - bprm->p; /* the strings */
stack_len += (bprm->argc + 1) * sizeof(char *); /* the argv array */
stack_len += (bprm->envc + 1) * sizeof(char *); /* the envp array */
- stack_len += FLAT_DATA_ALIGN - 1; /* reserve for upcoming alignment */
+ stack_len += FLAT_STACK_ALIGN - 1; /* reserve for upcoming alignment */
l1stack_base = 0;
res = load_flat_file(bprm, &libinfo, 0, &stack_len, &l1stack_base);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits