Can _start be the thumb function?

后端 未结 3 759
礼貌的吻别
礼貌的吻别 2020-11-30 15:47

Help me please with gnu assembler for arm926ejs cpu.

I try to build a simple program(test.S):

.global _start 
_start:
    mov r0, #2
    bx lr
         


        
3条回答
  •  猫巷女王i
    2020-11-30 15:56

    here answer.

    Thanks for all.

    http://stuff.mit.edu/afs/sipb/project/egcs/src/egcs/gcc/config/arm/README-interworking

    • Calls via function pointers should use the BX instruction if the call is made in ARM mode:

          .code 32
          mov lr, pc
          bx  rX
      

      This code sequence will not work in Thumb mode however, since the mov instruction will not set the bottom bit of the lr register. Instead a branch-and-link to the _call_via_rX functions should be used instead:

          .code 16
          bl  _call_via_rX
      

      where rX is replaced by the name of the register containing the function address.

提交回复
热议问题