This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gas question: PowerPC section relative addressing


  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]