[PATCH] ppc boot: replace string labels with numbers

Jerry Van Baren gerald.vanbaren at smiths-aerospace.com
Fri Nov 18 09:54:25 EST 2005

Olaf Hering wrote:
> Replacing the string labels with numbers saves 117 bytes in the final zImage.
> These local labels are not discared.
> Signed-off-by: Olaf Hering <olh at suse.de>
>  arch/powerpc/boot/crt0.S |   23 +++++++++++------------
>  1 files changed, 11 insertions(+), 12 deletions(-)
> Index: linux-2.6.15-rc1-olh/arch/powerpc/boot/crt0.S
> ===================================================================
> --- linux-2.6.15-rc1-olh.orig/arch/powerpc/boot/crt0.S
> +++ linux-2.6.15-rc1-olh/arch/powerpc/boot/crt0.S
> @@ -14,43 +14,42 @@
>  	.text
>  	.globl	_zimage_start
>  _zimage_start:
> -	bl	reloc_offset
> +	bl	1f
> -reloc_offset:
> +1:
>  	mflr	r0
> -	lis	r9,reloc_offset at ha
> -	addi	r9,r9,reloc_offset at l
> +	lis	r9,1b at ha
> +	addi	r9,r9,1b at l
>  	subf.	r0,r9,r0
> -	beq	clear_caches
> +	beq	3f


OK, I've waited for someone dumber than me to ask, but I guess I'm the 
bottom guy on the totem pole here.

How does changing a local ascii label to a temporary label _but using 
the same machine instructions_ affect the output image size????  Why 
would "lis r9,reloc_offset at ha" generate a smaller (!) instruction than 
"lis r9,1b at ha"????

My first thought was that the symbol section of the ELF output is 
bigger, but the labels are not globals.  Even if the local labels end up 
in the symbol section (which the comment on the original patch message 
sort of implies), that isn't going to make a (stripped) binary any 
bigger.  If that is the case, isn't a better cure to strip the ELF file?

While I'm being dumb, I gotta ask, how big is zImage and why does 117 
bytes make a difference?

My 2c: if you are going to use inscrutable labels (1,2,3,4), please put 
comments in.  At least the previous labels gave hints as to what was 


More information about the Linuxppc-dev mailing list