Problem CodeSourcery arm-none-eabi-ld with --fix-v4bx

OP #1173237
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
#1173238
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 ?
OP #1173239
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

A question of your own? This thread is over 18 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.