parisc: strip debug information when building compressed images
PATCH 1/1 parisc: strip debug information when building compressed images
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28: arch/parisc/boot/compressed/vmlinux] Error 1 make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17: arch/parisc/boot/compressed/vmlinux] Error 2 make[2]: Target 'arch/parisc/boot/bzImage' not remade because of errors.
While this might also be fixed by adjusting the linker script, i think we should strip the debug information when generating the compressed image. This reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full debug information is enabled.
--- arch/parisc/boot/compressed/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/parisc/boot/compressed/Makefile +4 -1
@@ -55,8 +55,11 @@ $(obj)/misc.o: $(obj)/sizes.h CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER $(obj)/vmlinux.lds: $(obj)/sizes.h +quiet_cmd_objcopy_strip_debug = OBJCOPY_STRIP_DEBUG $@ + cmd_objcopy_strip_debug = $(OBJCOPY) --strip-debug $< $@ + $(obj)/vmlinux.bin: vmlinux - $(call if_changed,objcopy) + $(call if_changed,objcopy_strip_debug) vmlinux.bin.all-y := $(obj)/vmlinux.bin
Signature · 1 line
2.20.1
Helge Deller
maintainer* Sven Schnelle <[email protected]>:
Quoted 11 lines
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [
/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28:arch/parisc/boot/compressed/vmlinux] Error 1 make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17:arch/parisc/boot/compressed/vmlinux] Error 2 make[2]: Target 'arch/parisc/boot/bzImage' not remade because of errors.While this might also be fixed by adjusting the linker script, i think we should strip the debug information when generating the compressed image. This reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full debug information is enabled.
I think keeping debug info is good.
Can you test this patch instead?
It converts a 141MB vmlinux boot file (with debug info) to a 32M vmlinuz for me.
Ideally I would prefer something like
. = MIN_OR_HIGHER_THAN_CURRENT_ADDR((SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START));
to avoid the ifdef, but I'm missing the linker script expert knowledge...
Helge
------------------------
[PATCH] parisc: Allow building a compressed vmlinuz with CONFIG_DEBUG_INFO enabled.
arch/parisc/boot/compressed/vmlinux.lds.S +3 -0
@@ -49,7 +49,10 @@ SECTIONS } /* bootloader code and data starts behind area of extracted kernel */ +#if !defined(CONFIG_DEBUG_INFO) + /* ensure at least max address when compiled without debug info: */ . = (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START); +#endif /* align on next page boundary */ . = ALIGN(4096);
Helge Deller
maintainer* Helge Deller <[email protected]>:
Quoted 13 lines
* Sven Schnelle <[email protected]>:
Quoted 11 lines
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [
/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28:arch/parisc/boot/compressed/vmlinux] Error 1 make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17:arch/parisc/boot/compressed/vmlinux] Error 2 make[2]: Target 'arch/parisc/boot/bzImage' not remade because of errors.While this might also be fixed by adjusting the linker script, i think we should strip the debug information when generating the compressed image. This reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full debug information is enabled.
Quoted 7 lines
I think keeping debug info is good.
Can you test this patch instead?
It converts a 141MB vmlinux boot file (with debug info) to a 32M vmlinuz for me.Ideally I would prefer something like
. =MIN_OR_HIGHER_THAN_CURRENT_ADDR((SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START));
to avoid the ifdef, but I'm missing the linker script expert knowledge...
Here is an updated patch without ifdefs:
Helge
arch/parisc/boot/compressed/vmlinux.lds.S +2 -2
@@ -48,8 +48,8 @@ SECTIONS *(.rodata.compressed) } - /* bootloader code and data starts behind area of extracted kernel */ - . = (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START); + /* bootloader code and data starts at least behind area of extracted kernel */ + . = MAX(ABSOLUTE(.), (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START)); /* align on next page boundary */ . = ALIGN(4096);
Hi Helge,
Quoted 30 lines · Helge Deller
* Helge Deller <[email protected]>:
Quoted 13 lines
* Sven Schnelle <[email protected]>:
Quoted 11 lines
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [
/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28:arch/parisc/boot/compressed/vmlinux] Error 1 make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17:arch/parisc/boot/compressed/vmlinux] Error 2 make[2]: Target 'arch/parisc/boot/bzImage' not remade because of errors.While this might also be fixed by adjusting the linker script, i think we should strip the debug information when generating the compressed image. This reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full debug information is enabled.
Quoted 7 lines
I think keeping debug info is good.
Can you test this patch instead?
It converts a 141MB vmlinux boot file (with debug info) to a 32M vmlinuz for me.Ideally I would prefer something like
. =MIN_OR_HIGHER_THAN_CURRENT_ADDR((SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START));
to avoid the ifdef, but I'm missing the linker script expert knowledge...Here is an updated patch without ifdefs:
Helgearch/parisc/boot/compressed/vmlinux.lds.S +0
-0
arch/parisc/boot/compressed/vmlinux.lds.S SECTIONS · line 55
Quoted 10 lines
arch/parisc/boot/compressed/vmlinux.lds.S +2
-2@@ -48,8 +48,8 @@ SECTIONS *(.rodata.compressed) } - /* bootloader code and data starts behind area of extracted kernel */ - . = (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START); + /* bootloader code and data starts at least behind area of extracted kernel */ + . = MAX(ABSOLUTE(.), (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START)); /* align on next page boundary */ . = ALIGN(4096);
With full debug and a 64 Bit Build i get now (vmlinux is 128M):
LD vmlinux SORTEX vmlinux SYSMAP System.map
/sbin/palo -f ./palo.conf
palo version 2.00 http://www.parisc-linux.org - Mon, 01 Jan 2018 21:07:58 +0100
uncompressing Linux kernel................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ Decompression error:
uncompressed image too long - wouldn't fit into destination
vmlinuz is not a recognizable executable (ELF32 or ELF64)
make[1]: *** [arch/parisc/Makefile:130: lifimage] Error 2
make[1]: Leaving directory '/home/svens/parisc-linux/build64'
make: *** [Makefile:179: sub-make] Error 2
Helge Deller
maintainerQuoted 46 lines · Sven Schnelle
Hi Helge,
Quoted 30 lines · Helge Deller
* Helge Deller <[email protected]>:
Quoted 13 lines
* Sven Schnelle <[email protected]>:
Quoted 11 lines
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [
/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28:arch/parisc/boot/compressed/vmlinux] Error 1 make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17:arch/parisc/boot/compressed/vmlinux] Error 2 make[2]: Target 'arch/parisc/boot/bzImage' not remade because of errors.While this might also be fixed by adjusting the linker script, i think we should strip the debug information when generating the compressed image. This reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full debug information is enabled.
Quoted 7 lines
I think keeping debug info is good.
Can you test this patch instead?
It converts a 141MB vmlinux boot file (with debug info) to a 32M vmlinuz for me.Ideally I would prefer something like
. =MIN_OR_HIGHER_THAN_CURRENT_ADDR((SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START));
to avoid the ifdef, but I'm missing the linker script expert knowledge...Here is an updated patch without ifdefs:
Helgearch/parisc/boot/compressed/vmlinux.lds.S +0
-0arch/parisc/boot/compressed/vmlinux.lds.S SECTIONS · line 55
Quoted 10 lines
arch/parisc/boot/compressed/vmlinux.lds.S +2
-2@@ -48,8 +48,8 @@ SECTIONS *(.rodata.compressed) } - /* bootloader code and data starts behind area of extracted kernel */ - . = (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START); + /* bootloader code and data starts at least behind area of extracted kernel */ + . = MAX(ABSOLUTE(.), (SZ_end - SZparisc_kernel_start + KERNEL_BINARY_TEXT_START)); /* align on next page boundary */ . = ALIGN(4096);With full debug and a 64 Bit Build i get now (vmlinux is 128M):
Quoted 8 lines
LD vmlinux SORTEX vmlinux SYSMAP System.map
/sbin/palo-f ./palo.conf
palo version 2.00 http://www.parisc-linux.org - Mon, 01 Jan 2018 21:07:58 +0100
uncompressing Linux kernel................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ Decompression error:
uncompressed image too long - wouldn't fit into destination
You are using the built-in palo gzip decompression function.
Please don't use it, it is an old (not bug-free) implementation which got replaced by the kernel self-decompressor.
My palo.conf in the build dir has:
--init-tape=lifimage
--recoverykernel=vmlinuz
and setCONFIG_PARISC_SELF_EXTRACT=y
in .config.
Helge
Hi Helge,
Quoted 10 lines · Helge Deller
Quoted 1 line · Sven Schnelle
uncompressed image too long - wouldn't fit into destination
You are using the built-in palo gzip decompression function.
Please don't use it, it is an old (not bug-free) implementation which got replaced by the kernel self-decompressor.
My palo.conf in the build dir has:
--init-tape=lifimage
--recoverykernel=vmlinuz
Quoted 3 lines
and set
CONFIG_PARISC_SELF_EXTRACT=y
in .config.
Thanks. I had the palo option (probably because they are default), but missed the Kernel option. The lifimage is now 28MB in size, and your patch works for me.
Thanks!
Sven
James Bottomley
maintainerQuoted 55 lines · Helge Deller
* Sven Schnelle <[email protected]>:
Quoted 15 lines
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [
/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28:arch/parisc/boot/compressed/vmlinux] Error 1
make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17:arch/parisc/boot/compressed/vmlinux] Error 2
make[2]: Target 'arch/parisc/boot/bzImage' not remade because of errors.Quoted 7 lines
While this might also be fixed by adjusting the linker script, i think we
should strip the debug information when generating the compressed image. This
reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full debug
information is enabled.I think keeping debug info is good.
Can you test this patch instead?
It converts a 141MB vmlinux boot file (with debug info) to a 32M vmlinuz for me.Ideally I would prefer something like
. = MIN_OR_HIGHER_THAN_CURRENT_ADDR((SZ_end -SZparisc_kernel_start
+KERNEL_BINARY_TEXT_START));
to avoid the ifdef, but I'm missing the linker script expert knowledge...Helge
------------------------
[PATCH] parisc: Allow building a compressed vmlinuz withCONFIG_DEBUG_INFOenabled.Signed-off-by Helge Deller <[email protected]>arch/parisc/boot/compressed/vmlinux.lds.S +0
-0@@ -49,7 +49,10 @@ SECTIONS } /* bootloader code and data starts behind area of extractedkernel */
arch/parisc/boot/compressed/vmlinux.lds.S +2
-0+#if !defined(CONFIG_DEBUG_INFO) + /* ensure at least max address when compiled without debug
Quoted 4 lines
info: */
. = (SZ_end-SZparisc_kernel_start+KERNEL_BINARY_TEXT_START);
+#endif
This would cause the kernel to be built in a single section for the !defined(CONFIG_DEBUG_INFO) case, meaning we'd always blow through the 0x00100000-end text hole we need to leave for the compressed kernel to decompress into.
James
Helge Deller
maintainerQuoted 52 lines · James Bottomley
Quoted 51 lines · Helge Deller
* Sven Schnelle <[email protected]>:
Quoted 15 lines
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [
/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28:arch/parisc/boot/compressed/vmlinux] Error 1
make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17:arch/parisc/boot/compressed/vmlinux] Error 2
make[2]: Target 'arch/parisc/boot/bzImage' not remade because of errors.Quoted 7 lines
While this might also be fixed by adjusting the linker script, i think we
should strip the debug information when generating the compressed image. This
reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full debug
information is enabled.I think keeping debug info is good.
Can you test this patch instead?
It converts a 141MB vmlinux boot file (with debug info) to a 32M vmlinuz for me.Ideally I would prefer something like
. = MIN_OR_HIGHER_THAN_CURRENT_ADDR((SZ_end -SZparisc_kernel_start
+KERNEL_BINARY_TEXT_START));
to avoid the ifdef, but I'm missing the linker script expert knowledge...Helge
------------------------
[PATCH] parisc: Allow building a compressed vmlinuz withCONFIG_DEBUG_INFOenabled.Signed-off-by Helge Deller <[email protected]>arch/parisc/boot/compressed/vmlinux.lds.S +0
-0@@ -49,7 +49,10 @@ SECTIONS }
Quoted 10 lines
Quoted 8 lines
arch/parisc/boot/compressed/vmlinux.lds.S +0
-0/* bootloader code and data starts behind area of extractedkernel */
arch/parisc/boot/compressed/vmlinux.lds.S +2
-0+#if !defined(CONFIG_DEBUG_INFO) + /* ensure at least max address when compiled without debuginfo: */
. = (SZ_end-SZparisc_kernel_start+KERNEL_BINARY_TEXT_START);
+#endifThis would cause the kernel to be built in a single section
Yes.
Quoted 4 lines
for the
!defined(CONFIG_DEBUG_INFO) case, meaning we'd always blow through the 0x00100000-end text hole we need to leave for the compressed kernel to decompress into.
The debug info occupied the memory (and more) in the 0x00100000-end text area, so we have the room to decompress to.
But the second patch I just sent is better anyway.
Helge
James Bottomley
maintainerQuoted 71 lines · Helge Deller
Quoted 57 lines · James Bottomley
Quoted 56 lines · Helge Deller
* Sven Schnelle <[email protected]>:
Quoted 16 lines
When compiling the kernel with debug information i got the following error:
hppa-linux-gnu-ld: section .text LMA [0000000000e78000,0000000000e7b41f] overlaps section .rodata.compressed LMA [00000000000e0078,00000000015ad43d] make[3]: *** [
/home/svens/parisc-linux/src/arch/parisc/boot/compressed/Makefile:28:arch/parisc/boot/compressed/vmlinux] Error 1 make[2]: *** [/home/svens/parisc-linux/src/arch/parisc/boot/Makefile:17:arch/parisc/boot/compressed/vmlinux] Error 2 make[2]: Target 'arch/parisc/boot/bzImage' not remade because of
errors.Quoted 10 lines
While this might also be fixed by adjusting the linker script, i
think we
should strip the debug information when generating the compressed
image. This
reduces the size of vmlinuz/lifimage from ~69MB to 6.6MB when full
debug
information is enabled.I think keeping debug info is good.
Can you test this patch instead?
It converts a 141MB vmlinux boot file (with debug info) to a 32M vmlinuz for me.Ideally I would prefer something like
. = MIN_OR_HIGHER_THAN_CURRENT_ADDR((SZ_end -SZparisc_kernel_start
+KERNEL_BINARY_TEXT_START));
to avoid the ifdef, but I'm missing the linker script expert knowledge...Helge
------------------------
[PATCH] parisc: Allow building a compressed vmlinuz withCONFIG_DEBUG_INFOenabled.Signed-off-by Helge Deller <[email protected]>arch/parisc/boot/compressed/vmlinux.lds.S +0
-0@@ -49,7 +49,10 @@ SECTIONS }Quoted 12 lines
Quoted 10 lines
arch/parisc/boot/compressed/vmlinux.lds.S +0
-0/* bootloader code and data starts behind area ofextracted
kernel */arch/parisc/boot/compressed/vmlinux.lds.S +2
-0+#if !defined(CONFIG_DEBUG_INFO) + /* ensure at least max address when compiled withoutdebug
info: */
. = (SZ_end-SZparisc_kernel_start+KERNEL_BINARY_TEXT_START);
+#endifThis would cause the kernel to be built in a single section
Quoted 8 lines
Yes.
Quoted 3 lines
for the !defined(CONFIG_DEBUG_INFO) case, meaning we'd always blow through the 0x00100000-end text hole we need to leave for the compressed kernel to decompress into.
The debug info occupied the memory (and more) in the 0x00100000-end text area, so we have the room to decompress to.
Only if the end of text in the compressed section occurs before 0x00100000. That was the bug that caused my decompression to fail. Even for a moderately configured kernel, the compressed text size is often bigger than the 128kb we have available between 0x000e0000 and 0x00100000.
James
Quoted 4 lines
But the second patch I just sent is better anyway.
Helge