c++ - Can llvm emit code that jumps to a given address within a function? -


following on this question, possible llvm generate code may jump arbitrary address within function in same address space? i.e.

      void func1() {        ...        <code jumps addr2>        ...        }         void func2() {        ... addr2:        <some code in func2()>        ...        } 

yes,no,yes,no,(yes) - depends on level @ , mean possible:

  • yes, llvm backend produce target specific assembler instructions , assembler instructions allow set program counter abitrary value.
  • no, because - far know - llvm ir (the intermediate representation frontend clang compiles c code) hasn't instructions allow abitrary jumps between (llvm-ir) functions.
  • yes, because frontend produce code, simulates behaviour (breaking func2 multiple separate functions).
  • no, because c , c++ don't allow such jumps arbitrary positions , clang not compile program tries (e.g. via goto)
  • (yes) c longjmp macro jumps place in control flow have visited (where called setjmp) restores (most) of system state.

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -