[RFC PATCH] Link the bootwrapper as a position-independent executable

Segher Boessenkool segher at kernel.crashing.org
Thu Aug 7 00:21:57 EST 2008


> Instead we now link the bootwrapper with -pie to get a position-
> independent executable, and process the relocations in the dynamic
> relocation section that the linker puts into the executable.

Hurray!  Looks good, just a few nits...

> +	bl	.+4
> +p_base:	mflr	r10		/* r10 now points to runtime addr of p_base */

bl p_base  instead?

> +10:	or.	r8,r0,r9	/* skip relocation if we don't have both */
>  	beq	3f

Either the code or the comment is wrong -- the code says "skip  
relocation
if we don't have either".

> +	cmpwi	r0,22		/* R_PPC_RELATIVE */
> +	bne	3f

It would be nice if there was some way to complain (at build time?)
if there are unhandled relocations present.  Prevents a lot of headaches
when things go wrong (and they will ;-) )

>  4:	dcbf	r0,r9
>  	icbi	r0,r9

Fix these while you're at it?  It's not r0, it's 0.

> +  .dynsym : { *(.dynsym) }
> +  .dynstr : { *(.dynstr) }
> +  .dynamic :
> +  {
> +    __dynamic_start = .;
> +    *(.dynamic)
> +  }
> +  .hash : { *(.hash) }
> +  .interp : { *(.interp) }
> +  .rela.dyn : { *(.rela*) }

Do some of these sections need alignment?


Segher




More information about the Linuxppc-dev mailing list