PC-Relative Addressing

The compiler does not accept references to addresses that are relative to the program counter. For example, the following is not supported:

asm(b *+8);

Instead, use one of the following:

  1. Use labels to specify an address in executable code.
    Listing 1. Using a label instead if PC-relative addressing
    asm(b next);
    asm(next:);
    
    /* OR */
    
    asm{
        b next1
        next1:
    }
    
  2. Use relative branch in the function-level assembly instead of statement level.
    Listing 2. Using relative branching in the function-level assembly
    asm void functionLevel();
    asm void functionLevel(){
      b *+8
      nop
      blr
    }