This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to force comipler generate LCALL and LJMP for all funciton call?

I am writing a library for 8051 mcu. this library call some outside functions, i mean some routine defined by user, I am not sure how far those codes will be seperated from my library in code space, to be sure, I like to force compiler generate a long jmp for all these calls.

( I am writting some stub to simulate user's routines now.)

Parents
  • The linker optimizes calls from LCALLs to ACALLs, not the compiler. Only the linker knows how far away the target code actually is. It sounds like you're talking about a statically linked library. In that case, don't worry about it and let the linker handle it.

    If you don't compile with the OBJECTADVANCED (OA) directive, the compiler won't put information in the .objs that lets the linker perform this optimization in the first place. So you'd be stuck with LCALLs even if the routine was close.

Reply
  • The linker optimizes calls from LCALLs to ACALLs, not the compiler. Only the linker knows how far away the target code actually is. It sounds like you're talking about a statically linked library. In that case, don't worry about it and let the linker handle it.

    If you don't compile with the OBJECTADVANCED (OA) directive, the compiler won't put information in the .objs that lets the linker perform this optimization in the first place. So you'd be stuck with LCALLs even if the routine was close.

Children
No data