Subject: Re: [PATCH] ppc boot: replace string labels with numbers

From: Jerry Van Baren <[email-masked]>
Date: Thu, 17 Nov 2005 17:54:25 -0500

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 <[email-masked]>
> 
>  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@ha
> -	addi	r9,r9,reloc_offset@l
> +	lis	r9,1b@ha
> +	addi	r9,r9,1b@l
>  	subf.	r0,r9,r0
> -	beq	clear_caches
> +	beq	3f

[snip]

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@ha" generate a smaller (!) instruction than 
"lis r9,1b@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 
happening.

Puzzled,
gvb