* [PATCH 0/9] zImage fixes
@ 2011-04-28 22:50 Nicolas Pitre
2011-04-28 22:50 ` [PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned Nicolas Pitre
` (8 more replies)
0 siblings, 9 replies; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
This is a resent of some patches that were posted before, plus a couple
new ones. They were reshuffled a bit so the most important ones appear
first.
This can be pulled from the following Git repository:
git://git.linaro.org/people/nico/linux zImage_fixes
this is based on v2.6.39-rc1. This contains:
[PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned
[PATCH 2/9] ARM: zImage: Fix bad SP address after relocating kernel
[PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code
[PATCH 4/9] ARM: zImage: the page table memory must be considered before relocation
Russell: if you like those patches and pull them, I think those 4
commits should be merged in your "fixes" branch and go to Linus for the
next -rc. The rest may appear into linux-next and wait for the next merge
window:
[PATCH 5/9] ARM: zImage: no need to get the decompressed size from the filesystem
[PATCH 6/9] ARM: zImage: simplify decompress_kernel()
[PATCH 7/9] ARM: zImage: don't ignore error returned from decompress()
[PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables
[PATCH 9/9] ARM: zImage: make sure no GOTOFF relocs are used with .bss symbols
The diffstat for the entire series is:
arch/arm/boot/compressed/Makefile | 19 +++++-
arch/arm/boot/compressed/decompress.c | 4 +-
arch/arm/boot/compressed/head.S | 55 ++++++++++++-----
arch/arm/boot/compressed/misc.c | 24 +++----
arch/arm/boot/compressed/vmlinux.lds.in | 1 +
arch/arm/mach-davinci/include/mach/uncompress.h | 5 +-
arch/arm/mach-gemini/include/mach/uncompress.h | 2 +-
arch/arm/mach-iop32x/include/mach/uncompress.h | 2 +-
arch/arm/mach-iop33x/include/mach/uncompress.h | 2 +-
arch/arm/mach-ixp4xx/include/mach/uncompress.h | 2 +-
arch/arm/mach-mmp/include/mach/uncompress.h | 2 +-
arch/arm/mach-mxs/include/mach/uncompress.h | 2 +-
arch/arm/mach-ns9xxx/include/mach/uncompress.h | 2 +-
arch/arm/mach-nuc93x/include/mach/uncompress.h | 2 +-
arch/arm/mach-pxa/include/mach/uncompress.h | 6 +-
arch/arm/mach-rpc/include/mach/uncompress.h | 12 ++--
arch/arm/mach-s5p64x0/include/mach/uncompress.h | 6 +-
arch/arm/mach-ux500/include/mach/uncompress.h | 2 +-
arch/arm/mach-w90x900/include/mach/uncompress.h | 2 +-
arch/arm/plat-mxc/include/mach/uncompress.h | 2 +-
arch/arm/plat-omap/include/plat/uncompress.h | 4 +-
arch/arm/plat-samsung/include/plat/uncompress.h | 4 +-
22 files changed, 98 insertions(+), 64 deletions(-)
Nicolas
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-29 6:58 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 2/9] ARM: zImage: Fix bad SP address after relocating kernel Nicolas Pitre
` (7 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
With ARMv5+ and EABI, the compiler expects a 64-bit aligned stack so
instructions like STRD and LDRD can be used. Without this, mysterious
boot failures were seen semi randomly with the LZMA decompressor.
While at it, let's align .bss as well.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
CC: stable at kernel.org
---
arch/arm/boot/compressed/Makefile | 2 +-
arch/arm/boot/compressed/vmlinux.lds.in | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 8ebbb51..0c6852d 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -74,7 +74,7 @@ ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT)
ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS)
else
ZTEXTADDR := 0
-ZBSSADDR := ALIGN(4)
+ZBSSADDR := ALIGN(8)
endif
SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index 5309909..ea80abe 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -54,6 +54,7 @@ SECTIONS
.bss : { *(.bss) }
_end = .;
+ . = ALIGN(8); /* the stack must be 64-bit aligned */
.stack : { *(.stack) }
.stab 0 : { *(.stab) }
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/9] ARM: zImage: Fix bad SP address after relocating kernel
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
2011-04-28 22:50 ` [PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-28 22:50 ` [PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code Nicolas Pitre
` (6 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Tony Lindgren <tony@atomide.com>
Otherwise cache_clean_flush can overwrite some of the relocated
area depending on where the kernel image gets loaded. This fixes
booting on n900 after commit 6d7d0ae51574943bf571d269da3243257a2d15db
(ARM: 6750/1: improvements to compressed/head.S).
Thanks to Aaro Koskinen <aaro.koskinen@nokia.com> for debugging
the address of the relocated area that gets corrupted, and to
Nicolas Pitre <nicolas.pitre@linaro.org> for the other uncompress
related fixes.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/boot/compressed/head.S | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 84ac4d6..55a5bcb 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -253,6 +253,11 @@ restart: adr r0, LC0
/* Preserve offset to relocated code. */
sub r6, r9, r6
+#ifndef CONFIG_ZBOOT_ROM
+ /* cache_clean_flush may use the stack, so relocate it */
+ add sp, sp, r6
+#endif
+
bl cache_clean_flush
adr r0, BSYM(restart)
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
2011-04-28 22:50 ` [PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned Nicolas Pitre
2011-04-28 22:50 ` [PATCH 2/9] ARM: zImage: Fix bad SP address after relocating kernel Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-29 7:03 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 4/9] ARM: zImage: the page table memory must be considered before relocation Nicolas Pitre
` (5 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
If the zImage load address is slightly below the relocation address,
there is a risk for the copied data to overwrite the copy loop or
cache flush code that the relocation process requires. Always
bump the relocation address by the size of that code to avoid this
issue.
Noticed by Tony Lindgren <tony@atomide.com>.
While at it, let's start the copy from the restart symbol which makes
the above code size computation possible by the assembler directly,
given that we don't need to preserve the code before that point anyway.
And therefore we don't need to carry the _start pointer in r5 anymore.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/boot/compressed/head.S | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 55a5bcb..6dae179 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -187,15 +187,14 @@ not_angel:
bl cache_on
restart: adr r0, LC0
- ldmia r0, {r1, r2, r3, r5, r6, r9, r11, r12}
- ldr sp, [r0, #32]
+ ldmia r0, {r1, r2, r3, r6, r9, r11, r12}
+ ldr sp, [r0, #28]
/*
* We might be running at a different address. We need
* to fix up various pointers.
*/
sub r0, r0, r1 @ calculate the delta offset
- add r5, r5, r0 @ _start
add r6, r6, r0 @ _edata
#ifndef CONFIG_ZBOOT_ROM
@@ -214,31 +213,37 @@ restart: adr r0, LC0
/*
* Check to see if we will overwrite ourselves.
* r4 = final kernel address
- * r5 = start of this image
* r9 = size of decompressed image
* r10 = end of this image, including bss/stack/malloc space if non XIP
* We basically want:
* r4 >= r10 -> OK
- * r4 + image length <= r5 -> OK
+ * r4 + image length <= current position (pc) -> OK
*/
cmp r4, r10
bhs wont_overwrite
add r10, r4, r9
- cmp r10, r5
+ cmp r10, pc
bls wont_overwrite
/*
* Relocate ourselves past the end of the decompressed kernel.
- * r5 = start of this image
* r6 = _edata
* r10 = end of the decompressed kernel
* Because we always copy ahead, we need to do it from the end and go
* backward in case the source and destination overlap.
*/
- /* Round up to next 256-byte boundary. */
- add r10, r10, #256
+ /*
+ * Bump to the next 256-byte boundary with the size of
+ * the relocation code added. This avoids overwriting
+ * ourself when the offset is small.
+ */
+ add r10, r10, #((reloc_code_end - restart + 256) & ~255)
bic r10, r10, #255
+ /* Get start of code we want to copy and align it down. */
+ adr r5, restart
+ bic r5, r5, #31
+
sub r9, r6, r5 @ size to copy
add r9, r9, #31 @ rounded up to a multiple
bic r9, r9, #31 @ ... of 32 bytes
@@ -346,7 +351,6 @@ not_relocated: mov r0, #0
LC0: .word LC0 @ r1
.word __bss_start @ r2
.word _end @ r3
- .word _start @ r5
.word _edata @ r6
.word _image_size @ r9
.word _got_start @ r11
@@ -1075,6 +1079,7 @@ memdump: mov r12, r0
#endif
.ltorg
+reloc_code_end:
.align
.section ".stack", "aw", %nobits
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/9] ARM: zImage: the page table memory must be considered before relocation
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
` (2 preceding siblings ...)
2011-04-28 22:50 ` [PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-29 7:04 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 5/9] ARM: zImage: no need to get the decompressed size from the filesystem Nicolas Pitre
` (4 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
For correctness, the initial page table located right before the
decompressed kernel should be considered when determining if relocation
is required.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/boot/compressed/head.S | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 6dae179..4c50490 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -216,9 +216,10 @@ restart: adr r0, LC0
* r9 = size of decompressed image
* r10 = end of this image, including bss/stack/malloc space if non XIP
* We basically want:
- * r4 >= r10 -> OK
+ * r4 - 16k page directory >= r10 -> OK
* r4 + image length <= current position (pc) -> OK
*/
+ add r10, r10, #16384
cmp r4, r10
bhs wont_overwrite
add r10, r4, r9
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/9] ARM: zImage: no need to get the decompressed size from the filesystem
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
` (3 preceding siblings ...)
2011-04-28 22:50 ` [PATCH 4/9] ARM: zImage: the page table memory must be considered before relocation Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-28 22:50 ` [PATCH 6/9] ARM: zImage: simplify decompress_kernel() Nicolas Pitre
` (3 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
In commit d239b1dc093d the hardcoded 4x estimate for the decompressed
kernel size was replaced by the exact Image file size and passed to
the linker as a symbol value. Turns out that this is unneeded as the
size is already included at the end of the compressed piggy data.
For those compressed formats that don't include this data, the build
system already takes care of appending it using size_append in
scripts/Makefile.lib. So let's use that instead.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/boot/compressed/Makefile | 2 --
arch/arm/boot/compressed/head.S | 18 ++++++++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 0c6852d..79b5c62 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -98,8 +98,6 @@ endif
ccflags-y := -fpic -fno-builtin
asflags-y := -Wa,-march=all
-# Provide size of uncompressed kernel to the decompressor via a linker symbol.
-LDFLAGS_vmlinux = --defsym _image_size=$(shell stat -c "%s" $(obj)/../Image)
# Supply ZRELADDR to the decompressor via a linker symbol.
ifneq ($(CONFIG_AUTO_ZRELADDR),y)
LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 4c50490..b6eb643 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -187,7 +187,7 @@ not_angel:
bl cache_on
restart: adr r0, LC0
- ldmia r0, {r1, r2, r3, r6, r9, r11, r12}
+ ldmia r0, {r1, r2, r3, r6, r10, r11, r12}
ldr sp, [r0, #28]
/*
@@ -196,6 +196,20 @@ restart: adr r0, LC0
*/
sub r0, r0, r1 @ calculate the delta offset
add r6, r6, r0 @ _edata
+ add r10, r10, r0 @ inflated kernel size location
+
+ /*
+ * The kernel build system appends the size of the
+ * decompressed kernel at the end of the compressed data
+ * in little-endian form.
+ */
+ ldrb r9, [r10, #0]
+ ldrb lr, [r10, #1]
+ orr r9, r9, lr, lsl #8
+ ldrb lr, [r10, #2]
+ ldrb r10, [r10, #3]
+ orr r9, r9, lr, lsl #16
+ orr r9, r9, r10, lsl #24
#ifndef CONFIG_ZBOOT_ROM
/* malloc space is above the relocated stack (64k max) */
@@ -353,7 +367,7 @@ LC0: .word LC0 @ r1
.word __bss_start @ r2
.word _end @ r3
.word _edata @ r6
- .word _image_size @ r9
+ .word input_data_end - 4 @ r10 (inflated size location)
.word _got_start @ r11
.word _got_end @ ip
.word user_stack_end @ sp
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/9] ARM: zImage: simplify decompress_kernel()
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
` (4 preceding siblings ...)
2011-04-28 22:50 ` [PATCH 5/9] ARM: zImage: no need to get the decompressed size from the filesystem Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-28 22:50 ` [PATCH 7/9] ARM: zImage: don't ignore error returned from decompress() Nicolas Pitre
` (2 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
The return value for decompress_kernel() is no longer used. Furthermore,
this was obtained and stored in a variable called output_ptr which is
a complete misnomer for what is actually the size of the decompressed
kernel image. Let's get rid of it.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/boot/compressed/misc.c | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 4657e87..51b87b5 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -26,8 +26,6 @@ unsigned int __machine_arch_type;
#include <linux/linkage.h>
#include <asm/string.h>
-#include <asm/unaligned.h>
-
static void putstr(const char *ptr);
extern void error(char *x);
@@ -149,13 +147,12 @@ void *memcpy(void *__dest, __const void *__src, size_t __n)
}
/*
- * gzip delarations
+ * gzip declarations
*/
extern char input_data[];
extern char input_data_end[];
unsigned char *output_data;
-unsigned long output_ptr;
unsigned long free_mem_ptr;
unsigned long free_mem_end_ptr;
@@ -183,13 +180,11 @@ asmlinkage void __div0(void)
extern void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
-unsigned long
+void
decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
unsigned long free_mem_ptr_end_p,
int arch_id)
{
- unsigned char *tmp;
-
output_data = (unsigned char *)output_start;
free_mem_ptr = free_mem_ptr_p;
free_mem_end_ptr = free_mem_ptr_end_p;
@@ -197,12 +192,8 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
arch_decomp_setup();
- tmp = (unsigned char *) (((unsigned long)input_data_end) - 4);
- output_ptr = get_unaligned_le32(tmp);
-
putstr("Uncompressing Linux...");
do_decompress(input_data, input_data_end - input_data,
output_data, error);
putstr(" done, booting the kernel.\n");
- return output_ptr;
}
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 7/9] ARM: zImage: don't ignore error returned from decompress()
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
` (5 preceding siblings ...)
2011-04-28 22:50 ` [PATCH 6/9] ARM: zImage: simplify decompress_kernel() Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-29 7:05 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables Nicolas Pitre
2011-04-28 22:50 ` [PATCH 9/9] ARM: zImage: make sure no GOTOFF relocs are used with .bss symbols Nicolas Pitre
8 siblings, 1 reply; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
If decompress() returns an error without calling error(), we must
not attempt to boot the resulting kernel.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/boot/compressed/decompress.c | 4 ++--
arch/arm/boot/compressed/misc.c | 13 +++++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index 4c72a97..07be5a2 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -44,7 +44,7 @@ extern void error(char *);
#include "../../../../lib/decompress_unlzma.c"
#endif
-void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
+int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
{
- decompress(input, len, NULL, NULL, output, NULL, error);
+ return decompress(input, len, NULL, NULL, output, NULL, error);
}
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 51b87b5..65871a7 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -177,7 +177,7 @@ asmlinkage void __div0(void)
error("Attempting division by 0!");
}
-extern void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
+extern int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
void
@@ -185,6 +185,8 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
unsigned long free_mem_ptr_end_p,
int arch_id)
{
+ int ret;
+
output_data = (unsigned char *)output_start;
free_mem_ptr = free_mem_ptr_p;
free_mem_end_ptr = free_mem_ptr_end_p;
@@ -193,7 +195,10 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
arch_decomp_setup();
putstr("Uncompressing Linux...");
- do_decompress(input_data, input_data_end - input_data,
- output_data, error);
- putstr(" done, booting the kernel.\n");
+ ret = do_decompress(input_data, input_data_end - input_data,
+ output_data, error);
+ if (ret)
+ error("decompressor returned an error");
+ else
+ putstr(" done, booting the kernel.\n");
}
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
` (6 preceding siblings ...)
2011-04-28 22:50 ` [PATCH 7/9] ARM: zImage: don't ignore error returned from decompress() Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-29 7:07 ` Tony Lindgren
2011-04-29 20:12 ` Uwe Kleine-König
2011-04-28 22:50 ` [PATCH 9/9] ARM: zImage: make sure no GOTOFF relocs are used with .bss symbols Nicolas Pitre
8 siblings, 2 replies; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To be able to relocate the .bss section at run time independently from
the rest of the code, we must make sure that no GOTOFF relocations are
used with .bss symbols. This usually means that no global variables can
be marked static unless they're also const.
Let's remove the static qualifier from current offenders, or turn them
into const variables when possible. Next commit will ensure the build
fails if one of those is reintroduced due to otherwise enforced coding
standards for the kernel.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/mach-davinci/include/mach/uncompress.h | 5 +++--
arch/arm/mach-gemini/include/mach/uncompress.h | 2 +-
arch/arm/mach-iop32x/include/mach/uncompress.h | 2 +-
arch/arm/mach-iop33x/include/mach/uncompress.h | 2 +-
arch/arm/mach-ixp4xx/include/mach/uncompress.h | 2 +-
arch/arm/mach-mmp/include/mach/uncompress.h | 2 +-
arch/arm/mach-mxs/include/mach/uncompress.h | 2 +-
arch/arm/mach-ns9xxx/include/mach/uncompress.h | 2 +-
arch/arm/mach-nuc93x/include/mach/uncompress.h | 2 +-
arch/arm/mach-pxa/include/mach/uncompress.h | 6 +++---
arch/arm/mach-rpc/include/mach/uncompress.h | 12 ++++++------
arch/arm/mach-s5p64x0/include/mach/uncompress.h | 6 +++---
arch/arm/mach-ux500/include/mach/uncompress.h | 2 +-
arch/arm/mach-w90x900/include/mach/uncompress.h | 2 +-
arch/arm/plat-mxc/include/mach/uncompress.h | 2 +-
arch/arm/plat-omap/include/plat/uncompress.h | 4 ++--
arch/arm/plat-samsung/include/plat/uncompress.h | 4 ++--
17 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index 47723e8..78d8068 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -25,8 +25,7 @@
#include <mach/serial.h>
-static u32 *uart;
-static u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
+u32 *uart;
/* PORT_16C550A, in polled non-fifo mode */
static void putc(char c)
@@ -44,6 +43,8 @@ static inline void flush(void)
static inline void set_uart_info(u32 phys, void * __iomem virt)
{
+ u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
+
uart = (u32 *)phys;
uart_info[0] = phys;
uart_info[1] = (u32)virt;
diff --git a/arch/arm/mach-gemini/include/mach/uncompress.h b/arch/arm/mach-gemini/include/mach/uncompress.h
index 5483f61..0efa262 100644
--- a/arch/arm/mach-gemini/include/mach/uncompress.h
+++ b/arch/arm/mach-gemini/include/mach/uncompress.h
@@ -16,7 +16,7 @@
#include <linux/serial_reg.h>
#include <mach/hardware.h>
-static volatile unsigned long *UART = (unsigned long *)GEMINI_UART_BASE;
+static volatile unsigned long * const UART = (unsigned long *)GEMINI_UART_BASE;
/*
* The following code assumes the serial port has already been
diff --git a/arch/arm/mach-iop32x/include/mach/uncompress.h b/arch/arm/mach-iop32x/include/mach/uncompress.h
index b247551..4fd7154 100644
--- a/arch/arm/mach-iop32x/include/mach/uncompress.h
+++ b/arch/arm/mach-iop32x/include/mach/uncompress.h
@@ -7,7 +7,7 @@
#include <linux/serial_reg.h>
#include <mach/hardware.h>
-static volatile u8 *uart_base;
+volatile u8 *uart_base;
#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
diff --git a/arch/arm/mach-iop33x/include/mach/uncompress.h b/arch/arm/mach-iop33x/include/mach/uncompress.h
index b42423f..f99bb84 100644
--- a/arch/arm/mach-iop33x/include/mach/uncompress.h
+++ b/arch/arm/mach-iop33x/include/mach/uncompress.h
@@ -7,7 +7,7 @@
#include <linux/serial_reg.h>
#include <mach/hardware.h>
-static volatile u32 *uart_base;
+volatile u32 *uart_base;
#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
diff --git a/arch/arm/mach-ixp4xx/include/mach/uncompress.h b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
index 2db0078..219d7c1 100644
--- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
+++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
@@ -19,7 +19,7 @@
#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE)
-static volatile u32* uart_base;
+volatile u32* uart_base;
static inline void putc(int c)
{
diff --git a/arch/arm/mach-mmp/include/mach/uncompress.h b/arch/arm/mach-mmp/include/mach/uncompress.h
index 85bd8a2..d6daeb7 100644
--- a/arch/arm/mach-mmp/include/mach/uncompress.h
+++ b/arch/arm/mach-mmp/include/mach/uncompress.h
@@ -14,7 +14,7 @@
#define UART2_BASE (APB_PHYS_BASE + 0x17000)
#define UART3_BASE (APB_PHYS_BASE + 0x18000)
-static volatile unsigned long *UART;
+volatile unsigned long *UART;
static inline void putc(char c)
{
diff --git a/arch/arm/mach-mxs/include/mach/uncompress.h b/arch/arm/mach-mxs/include/mach/uncompress.h
index f12a173..7f8bf65 100644
--- a/arch/arm/mach-mxs/include/mach/uncompress.h
+++ b/arch/arm/mach-mxs/include/mach/uncompress.h
@@ -20,7 +20,7 @@
#include <asm/mach-types.h>
-static unsigned long mxs_duart_base;
+unsigned long mxs_duart_base;
#define MXS_DUART(x) (*(volatile unsigned long *)(mxs_duart_base + (x)))
diff --git a/arch/arm/mach-ns9xxx/include/mach/uncompress.h b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
index 770a68c..00ef4a6 100644
--- a/arch/arm/mach-ns9xxx/include/mach/uncompress.h
+++ b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
@@ -20,7 +20,7 @@ static void putc_dummy(char c, void __iomem *base)
/* nothing */
}
-static int timeout;
+int timeout;
static void putc_ns9360(char c, void __iomem *base)
{
diff --git a/arch/arm/mach-nuc93x/include/mach/uncompress.h b/arch/arm/mach-nuc93x/include/mach/uncompress.h
index 73082cd..381cb9b 100644
--- a/arch/arm/mach-nuc93x/include/mach/uncompress.h
+++ b/arch/arm/mach-nuc93x/include/mach/uncompress.h
@@ -27,7 +27,7 @@
#define arch_decomp_wdog()
#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
-static u32 * uart_base = (u32 *)UART0_PA;
+static u32 * const uart_base = (u32 *)UART0_PA;
static void putc(int ch)
{
diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
index 759b851..5519a34 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -16,9 +16,9 @@
#define BTUART_BASE (0x40200000)
#define STUART_BASE (0x40700000)
-static unsigned long uart_base;
-static unsigned int uart_shift;
-static unsigned int uart_is_pxa;
+unsigned long uart_base;
+unsigned int uart_shift;
+unsigned int uart_is_pxa;
static inline unsigned char uart_read(int offset)
{
diff --git a/arch/arm/mach-rpc/include/mach/uncompress.h b/arch/arm/mach-rpc/include/mach/uncompress.h
index 8c9e2c7..9cd9bcd 100644
--- a/arch/arm/mach-rpc/include/mach/uncompress.h
+++ b/arch/arm/mach-rpc/include/mach/uncompress.h
@@ -66,12 +66,12 @@ extern __attribute__((pure)) struct param_struct *params(void);
#define params (params())
#ifndef STANDALONE_DEBUG
-static unsigned long video_num_cols;
-static unsigned long video_num_rows;
-static unsigned long video_x;
-static unsigned long video_y;
-static unsigned char bytes_per_char_v;
-static int white;
+unsigned long video_num_cols;
+unsigned long video_num_rows;
+unsigned long video_x;
+unsigned long video_y;
+unsigned char bytes_per_char_v;
+int white;
/*
* This does not append a newline
diff --git a/arch/arm/mach-s5p64x0/include/mach/uncompress.h b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
index c65b229..1608faf 100644
--- a/arch/arm/mach-s5p64x0/include/mach/uncompress.h
+++ b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
@@ -24,8 +24,8 @@ typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
/* uart setup */
-static unsigned int fifo_mask;
-static unsigned int fifo_max;
+unsigned int fifo_mask;
+unsigned int fifo_max;
/* forward declerations */
@@ -43,7 +43,7 @@ static void arch_detect_cpu(void);
/* how many bytes we allow into the FIFO at a time in FIFO mode */
#define FIFO_MAX (14)
-static unsigned long uart_base;
+unsigned long uart_base;
static __inline__ void get_uart_base(void)
{
diff --git a/arch/arm/mach-ux500/include/mach/uncompress.h b/arch/arm/mach-ux500/include/mach/uncompress.h
index ab0fe14..088b550 100644
--- a/arch/arm/mach-ux500/include/mach/uncompress.h
+++ b/arch/arm/mach-ux500/include/mach/uncompress.h
@@ -24,7 +24,7 @@
#include <linux/amba/serial.h>
#include <mach/hardware.h>
-static u32 ux500_uart_base;
+u32 ux500_uart_base;
static void putc(const char c)
{
diff --git a/arch/arm/mach-w90x900/include/mach/uncompress.h b/arch/arm/mach-w90x900/include/mach/uncompress.h
index 56f1a74..0313021 100644
--- a/arch/arm/mach-w90x900/include/mach/uncompress.h
+++ b/arch/arm/mach-w90x900/include/mach/uncompress.h
@@ -27,7 +27,7 @@
#define arch_decomp_wdog()
#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
-static volatile u32 * uart_base = (u32 *)UART0_PA;
+static volatile u32 * const uart_base = (u32 *)UART0_PA;
static void putc(int ch)
{
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
index 4864b0a..d85e2d1 100644
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -21,7 +21,7 @@
#include <asm/mach-types.h>
-static unsigned long uart_base;
+unsigned long uart_base;
#define UART(x) (*(volatile unsigned long *)(uart_base + (x)))
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 30b891c..565d266 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -27,8 +27,8 @@
#define MDR1_MODE_MASK 0x07
-static volatile u8 *uart_base;
-static int uart_shift;
+volatile u8 *uart_base;
+int uart_shift;
/*
* Store the DEBUG_LL uart number into memory.
diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h
index 7d6ed72..ee48e12 100644
--- a/arch/arm/plat-samsung/include/plat/uncompress.h
+++ b/arch/arm/plat-samsung/include/plat/uncompress.h
@@ -18,8 +18,8 @@ typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
/* uart setup */
-static unsigned int fifo_mask;
-static unsigned int fifo_max;
+unsigned int fifo_mask;
+unsigned int fifo_max;
/* forward declerations */
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 9/9] ARM: zImage: make sure no GOTOFF relocs are used with .bss symbols
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
` (7 preceding siblings ...)
2011-04-28 22:50 ` [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables Nicolas Pitre
@ 2011-04-28 22:50 ` Nicolas Pitre
2011-04-29 7:11 ` Tony Lindgren
8 siblings, 1 reply; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-28 22:50 UTC (permalink / raw)
To: linux-arm-kernel
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To be able to relocate the .bss section at run time independently from
the rest of the code, we must make sure that no GOTOFF relocations are
used with .bss symbols. This usually means that no global variables can
be marked static unless they're also const.
To enforce this, suffice to fail the build whenever a private symbol
is allocated to .bss and list those symbols for convenience.
The user_stack and user_stack_end labels in head.S were converted into
non exported symbols to remove false positives.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/boot/compressed/Makefile | 15 ++++++++++++++-
arch/arm/boot/compressed/head.S | 6 +++---
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 79b5c62..23aad07 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -120,10 +120,23 @@ lib1funcs = $(obj)/lib1funcs.o
$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
$(call cmd,shipped)
+# We need to prevent any GOTOFF relocs being used with references
+# to symbols in the .bss section since we cannot relocate them
+# independently from the rest at run time. This can be achieved by
+# ensuring that no private .bss symbols exist, as global symbols
+# always have a GOT entry which is what we need.
+# The .data section is already discarded by the linker script so no need
+# to bother about it here.
+check_for_bad_syms = \
+bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
+[ -z "$$bad_syms" ] || \
+ ( echo "following symbols must have non local/private scope:" >&2; \
+ echo "$$bad_syms" >&2; rm -f $@; false )
+
$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
$(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
$(call if_changed,ld)
- @:
+ @$(check_for_bad_syms)
$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
$(call if_changed,$(suffix_y))
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index b6eb643..dfaaae0 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -370,7 +370,7 @@ LC0: .word LC0 @ r1
.word input_data_end - 4 @ r10 (inflated size location)
.word _got_start @ r11
.word _got_end @ ip
- .word user_stack_end @ sp
+ .word .L_user_stack_end @ sp
.size LC0, . - LC0
#ifdef CONFIG_ARCH_RPC
@@ -1098,5 +1098,5 @@ reloc_code_end:
.align
.section ".stack", "aw", %nobits
-user_stack: .space 4096
-user_stack_end:
+.L_user_stack: .space 4096
+.L_user_stack_end:
--
1.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned
2011-04-28 22:50 ` [PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned Nicolas Pitre
@ 2011-04-29 6:58 ` Tony Lindgren
0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2011-04-29 6:58 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110428 15:47]:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
>
> With ARMv5+ and EABI, the compiler expects a 64-bit aligned stack so
> instructions like STRD and LDRD can be used. Without this, mysterious
> boot failures were seen semi randomly with the LZMA decompressor.
>
> While at it, let's align .bss as well.
>
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Tested-by: Shawn Guo <shawn.guo@linaro.org>
> CC: stable at kernel.org
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code
2011-04-28 22:50 ` [PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code Nicolas Pitre
@ 2011-04-29 7:03 ` Tony Lindgren
0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2011-04-29 7:03 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110428 15:47]:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
>
> If the zImage load address is slightly below the relocation address,
> there is a risk for the copied data to overwrite the copy loop or
> cache flush code that the relocation process requires. Always
> bump the relocation address by the size of that code to avoid this
> issue.
>
> Noticed by Tony Lindgren <tony@atomide.com>.
>
> While at it, let's start the copy from the restart symbol which makes
> the above code size computation possible by the assembler directly,
> given that we don't need to preserve the code before that point anyway.
> And therefore we don't need to carry the _start pointer in r5 anymore.
>
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Cool, this works for my test case:
Tested-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4/9] ARM: zImage: the page table memory must be considered before relocation
2011-04-28 22:50 ` [PATCH 4/9] ARM: zImage: the page table memory must be considered before relocation Nicolas Pitre
@ 2011-04-29 7:04 ` Tony Lindgren
0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2011-04-29 7:04 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110428 15:47]:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
>
> For correctness, the initial page table located right before the
> decompressed kernel should be considered when determining if relocation
> is required.
>
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Tested-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 7/9] ARM: zImage: don't ignore error returned from decompress()
2011-04-28 22:50 ` [PATCH 7/9] ARM: zImage: don't ignore error returned from decompress() Nicolas Pitre
@ 2011-04-29 7:05 ` Tony Lindgren
0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2011-04-29 7:05 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110428 15:47]:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
>
> If decompress() returns an error without calling error(), we must
> not attempt to boot the resulting kernel.
>
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables
2011-04-28 22:50 ` [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables Nicolas Pitre
@ 2011-04-29 7:07 ` Tony Lindgren
2011-04-29 20:12 ` Uwe Kleine-König
1 sibling, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2011-04-29 7:07 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110428 15:47]:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
>
> To be able to relocate the .bss section at run time independently from
> the rest of the code, we must make sure that no GOTOFF relocations are
> used with .bss symbols. This usually means that no global variables can
> be marked static unless they're also const.
>
> Let's remove the static qualifier from current offenders, or turn them
> into const variables when possible. Next commit will ensure the build
> fails if one of those is reintroduced due to otherwise enforced coding
> standards for the kernel.
>
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
This fixes the DT data corruption issue I was seeing with the DT
append patch.
Tested-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 9/9] ARM: zImage: make sure no GOTOFF relocs are used with .bss symbols
2011-04-28 22:50 ` [PATCH 9/9] ARM: zImage: make sure no GOTOFF relocs are used with .bss symbols Nicolas Pitre
@ 2011-04-29 7:11 ` Tony Lindgren
0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2011-04-29 7:11 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110428 15:47]:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
>
> To be able to relocate the .bss section at run time independently from
> the rest of the code, we must make sure that no GOTOFF relocations are
> used with .bss symbols. This usually means that no global variables can
> be marked static unless they're also const.
>
> To enforce this, suffice to fail the build whenever a private symbol
> is allocated to .bss and list those symbols for convenience.
>
> The user_stack and user_stack_end labels in head.S were converted into
> non exported symbols to remove false positives.
>
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Marking something static in uncompress.h now fails with this patch, so:
Tested-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables
2011-04-28 22:50 ` [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables Nicolas Pitre
2011-04-29 7:07 ` Tony Lindgren
@ 2011-04-29 20:12 ` Uwe Kleine-König
2011-04-29 20:37 ` Nicolas Pitre
1 sibling, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2011-04-29 20:12 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 28, 2011 at 06:50:23PM -0400, Nicolas Pitre wrote:
> From: Nicolas Pitre <nicolas.pitre@linaro.org>
>
> To be able to relocate the .bss section at run time independently from
> the rest of the code, we must make sure that no GOTOFF relocations are
> used with .bss symbols. This usually means that no global variables can
> be marked static unless they're also const.
>
> Let's remove the static qualifier from current offenders, or turn them
> into const variables when possible. Next commit will ensure the build
> fails if one of those is reintroduced due to otherwise enforced coding
> standards for the kernel.
>
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> ---
> arch/arm/mach-davinci/include/mach/uncompress.h | 5 +++--
> arch/arm/mach-gemini/include/mach/uncompress.h | 2 +-
> arch/arm/mach-iop32x/include/mach/uncompress.h | 2 +-
> arch/arm/mach-iop33x/include/mach/uncompress.h | 2 +-
> arch/arm/mach-ixp4xx/include/mach/uncompress.h | 2 +-
> arch/arm/mach-mmp/include/mach/uncompress.h | 2 +-
> arch/arm/mach-mxs/include/mach/uncompress.h | 2 +-
> arch/arm/mach-ns9xxx/include/mach/uncompress.h | 2 +-
mach-ns9xxx is about to be removed. So maybe just drop the corresponding
hunk.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables
2011-04-29 20:12 ` Uwe Kleine-König
@ 2011-04-29 20:37 ` Nicolas Pitre
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Pitre @ 2011-04-29 20:37 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 29 Apr 2011, Uwe Kleine-K?nig wrote:
> On Thu, Apr 28, 2011 at 06:50:23PM -0400, Nicolas Pitre wrote:
> > From: Nicolas Pitre <nicolas.pitre@linaro.org>
> >
> > To be able to relocate the .bss section at run time independently from
> > the rest of the code, we must make sure that no GOTOFF relocations are
> > used with .bss symbols. This usually means that no global variables can
> > be marked static unless they're also const.
> >
> > Let's remove the static qualifier from current offenders, or turn them
> > into const variables when possible. Next commit will ensure the build
> > fails if one of those is reintroduced due to otherwise enforced coding
> > standards for the kernel.
> >
> > Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> > ---
> > arch/arm/mach-davinci/include/mach/uncompress.h | 5 +++--
> > arch/arm/mach-gemini/include/mach/uncompress.h | 2 +-
> > arch/arm/mach-iop32x/include/mach/uncompress.h | 2 +-
> > arch/arm/mach-iop33x/include/mach/uncompress.h | 2 +-
> > arch/arm/mach-ixp4xx/include/mach/uncompress.h | 2 +-
> > arch/arm/mach-mmp/include/mach/uncompress.h | 2 +-
> > arch/arm/mach-mxs/include/mach/uncompress.h | 2 +-
> > arch/arm/mach-ns9xxx/include/mach/uncompress.h | 2 +-
> mach-ns9xxx is about to be removed. So maybe just drop the corresponding
> hunk.
Well, this is probably the easiest kind of merge conflict to solve, so
unless I have other changes to make to this series I'll just leave it
there for now.
Nicolas
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2011-04-29 20:37 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-28 22:50 [PATCH 0/9] zImage fixes Nicolas Pitre
2011-04-28 22:50 ` [PATCH 1/9] ARM: zImage: make sure the stack is 64-bit aligned Nicolas Pitre
2011-04-29 6:58 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 2/9] ARM: zImage: Fix bad SP address after relocating kernel Nicolas Pitre
2011-04-28 22:50 ` [PATCH 3/9] ARM: zImage: make sure not to relocate on top of the relocation code Nicolas Pitre
2011-04-29 7:03 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 4/9] ARM: zImage: the page table memory must be considered before relocation Nicolas Pitre
2011-04-29 7:04 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 5/9] ARM: zImage: no need to get the decompressed size from the filesystem Nicolas Pitre
2011-04-28 22:50 ` [PATCH 6/9] ARM: zImage: simplify decompress_kernel() Nicolas Pitre
2011-04-28 22:50 ` [PATCH 7/9] ARM: zImage: don't ignore error returned from decompress() Nicolas Pitre
2011-04-29 7:05 ` Tony Lindgren
2011-04-28 22:50 ` [PATCH 8/9] ARM: zImage: remove the static qualifier from global data variables Nicolas Pitre
2011-04-29 7:07 ` Tony Lindgren
2011-04-29 20:12 ` Uwe Kleine-König
2011-04-29 20:37 ` Nicolas Pitre
2011-04-28 22:50 ` [PATCH 9/9] ARM: zImage: make sure no GOTOFF relocs are used with .bss symbols Nicolas Pitre
2011-04-29 7:11 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).