EmbDev.net

Forum: ARM programming with GCC/GNU tools Problem CodeSourcery arm-none-eabi-ld with --fix-v4bx


von Alex3939 A. (alex3939)


Rate this post
useful
not useful
Hi,
   I am  using the codesourcery 2007q3 ARM GCC toolchain to compiling
code for an arm CPU that is supported ARMV4 instruction set only.

Because ARMV4 do not support BX OP code,
So I used --fix-v4bx  as linker(arm-none-eabi-ld) parameters.
The problem is this option do not work with the libc or libgcc.

But even with --fix-v4bx, the "BX lr" instruction was not converted to
"mov pc, lr" in the output ELF file.  I mean the functions in libc.a or
libgcc.a.
E.g. the return OP code of memcpy().

Are there anyone know this issue or how can I fix it ?
Thanks
Alex

von Simon E. (fordp)


Rate this post
useful
not useful
This does not make much sense. The libraries are already built for the
architecture that they run on.

Codesourcery have there own forum you can go on. I would try there.

I am guessing you are using the lite version ?

I would say you have a makefile issue here and you are specifying the
wrong architecture.

Which chip are you building for ?

von Alex3939 A. (alex3939)


Rate this post
useful
not useful
Simon Ellwood wrote:
> This does not make much sense. The libraries are already built for the
> architecture that they run on.
>
> Codesourcery have there own forum you can go on. I would try there.
>
> I am guessing you are using the lite version ?
>
> I would say you have a makefile issue here and you are specifying the
> wrong architecture.
>
> Which chip are you building for ?

Yes, I am building for little endian. The chip is FA526 core that is
compatible with armv4 instruction set.

The libc and libgcc is build from armv4t that generate interwork code
using BX OP code.

Refer the source code of BFD in binutils that will replace the BX OP
code to MOV OP code.

Below is the portion from elf32-arm.c in binutils.

    case R_ARM_V4BX:
      if (globals->fix_v4bx)
        {
          bfd_vma insn = bfd_get_32 (input_bfd, hit_data);

          /* Ensure that we have a BX instruction.  */
          BFD_ASSERT ((insn & 0x0ffffff0) == 0x012fff10);

          /* Preserve Rm (lowest four bits) and the condition code
             (highest four bits). Other bits encode MOV PC,Rm.  */
          insn = (insn & 0xf000000f) | 0x01a0f000;

          bfd_put_32 (input_bfd, insn, hit_data);
        }
      return bfd_reloc_ok

So, I suppose the -fix-v4bx should be work.

Alex

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.