EmbDev.net

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


Author: Alex3939 Alex3939 (alex3939)
Posted on:

Rate this post
0 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

Author: Simon Ellwood (fordp)
Posted on:

Rate this post
0 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 ?

Author: Alex3939 Alex3939 (alex3939)
Posted on:

Rate this post
0 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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.