This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

arm/thumb: GOT and indirections


Heyho!

this simple C program:
main(){ 
	foo("hello george!\n");
}

compiled with gcc 3.0.3 for arm and -fpic -mthumb produces:
[...]
   2:	4803      	ldr	r0, [pc, #12]	(10 <main+0x10>)
   4:	5831      	ldr	r1, [r6, r0]
   6:	6808      	ldr	r0, [r1, #0]
   8:	fffef7ff 	bl	0 <main>
			8: R_ARM_THM_PC22	foo
[...]

(-msingle-pic-base and optimization do not seem to matter).
first ldr loads offset into GOT table.
second ldr loads address of the string into r1
third ldr loads first word of the string into r0. Huh!?!?!?!?

I'll do some more investigation tomorrow (compiling cvs HEAD toolchain
as I write this). But probably somebody already had this:
 - is it fixed in cvs head?
 - is it fixed in cvs branch?
 - if so: is it known which patch fixed it (I'd rather avoid using cvs
versions for real work)?

greets from Zürich
-- vbi


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