gas question: PowerPC section relative addressing

Rob Ballantyne ballanty@cecm.sfu.ca
Sun Mar 10 18:06:00 GMT 2002


  Hello All,

  I'm sure I'm missing something very obvious but I can't find
it anywhere.  

  I would like to be able to set a particular register to be
the base of a section, say r2, so that I can access data within
that section.  Something like:


		lis r2,data@ha
		addi r2,0,data@l

		lwz r14,fred(r2)

data:		.data
somedata:	.int 0
somemore:	.int 0
fred:		.int 1234


  So far I haven't found the necessary trick but I have 
managed to see that something like:


		lis r2,data@ha
		addi r2,0,data@l

		lwz r14,(fred-data)(r2)

data:		.data
somedata:	.int 0
somemore:	.int 0
fred:		.int 1234

does work but is ackward.

  Is there a better way to do section relative addressing?

  Thanks,

Rob



More information about the Binutils mailing list