Hi,
I am using the GNU tools ld and gas to assemble a program which is contained in two files. I am using the thumb instruction set. I use the following flags when assembling: -mcpu=arm7tdmi -mthumb -EL
My problem is when trying to jump from one function to another that is contained in the other file. If I do this:
ld r0,=func_name mov pc,r0
then everything works as expected. However, if I do
b func_name
it doesn't work. I have dissassembled the final linked code using objdump to see what is happening, and the branch address doesn't make sense. While investigating the problem I changed the branch to a function in the same file, and the dissasembly then looks OK, and the program works. The problem is only when I branch to a function in the other file.
It looks like the symbol func_name is being found - I have specified it as global in my second file, and the linker doesn't complain that it can't find a reference. In addition, the first method above works, so this proves that the symbol is being found.
Is this weird behaviour, or am I doing something wrong?
I don't write a lot of assembler so maybe this is the problem!
thx