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]

Re: GAS compiling problem on ARM




Because the symbol arm_lock32 is exported, gas is refusing to resolve the offset at assembly time. Since it has no way of representing the relocation in the object file it is then generating an error. You can work around the problem by defining an alternative local symbol as follows:

.thumb

.globl arm_lock
.globl arm_lock32
arm_lock: adr r0,.Larm_lock32_internal
bx r0
.align 2
.arm
arm_lock32:
.Larm_lock32_internal:


Note, if all you want to do is switch to ARM state from thumb state (eg add a Thumb veneer to an ARM function, then the following trick will also work:

	.thumb
	.align 2
arm_lock:
	bx	pc	// PC is (. + 4), bit 0 == 0, '.' is word aligned.
	nop
	.arm
arm_lock32:
	...

Note that for this to work, the bx instruction must be word aligned (hence the ".align 2" before the Thumb code sequence.

R.


Thanks! This was swallowed by the assembler just fine!


Now for something quite interesting: I fed AXD with the GNU-generated ELF-file, to see if they would co-operate. I was quite surprised to find out that the file was loaded with switched endianess, which of course produces garbage. Using objdump on the ELF file says it is in little endian, and the target setting is also little endian.

If I do a hex-dump of the ELF-file using objdump, it looks correct. But using "interleave assembly" shows garbage in the AXD.

Are GNU tools and AXD simply non-compatible, or am I doing something wrong here? I can see the source files, so the debug info should be correct.

/Mats



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