Page 2 of 3

Re: elf relocation on arm

Posted: Tue Jun 11, 2013 3:13 pm
by matiashr
ok.
does this mean that all addresses will end with bit zero set to one?
if so. how come gcc produces a blx 0x20010184 instruction?
im using the same flags as chibios makefile.
matias

Re: elf relocation on arm

Posted: Tue Jun 11, 2013 3:50 pm
by Giovanni
Are you looking at the actual memory content or the listing file?

Giovanni

Re: elf relocation on arm

Posted: Tue Jun 11, 2013 5:00 pm
by matiashr
well both.
listing shows the address as a offset. while debugger shows it as absolute.
m

Re: elf relocation on arm

Posted: Tue Jun 11, 2013 6:12 pm
by Giovanni
The program counter bit zero must always contain 1, I would assume there is an error in compiler options or in the assembler sources, you need to use the .thumb directive in assembler files.

Giovanni

Re: elf relocation on arm

Posted: Tue Jun 11, 2013 8:12 pm
by matiashr
ok.
but this instuction comes from c code. so theres no hand crafted assembly
looks like this

Code: Select all

int main ()
{
  test ();
}

this results in blx instruction
i should mention that test() is not defined. but is intended to be linked at runtime
thus a entry in the plt

Re: elf relocation on arm

Posted: Tue Jun 11, 2013 8:17 pm
by Giovanni
So, it is the linker that has to put an odd address there or I am missing something?

Giovanni

Re: elf relocation on arm

Posted: Tue Jun 11, 2013 9:24 pm
by matiashr
i doubt there is anything wrong with the linker for such a simple example.
but perhaps i must align .got section in the linker file to a uneven offset?

m

Re: elf relocation on arm

Posted: Wed Jun 12, 2013 6:51 pm
by matiashr
perhaps tyere is a linker bug here. blx (address) is not supported on m4
it must be blx rm

Re: elf relocation on arm

Posted: Wed Jun 12, 2013 7:08 pm
by Giovanni
I think "blx" only accepts a register as parameter or it would be "bl" which is limited to near addresses.

Giovanni

Re: elf relocation on arm

Posted: Wed Jun 12, 2013 8:08 pm
by matiashr
yes. so theee must be a linker bug or some flag required?