elf relocation on arm

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

matiashr
Posts: 16
Joined: Mon Dec 17, 2012 12:20 am

Re: elf relocation on arm

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: elf relocation on arm

Post by Giovanni »

Are you looking at the actual memory content or the listing file?

Giovanni
matiashr
Posts: 16
Joined: Mon Dec 17, 2012 12:20 am

Re: elf relocation on arm

Post by matiashr »

well both.
listing shows the address as a offset. while debugger shows it as absolute.
m
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: elf relocation on arm

Post 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
matiashr
Posts: 16
Joined: Mon Dec 17, 2012 12:20 am

Re: elf relocation on arm

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: elf relocation on arm

Post by Giovanni »

So, it is the linker that has to put an odd address there or I am missing something?

Giovanni
matiashr
Posts: 16
Joined: Mon Dec 17, 2012 12:20 am

Re: elf relocation on arm

Post 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
matiashr
Posts: 16
Joined: Mon Dec 17, 2012 12:20 am

Re: elf relocation on arm

Post by matiashr »

perhaps tyere is a linker bug here. blx (address) is not supported on m4
it must be blx rm
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: elf relocation on arm

Post by Giovanni »

I think "blx" only accepts a register as parameter or it would be "bl" which is limited to near addresses.

Giovanni
matiashr
Posts: 16
Joined: Mon Dec 17, 2012 12:20 am

Re: elf relocation on arm

Post by matiashr »

yes. so theee must be a linker bug or some flag required?
Post Reply